Class: Sketchup::DefinitionList
| Relationships | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Entity
|
|
|
Instance Chain:
self,
Enumerable,
Entity
|
|
| Inherits: |
Sketchup::Entity
|
Overview
A DefinitionList object holds a list of all of the ComponentDefinition
objects in a model. This class contains methods for adding and retrieving
definitions from the list.
Instance Attribute Summary
Entity - Inherited
Instance Method Summary
-
#[](index) ⇒ Sketchup::ComponentDefinition?
The [] method is used to retrieve a component definition from the list.
-
#add(def_name) ⇒ Sketchup::ComponentDefinition
The add method is used to add a new component definition to the definition list with the given name.
-
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
-
#[](index) ⇒ Sketchup::ComponentDefinition?
The [] method is used to retrieve a component definition from the list.
- #count ⇒ Integer
-
#each {|definition| ... } ⇒ Sketchup::ComponentDefinition
The #each method is used to iterate through all of the component definitions in the definition list.
-
#import(path, options = {}) ⇒ Sketchup::ComponentDefinition
The #import method is used to import a (non-SketchUp) 3d model file as a definition.
-
#length ⇒ Integer
The #length method is used to retrieve number of component definitions in the list.
-
#load(path) ⇒ Sketchup::ComponentDefinition
The #load method is used to load a component from a file.
-
#load_from_url(url) ⇒ Sketchup::ComponentDefinition
The #load_from_url method loads a component from a location specified by string url.
-
#purge_unused ⇒ Sketchup::DefinitionList
The #purge_unused method is used to remove the unused component definitions.
-
#remove(definition) ⇒ Boolean
The #remove method is used to remove a component definition from the definition list with the given component definition.
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
- #size ⇒ Integer
-
#unique_name(base_name) ⇒ String
The unique_name is used to generate a unique name for a definition based on a base_name string.
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 Method Details
#[](index) ⇒ Sketchup::ComponentDefinition?
#[](name) ⇒ Sketchup::ComponentDefinition?
#[](guid) ⇒ Sketchup::ComponentDefinition?
The [] method is used to retrieve a component definition from the list. You can give an integer index in the range 0 to length, a string which represents the GUID (a unique internal identifier), or a string that is the name of the definition.
#add(def_name) ⇒ Sketchup::ComponentDefinition
The add method is used to add a new component definition to the definition list with the given name.
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
#[](index) ⇒ Sketchup::ComponentDefinition?
#[](name) ⇒ Sketchup::ComponentDefinition?
#[](guid) ⇒ Sketchup::ComponentDefinition?
The [] method is used to retrieve a component definition from the list. You can give an integer index in the range 0 to length, a string which represents the GUID (a unique internal identifier), or a string that is the name of the definition.
#count ⇒ Integer
Since SketchUp 2014 the count method is inherited from Ruby's
Enumerable mix-in module. Prior to that the #count method is an alias
for #length.
#each {|definition| ... } ⇒ Sketchup::ComponentDefinition
Don't remove content from this collection while iterating over it with
#each. This would change the size of the collection and cause elements to
be skipped as the indices change. Instead copy the current collection to an
array using to_a and then use each on the array, when removing content.
The #each method is used to iterate through all of the component
definitions in the definition list.
#import(path, options = {}) ⇒ Sketchup::ComponentDefinition
The #import method is used to import a (non-SketchUp) 3d model file as a definition.
Importers using the C API SketchUpModelImporterInterface interface are supported (those in the
Importers/ directory).
See the {Sketchup::Importer Options} file for information on creating a valid hash for the various importers.
For SketchUp models, instead use #load.
#length ⇒ Integer
The #length method is used to retrieve number of component definitions in
the list.
#load(path) ⇒ Sketchup::ComponentDefinition
#load(path, allow_newer: false) ⇒ Sketchup::ComponentDefinition
The #load method is used to load a component from a file.
#load_from_url(url) ⇒ Sketchup::ComponentDefinition
#load_from_url(url, load_handler) ⇒ Sketchup::ComponentDefinition
The #load_from_url method loads a component from a location specified by
string url.
This method throws an exception if an url string is not given, or an error occurs during retrieval from URL and a load_handler was not given.
#purge_unused ⇒ DefinitionList
Silently purging can cause data loss. The user may have deleted the last instance but intend to place new ones later. Don't purge without the user's knowledge and approval.
The #purge_unused method is used to remove the unused component definitions.
#remove(definition) ⇒ Boolean
The #remove method is used to remove a component definition from the
definition list with the given component definition. This will remove all
instances of the definition.
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
#size ⇒ Integer
The #size method is an alias for #length.
#unique_name(base_name) ⇒ String
The unique_name is used to generate a unique name for a definition based on a base_name string. For example, a base_name of "Joe" might return "Joe #2"