Class: Sketchup::DefinitionList
- Includes:
- Enumerable
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb
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(*args) ⇒ Sketchup::ComponentDefinition
The #load method is used to load a component from a file.
-
#load_from_url(*args) ⇒ 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.
46 47 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 46 def [](arg) end |
#add(def_name) ⇒ Sketchup::ComponentDefinition
The add method is used to add a new component definition to the definition list with the given name.
66 67 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 66 def add(def_name) end |
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
81 82 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 81 def add_observer(observer) end |
#[](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.
113 114 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 113 def at(arg) end |
#count ⇒ Integer
131 132 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 131 def count end |
#each {|Sketchup::ComponentDefinition| ... } ⇒ nil
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.
153 154 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 153 def each end |
#length ⇒ Integer
The #length method is used to retrieve number of component definitions in the list.
169 170 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 169 def length end |
#load(path) ⇒ Sketchup::ComponentDefinition #load(path, allow_newer: true) ⇒ Sketchup::ComponentDefinition
The #load method is used to load a component from a file.
217 218 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 217 def load(*args) end |
#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. 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()
282 283 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 282 def load_from_url(*args) end |
#purge_unused ⇒ Sketchup::DefinitionList
The purge_unused method is used to remove the unused component definitions.
294 295 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 294 def purge_unused end |
#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.
312 313 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 312 def remove(definition) end |
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
328 329 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 328 def remove_observer(observer) end |
#size ⇒ Integer
343 344 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 343 def size end |
#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”
359 360 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 359 def unique_name(base_name) end |