class ComponentInstance |
Parent: DrawingElement |
|
Methods: definition, definition=, explode, glued_to, glued_to=, locked?, make_unique, move!, transform!, transformation, transformation= |
|
Sample Code: componentinstancetests.rb |
|
Instance Methods |
definition |
The definition method is used to retrieve the component definition for this component instance. |
Syntax: |
componentdefinition = instance.definition |
Arguments: |
|
Return Value: |
componentdefinition - a ComponentDefinition object if successful |
Comments: |
|
Example: |
point = Geom::Point3d.new 10,20,30 definitions = model.definitions |
definition= |
The definition= method is used to set the component definition for this component. |
Syntax: |
componentdefinition = componentinstance.definition = componentdefinition |
Arguments: |
componentdefinition - a ComponentDefinition object to set |
Return Value: |
componentdefinition - the ComponentDefinition object that was set if successful, false if unsuccessful |
Comments: |
This method causes the instance to use a different definition, but it will use the same transformation to position it in the Model. |
Example: |
point = Geom::Point3d.new 10,20,30 componentdefinition1 = definitions.load
path1 |
explode |
The explode method is used to explode the component instance into separate entities. |
Syntax: |
entities = componentinstance.explode |
Arguments: |
|
Return Value: |
entities - an Entities object if successful, false if unsuccessful |
Comments: |
|
Example: |
point = Geom::Point3d.new 10,20,30 # Status is an array of all of the entities,
verticies, edges uses, and everything |
glued_to |
The glued_to method is used to retrieve the entity that this instance is glued to. |
Syntax: |
entity = componentinstance.glued_to |
Arguments: |
|
Return Value: |
entity - the Entity object that the instance is glued to (if successful) |
Comments: |
Returns nil if it is not glued to anything. |
Example: |
point = Geom::Point3d.new 10,20,30 |
glued_to= |
The glued_to= method glues this instance to a face. |
Syntax: |
face = componentinstance.glued_to = face |
Arguments: |
|
Return Value: |
face - the Face object where the component is glued if successful |
Comments: |
This method will raise an exception if the instance cannot be glued to the given face. Instances cannot be glued if the definition of the instance doesn't support gluing or if the alignment is wrong. |
Example: |
depth = 100 |
locked? |
The locked? method is used to determine if a component instance is locked. |
Syntax: |
status = componentinstance.locked? |
Arguments: |
|
Return Value: |
status - true if the component instance is locked. False if the instance is not locked. |
Comments: |
|
Example: |
|
make_unique |
The make_unique method is used to create a component definition for this instance that is not used by any other instances. |
Syntax: |
status = componentinstance.make_unique |
Arguments: |
|
Return Value: |
status - true if successful, false if unsuccessful |
Comments: |
|
Example: |
point = Geom::Point3d.new 10,20,30 path = Sketchup.find_support_file "TableRound36.skp"
,"Components/Furniture/" |
move! |
The move! method is the same as the transform! method, except that it does not record the move as an undo operation. |
Syntax: |
status=instance.move! transformation |
Arguments: |
|
Return Value: |
status - true if successful, false if unsuccessful |
Comments: |
This method is useful for moving entities inside of an animation or page transition. |
Example: |
point = Geom::Point3d.new 10,20,30 |
transform! |
The transform! method is used to apply a transformation to a component instance. |
Syntax: |
status = componentinstance.transform! transformation |
Arguments: |
transformation - the transform object to apply to the component instance |
Return Value: |
status - true if successful, false if unsuccessful |
Comments: |
|
Example: |
UI.messagebox "Applying a new Transformation
(in this case, a move)" |
transformation |
The transformation method is used to retrieve the transformation of this instance. |
Syntax: |
transformation = componentinstance.transformation |
Arguments: |
|
Return Value: |
transformation - the Transformation object if successful |
Comments: |
|
Example: |
point = Geom::Point3d.new 10,20,30 path = Sketchup.find_support_file "TableRound36.skp"
,"Components/Furniture/" |
transformation= |
The transformation= method is used to set the transformation for this instance. |
Syntax: |
transformation = instance.transformation = transformation |
Arguments: |
transformation - the new Transformation object to set |
Return Value: |
transformation - the Transformation object that was set if successful |
Comments: |
|
Example: |
point = Geom::Point3d.new 10,20,30 path = Sketchup.find_support_file "TableRound36.skp"
,"Components/Furniture/" if (status) |