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.
-
#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(*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 |
#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 Importer Options file for information on creating a valid hash for the various importers.
For SketchUp models, instead use #load.
180 181 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 180 def import(path, = {}) end |
#length ⇒ Integer
The #length method is used to retrieve number of component definitions in the list.
196 197 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 196 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.
244 245 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 244 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?
-
onPercentChange(percent)
-
onSuccess()
-
onFailure(message_string)
345 346 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 345 def load_from_url(*args) end |
#purge_unused ⇒ Sketchup::DefinitionList
The purge_unused method is used to remove the unused component definitions.
357 358 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 357 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.
375 376 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 375 def remove(definition) end |
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
391 392 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 391 def remove_observer(observer) end |
#size ⇒ Integer
406 407 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 406 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”
422 423 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb', line 422 def unique_name(base_name) end |