Class: Sketchup::DefinitionList
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 Method Summary # collapse
-
#[](arg) ⇒ Object
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.
-
#at(arg) ⇒ Object
The [] method is used to retrieve a component definition from the list.
- #count ⇒ Integer
-
#each {|Sketchup::ComponentDefinition| ... } ⇒ nil
The each method is used to iterate through all of the component definitions in the definition list.
-
#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, load_handler = nil) ⇒ 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.
Methods inherited from Entity
#attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #set_attribute, #to_s, #typename, #valid?
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
↑ #each {|Sketchup::ComponentDefinition| ... } ⇒ nil
The each method is used to iterate through all of the component definitions in the definition list.
Throws an exception if there are no component definitions.
↑ #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, load_handler = nil) ⇒ 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. Optional second parameter load_handler can be used to pass in a ruby object that responds to the following methods:
- cancelled?(a_boolean)
- onPercentChange(a_float)
- onSuccess()
- onFailure()
↑ #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. 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.