Class: Sketchup::ComponentInstance
Relationships | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Drawingelement ,
Entity
|
|
Instance Chain:
self,
Drawingelement ,
Entity
|
|
Inherits: |
Sketchup::Drawingelement
|
Overview
The ComponentInstance
class is used to represent component instances of a component definition or components that have been dragged from the Component Browser and placed (thus, instanced) within the Model
. Therefore, the ComponentInstance
class contains a reference to a corresponding ComponentDefinition
object and a Transformation object (which contains the location of the component in the Drawing Window).
Starting from SketchUp 2018+, the ComponentInstance
class contains default attributes when created or imported. The attributes are: “Owner”, “Status”. See the Help article for more information. The dictionary cannot be deleted via ruby and an @raise ArgumentError will be raised. The key/value pairs in the dictionary can be deleted safely.
Instance Attribute Summary
-
#definition ⇒ Sketchup::ComponentDefinition
rw
The definition method is used to retrieve the component definition for this component instance.
-
#definition=(definition) ⇒ Sketchup::ComponentDefinition
rw
The definition= method is used to set the component definition for this component.
-
#glued_to ⇒ Sketchup::Face, ...
rw
The #glued_to method is used to retrieve the entity that this instance is glued to.
-
#glued_to=(drawing_element) ⇒ Sketchup::Face, ...
rw
The #glued_to= method glues this instance to a drawing element.
-
#locked=(lock) ⇒ Boolean
rw
The locked= method is used to lock a component instance.
-
#locked? ⇒ Boolean
rw
The locked? method is used to determine if a component instance is locked.
-
#manifold? ⇒ Boolean
readonly
The manifold? method is used to determine if an instance is manifold.
-
#name ⇒ String
rw
The name method is used to get the name of this instance.
-
#name=(name) ⇒ Sketchup::ComponentInstance
rw
The name method is used to set the name of this instance.
-
#transformation ⇒ Geom::Transformation
rw
The transformation method is used to retrieve the transformation of this instance.
-
#transformation=(transformation)
rw
The #transformation= method is used to set the transformation of this component instance.
Drawingelement
- Inherited
#casts_shadows= | The casts_shadows= method is used to set the |
#casts_shadows? | The casts_shadows? method is used to determine if the |
#hidden= | The hidden= method is used to set the hidden status for an element. |
#hidden? | The hidden? method is used to determine if the element is hidden. |
#layer | The layer method is used to retrieve the |
#layer= | The layer= method is used to set the layer for the drawing element. |
#material | The material method is used to retrieve the material for the drawing element. |
#material= | The material= method is used to set the material for the drawing element. |
#receives_shadows= | The receive_shadows= method is used to set the |
#receives_shadows? | The receive_shadows? method is used to determine if the |
#visible= | The visible= method is used to set the visible status for an element. |
#visible? | The visible? method is used to get the visible status for an element. |
Entity
- Inherited
Instance Method Summary
-
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
-
#equals?(instance) ⇒ Boolean
The equals? method is used to determine if a component instance is geometrically equivalent to another instance.
-
#explode ⇒ Array<Sketchup::Entity>, false
The explode method is used to explode the component instance into separate entities.
-
#guid ⇒ String
The guid method is used to get the base 64 encoded unique id for this SketchUp object.
-
#intersect(instance) ⇒ Sketchup::Group?
The intersect method is used to compute the boolean intersection of two instances representing manifold solid volumes (this - arg).
-
#make_unique ⇒ Sketchup::ComponentInstance
The #make_unique method is used to create a component definition for this instance that is not used by any other instances.
-
#move!(transformation) ⇒ Boolean
The #move! method is used to set the transformation of this component instance, similarly to #transformation= but without recording to the undo stack.
-
#outer_shell(instance) ⇒ Sketchup::Group?
The outer_shell method is used to compute the outer shell of the two instances representing manifold solid volumes (this || arg).
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
-
#show_differences(instance, verbose) ⇒ Boolean
The show_differences method is used to determine if a component instance is geometrically equivalent to another instance and in addition move the non- matching and matching geometry to new layers.
-
#split(instance) ⇒ Array(Sketchup::Group, Sketchup::Group, Sketchup::Group)
The split method is used to compute the boolean split (map overlay)of the two instances representing manifold solid volumes (this - arg).
-
#subtract(instance) ⇒ Sketchup::Group?
The subtract method is used to compute the boolean difference of the two instances representing manifold solid volumes (this - arg).
-
#transform!(transform) ⇒ Boolean
Apply a
::Geom::Transformation
to a component instance. -
#trim(instance) ⇒ Sketchup::Group?
The trim method is used to compute the (non-destructive) boolean difference of the two instances representing manifold solid volumes (this - arg).
-
#union(instance) ⇒ Sketchup::Group?
The union method is used to compute the boolean union of the two instances representing manifold solid volumes (this | arg).
-
#volume ⇒ Float
The volume method is used to compute the volume of this instance if and only if this instance is manifold.
Drawingelement
- Inherited
#bounds | The |
#erase! | The |
Entity
- Inherited
#add_observer | The add_observer method is used to add an observer to the current object. |
#attribute_dictionaries | The attribute_dictionaries method is used to retrieve the |
#attribute_dictionary | The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an |
#delete_attribute | The |
#entityID | The entityID method is used to retrieve a unique ID assigned to an entity. |
#get_attribute | The |
#inspect | The |
#model | The model method is used to retrieve the model for the entity. |
#parent | The parent method is used to retrieve the parent of the entity. |
#persistent_id | The |
#remove_observer | The remove_observer method is used to remove an observer from the current object. |
#set_attribute | The set attribute is used to set the value of an attribute in an attribute dictionary with the given name. |
#to_s | The |
#typename | The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”. |
Instance Attribute Details
#definition ⇒ Sketchup::ComponentDefinition (rw)
The definition method is used to retrieve the component definition for this component instance.
#definition=(definition) ⇒ Sketchup::ComponentDefinition (rw)
The definition= method is used to set the component definition for this component.
This method causes the instance to use a different definition, but it will use the same transformation to position it in the Model
.
#glued_to ⇒ Sketchup::Face, ... (rw)
The #glued_to
method is used to retrieve the entity that this instance is glued to.
#glued_to=(drawing_element) ⇒ Sketchup::Face, ... (rw)
#locked=(lock) ⇒ Boolean
(rw)
The locked= method is used to lock a component instance.
#locked? ⇒ Boolean
(rw)
The locked? method is used to determine if a component instance is locked.
#manifold? ⇒ Boolean
(readonly)
The manifold? method is used to determine if an instance is manifold.
#name ⇒ String (rw)
The name method is used to get the name of this instance.
#name=(name) ⇒ ComponentInstance
(rw)
The name method is used to set the name of this instance.
#transformation ⇒ Geom::Transformation (rw)
The transformation method is used to retrieve the transformation of this instance.
#transformation=(transformation) (rw)
The #transformation=
method is used to set the transformation of this component instance.
Instance Method Details
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
#equals?(instance) ⇒ Boolean
The equals? method is used to determine if a component instance is geometrically equivalent to another instance.
#explode ⇒ Array<Sketchup::Entity>, false
The explode method is used to explode the component instance into separate entities.
#guid ⇒ String
The guid method is used to get the base 64 encoded unique id for this SketchUp object.
#intersect(instance) ⇒ Sketchup::Group?
This method is not available in SketchUp Make.
The intersect method is used to compute the boolean intersection of two instances representing manifold solid volumes (this - arg). If the specified objects (this and arg) do not represent manifold volumes, this method fails.
#make_unique ⇒ ComponentInstance
The #make_unique
method is used to create a component definition for this instance that is not used by any other instances. If the component is already unique in the model, nothing happens.
#move!(transformation) ⇒ Boolean
Despite the name being similar to #transform!, this method closer corresponds to #transformation=.
The #move!
method is used to set the transformation of this component instance, similarly to #transformation= but without recording to the undo stack.
This method is useful for moving entities inside of an animation or page transition.
#outer_shell(instance) ⇒ Sketchup::Group?
The outer_shell method is used to compute the outer shell of the two instances representing manifold solid volumes (this || arg). If the specified objects (this and arg) do not represent manifold volumes, this method fails.
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
#show_differences(instance, verbose) ⇒ Boolean
The show_differences method is used to determine if a component instance is geometrically equivalent to another instance and in addition move the non- matching and matching geometry to new layers.
This method will move both instances to Layer0. Geometry that is the same in both components will be moved to a new layer named def_name + “_same”. Geometry that is not the same will be moved to a layer named def_name + “_diff”.
If verbose is true, a list of all the geometry that is different from one component to the other is displayed texturally in the Ruby Console.
#split(instance) ⇒ Array(Sketchup::Group, Sketchup::Group, Sketchup::Group)
This method is not available in SketchUp Make.
The split method is used to compute the boolean split (map overlay)of the two instances representing manifold solid volumes (this - arg). If the specified objects (this and arg) do not represent manifold volumes, this method fails.
resultant groups if the two objects (this and arg) represent manifold solids and the operation succeeds otherwise nil is returned. The 3 groups are as follows: The intersection of volume 1 & volume 2, the difference of volume 1 minus volume 2, and the reverse difference of volume 2 minus volume 1.
#subtract(instance) ⇒ Sketchup::Group?
This method is not available in SketchUp Make.
The subtract method is used to compute the boolean difference of the two instances representing manifold solid volumes (this - arg). If the specified objects (this and arg) do not represent manifold volumes, this method fails.
#transform!(transform) ⇒ Boolean
Apply a ::Geom::Transformation
to a component instance.
#trim(instance) ⇒ Sketchup::Group?
This method is not available in SketchUp Make.
The trim method is used to compute the (non-destructive) boolean difference of the two instances representing manifold solid volumes (this - arg). If the specified objects (this and arg) do not represent manifold volumes, this method fails.
#union(instance) ⇒ Sketchup::Group?
This method is not available in SketchUp Make.
The union method is used to compute the boolean union of the two instances representing manifold solid volumes (this | arg). If the specified objects (this and arg) do not represent manifold volumes, this method fails.
#volume ⇒ Float
The volume method is used to compute the volume of this instance if and only if this instance is manifold.