class OptionsManager

Parent: Object | Class Index
Methods:[], count, each, keys, siz e |
Sample Code:optionsmanagertests.rb |

The OptionsManager class manages various kinds of OptionsProviders on a Model.

Instance Methods

[]
The [] method is used to get an option provider by name or index.
Syntax:
optionprovider = om[index] optionprovider = om[name]
Arguments:
index - the index of the OptionsProvider object name - the name of the OptionsProvider object
Return Value:
optionprovider - an OptionsProvider object if successful
Comments:
For example, to get the UnitsOptions on the Model, you could use the command: Sketchup.active_model.options["UnitsOptions"]
Example:
model = Sketchup.active_model manager = model.options provider = manager[0] if (provider) UI.messagebox provider else UI.messagebox "Failure" end

count
The count method is an alias for size.
Syntax:
number = optionsmanager.count
Arguments:
Return Value:
number - number of OptionsProvider objects if successful
Comments:
Example:
model = Sketchup.active_model manager = model.options # First provider is PageManager provider = manager[0] count = manager.count

each
The each method is used to iterate through options providers.
Syntax:
optionsmanager.each {| optionsprovider | ...}
Arguments:
optionsprovider- a variable that will hold each OptionsProvider object as they are found.
Return Value:
Comments:
Example:
model = Sketchup.active_model manager = model.options # Retrieves each provider manager.each { |provider| UI.messagebox provider.name }

keys
Syntax:
optionproviderarray = optionsmanager.keys
Arguments:
Return Value:
optionproviderarray - an Array of OptionsProvider objects
Comments:
Example:
model = Sketchup.active_model manager = model.options optionproviderarray = manager.keys if (optionproviderarray) UI.messagebox optionproviderarray else UI.messagebox "Failure" end

size
The size method is used to retrieve the number of options providers.
Syntax:
number = optionsmanager.size
Arguments:
Return Value:
number - number of OptionsProvider objects if successful
Comments:
Example:
model = Sketchup.active_model manager = model.options # First provider is PageManager provider = manager[0] size = manager.size