class AttributeDictionaries

Parent: Object | Class Index
Methods: [], delete, each |
Sample Code: attrdicttests.rb |

The AttributeDictionaries class is a container class for a collection of AttributeDictionary objects.

Instance Methods

[]
The [] method is used to retrieve the AttributeDictonary object with a provided name.
Syntax:
attributedictionary = attributedictionaries["attributedictionaryname"]
Arguments:
“attributedictionaryname” – the name of an existing attribute dictionary
Return Value:
attributedictionary – an attribute dictionary object if successful, nil if unsuccessful
Comments:
This method also throws an exception when a dictionary of the provided name is not found.
Example:
model = Sketchup.active_model attrdicts = model.attribute_dictionaries begin attrdict = attrdicts[“testdictionary”] rescue UI.messagebox $!.message end if (attrdict) # code if an attribute dictionary is returned end

delete
The delete method is used to delete an attribute dictionary.
Syntax:
status = attrributedictionaries(attributedictionary | “attributedictionaryname”)
Arguments:
attributedictionary or “attributedictionaryname” – an attribute dictionary object or the name of an attribute dictionary to delete
Return Value:
status – a reference to an attribute dictionary if successful
Comments:
Throws an exception if unsuccessful or returns nil.
Example:
model = Sketchup.active_model attrdicts = model.attribute_dictionaries attrdict = attrdicts[“testdictionary”] begin status = attrdicts.delete(attrdict) rescue UI.messagebox $!.message end if (status) # code if an attribute dictionary is returned end

each
The each method is used to iterate through all of the AttributeDictionary objects in the AttributeDictionaries object.
Syntax:
attributedictionaries.each { | attributedictionary | … }
Arguments:
attributedictionary – a variable that will hold each attribute dictionary object as they are found if successful
Return Value:
Comments:
Throws an exception if there are no attribute dictionaries.
Example:
dictionaries = model.attribute_dictionaries # iterates through all attribute dictionaries and prints the size (number of attributes) to the screen dictionaries.each { | attributedictionary | UI.messagebox attributedictionary.size }