Class: Sketchup::ComponentDefinition
- Inherits:
-
DrawingElement
- Object
- DrawingElement
- Sketchup::ComponentDefinition
- Includes:
- Comparable
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb
Overview
The ComponentDefinition class is used to define the contents for a SketchUp component. Components are a collection of entities that can be instanced and reused multiple times throughout a model. For example, you could draw a chair once, turn it into a component, and then use 6 instances of it to surround a table. Edits to the original “definition” will then propagate across all of its instances.
The ComponentDefinition class contains the global entities and settings for each definition. See the ComponentInstance class for how each copy is defined.
Starting from SketchUp 2018+, the ComponentDefinition class contains a new default attribute dictionary named “SU_DefinitionSet” with default keys named named “Price”, “Size”, “Url”. See the Help article for more information. The dictionary cannot be deleted via ruby and an ArgumentError will be raised. The key/value pairs in the dictionary can be deleted safely.
Instance Method Summary collapse
-
#<=>(compdef2) ⇒ Integer
The <=> method is used to compare two ComponentDefinition objects for sorting.
-
#==(compdef2) ⇒ Boolean
The == method is used to test if two ComponentDefinition objects are the same (based on their address in memory).
-
#add_classification(schema_name, schema_type) ⇒ Boolean
The add_classification method is used to add a given classification to the component.
-
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
-
#behavior ⇒ Sketchup::Behavior
The behavior method is used to retrieve the Behavior object associated with a component definition.
-
#count_instances ⇒ Integer
The count_instances method is used to count the number of unique component instances in a model using this component definition.
-
#count_used_instances ⇒ Integer
The count_used_instances method is used to count the total number of component instances in a model using this component definition.
-
#description ⇒ String
The description method is used to retrieve the description of the component definition.
-
#description=(description) ⇒ String
The description= method is used to set the description for the component definition.
-
#entities ⇒ Sketchup::Entities
The entities method retrieves a collection of all the entities in the component definition.
-
#get_classification_value(path) ⇒ Object?
The get_classification_value method is used to retrieve the value from a classification attribute given a key path.
-
#group? ⇒ Boolean
The group? method is used to determine if this component definition is used to hold the elements of a group.
-
#guid ⇒ String
The guid method is used to retrieve the unique identifier of this component definition.
-
#hidden? ⇒ Boolean
The hidden method is used to determine if this component definition should be hidden on the component browser.
-
#image? ⇒ Boolean
The image? method is used to determine if this component definition is used to define an image.
-
#insertion_point ⇒ Geom::Point3d
deprecated
Deprecated.
SketchUp 2020.0 removed the insertion point feature. The getter will always return the origin point and the setter becomes a no-op.
-
#insertion_point=(point) ⇒ Geom::Point3d
deprecated
Deprecated.
SketchUp 2020.0 removed the insertion point feature. The getter will always return the origin point and the setter becomes a no-op.
-
#instances ⇒ Array<Sketchup::ComponentInstance>
The instances method is used to return any array of ComponentInstancesfor this ComponentDefinition.
-
#internal? ⇒ Boolean
The internal? method is used to determine if the component definition is internal to the Component Browser.
-
#invalidate_bounds ⇒ Boolean
Invalidates the bounding box of your definition.
-
#live_component? ⇒ Boolean
The #live_component? method is used to identify Live Components and sub-definitions of Live Components.
-
#name ⇒ String
The name method retrieves the name of the component definition.
-
#name=(name) ⇒ String
The name= method is used to set the name of the component definition.
-
#path ⇒ String
The path method is used to retrieve the path where the component was loaded.
-
#refresh_thumbnail ⇒ nil
The refresh_thumbnail method is used to force SketchUp to regenerate the thumbnail image that appears in the component browser.
-
#remove_classification(schema_name, schema_type) ⇒ Boolean
The remove_classification method is used to remove a given classification from the component.
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
-
#save_as(file_path) ⇒ Boolean
The save_as method is used to save your definition as a SketchUp file at the specified file destination.
-
#save_thumbnail(filename) ⇒ Boolean
Saves a component thumbnail image.
-
#set_classification_value(path, value) ⇒ Boolean
The set_classification_value method is used to set the value of a classification attribute given a key path.
Instance Method Details
#<=>(compdef2) ⇒ Integer
The <=> method is used to compare two ComponentDefinition objects for sorting. The comparison is done based on the component name.
50 51 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 50 def <=>(compdef2) end |
#==(compdef2) ⇒ Boolean
The == method is used to test if two ComponentDefinition objects are the same (based on their address in memory).
72 73 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 72 def ==(compdef2) end |
#add_classification(schema_name, schema_type) ⇒ Boolean
The add_classification method is used to add a given classification to the component.
Note that you cannot classify image definitions.
93 94 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 93 def add_classification(schema_name, schema_type) end |
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
108 109 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 108 def add_observer(observer) end |
#behavior ⇒ Sketchup::Behavior
The behavior method is used to retrieve the Behavior object associated with a component definition.
125 126 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 125 def behavior end |
#count_instances ⇒ Integer
The count_instances method is used to count the number of unique component instances in a model using this component definition. This does not represent the total number of instances placed in the model as it doesn’t take into account instances inside unused definitions.
144 145 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 144 def count_instances end |
#count_used_instances ⇒ Integer
The count_used_instances method is used to count the total number of component instances in a model using this component definition. This method takes into account the full hierarchy of the model.
162 163 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 162 def count_used_instances end |
#description ⇒ String
The description method is used to retrieve the description of the component definition.
Component definitions do not have a description, by default.
178 179 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 178 def description end |
#description=(description) ⇒ String
The description= method is used to set the description for the component definition.
195 196 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 195 def description=(description) end |
#entities ⇒ Sketchup::Entities
The entities method retrieves a collection of all the entities in the component definition
208 209 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 208 def entities end |
#get_classification_value(path) ⇒ Object?
The get_classification_value method is used to retrieve the value from a classification attribute given a key path.
227 228 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 227 def get_classification_value(path) end |
#group? ⇒ Boolean
The group? method is used to determine if this component definition is used to hold the elements of a group.
244 245 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 244 def group? end |
#guid ⇒ String
The guid method is used to retrieve the unique identifier of this component definition. The guid changes after the component definition is modified and the component edit is exited.
258 259 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 258 def guid end |
#hidden? ⇒ Boolean
The hidden method is used to determine if this component definition should be hidden on the component browser.
271 272 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 271 def hidden? end |
#image? ⇒ Boolean
The image? method is used to determine if this component definition is used to define an image.
290 291 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 290 def image? end |
#insertion_point ⇒ Geom::Point3d
SketchUp 2020.0 removed the insertion point feature. The getter will always return the origin point and the setter becomes a no-op.
The insertion_point method is used to retrieve the Point3d object where the component was inserted.
316 317 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 316 def insertion_point end |
#insertion_point=(point) ⇒ Geom::Point3d
SketchUp 2020.0 removed the insertion point feature. The getter will always return the origin point and the setter becomes a no-op.
Sets the insertion point of your definition.
337 338 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 337 def insertion_point=(point) end |
#instances ⇒ Array<Sketchup::ComponentInstance>
The instances method is used to return any array of ComponentInstancesfor this ComponentDefinition.
351 352 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 351 def instances end |
#internal? ⇒ Boolean
The internal? method is used to determine if the component definition is internal to the Component Browser
371 372 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 371 def internal? end |
#invalidate_bounds ⇒ Boolean
Invalidates the bounding box of your definition. This command forces the update of the bounding box of definition while inside an operation. See Model.start_operation for how to start an operation.
This method is useful if you make changes to your geometry using the Ruby API and then need to know your bounding box size. This method forces SketchUp to recalculate the definition’s bounding box when you choose.
389 390 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 389 def invalidate_bounds end |
#live_component? ⇒ Boolean
These components are parametrically generated and API users should not modify them.
The #live_component? method is used to identify Live Components and sub-definitions of Live Components.
408 409 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 408 def live_component? end |
#name ⇒ String
The name method retrieves the name of the component definition.
424 425 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 424 def name end |
#name=(name) ⇒ String
The name= method is used to set the name of the component definition.
443 444 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 443 def name=(name) end |
#path ⇒ String
The path method is used to retrieve the path where the component was loaded.
458 459 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 458 def path end |
#refresh_thumbnail ⇒ nil
The refresh_thumbnail method is used to force SketchUp to regenerate the thumbnail image that appears in the component browser. This is useful if you’ve used the API to change the geometry of your component and would like the thumbnail to match.
473 474 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 473 def refresh_thumbnail end |
#remove_classification(schema_name, schema_type) ⇒ Boolean
The remove_classification method is used to remove a given classification from the component.
Note that you cannot classify image definitions.
496 497 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 496 def remove_classification(schema_name, schema_type) end |
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
512 513 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 512 def remove_observer(observer) end |
#save_as(file_path) ⇒ Boolean
The save_as method is used to save your definition as a SketchUp file at the specified file destination.
528 529 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 528 def save_as(file_path) end |
#save_thumbnail(filename) ⇒ Boolean
Saves a component thumbnail image. The image format is specified by the file extension of filePath. Supported image formats are bmp, jpg, png, tif, pct, and gif.
544 545 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 544 def save_thumbnail(filename) end |
#set_classification_value(path, value) ⇒ Boolean
The set_classification_value method is used to set the value of a classification attribute given a key path.
574 575 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb', line 574 def set_classification_value(path, value) end |