Class: Sketchup::OptionsManager

Inherits:
Object
  • Object
show all
Includes:
Enumerable

Overview

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

Version:

  • SketchUp 6.0

Instance Method Summary # collapse

Instance Method Details

#[](index) ⇒ Object #[](name) ⇒ Object

The [] method is used to get an option provider by name or index.

For example, to get the UnitsOptions on the Model, you could use the command:

Examples:

Sketchup.active_model.options["UnitsOptions"]
model = Sketchup.active_model
manager = model.options
provider = manager[0]
if (provider)
  UI.messagebox provider.name
else
  UI.messagebox "Failure"
end

Overloads:

  • #[](index) ⇒ Object

    Returns optionprovider - an OptionsProvider object if successful, otherwise nil.

    Parameters:

    • index

      The index of the OptionsProvider object.

    Returns:

    • optionprovider - an OptionsProvider object if successful, otherwise nil.

  • #[](name) ⇒ Object

    Returns optionprovider - an OptionsProvider object if successful, otherwise nil.

    Parameters:

    • name

      The name of the OptionsProvider object.

    Returns:

    • optionprovider - an OptionsProvider object if successful, otherwise nil.

Version:

  • SketchUp 6.0

#countObject

Note:

Since SketchUp 2014 the count method is inherited from Ruby's Enumable mix-in module. Prior to that the #count method is an alias for #length.

Returns integer - number of OptionsProvider objects if successful.

Examples:

optionsmanager = Sketchup.active_model.options
number = manager.count

Returns:

  • integer - number of OptionsProvider objects if successful

See Also:

Version:

  • SketchUp 6.0

#each {|opsprovider| ... } ⇒ Object

The each method is used to iterate through options providers.

Examples:

model = Sketchup.active_model
manager = model.options
# Retrieves each provider
manager.each { |provider| UI.messagebox provider.name }

Yields:

  • (opsprovider)

    A variable that will hold each OptionsProvider object as they are found.

Returns:

  • nil

Version:

  • SketchUp 6.0

#keysObject

The keys method is used to get a list of keys in the OptionsManager.

Examples:

model = Sketchup.active_model
manager = model.options
optionproviderarray = manager.keys
if (optionproviderarray)
  UI.messagebox optionproviderarray
else
  UI.messagebox "Failure"
end

Returns:

  • keys - Array of string keys

Version:

  • SketchUp 6.0

#lengthInteger

The #length method is an alias of #size.

Examples:

optionsmanager = Sketchup.active_model.options
number = manager.length

Returns:

  • (Integer)

See Also:

Version:

  • SketchUp 2014

#sizeInteger

The #size method returns the number of Sketchup::OptionsProvider objects inside this Sketchup::OptionsManager.

Examples:

optionsmanager = Sketchup.active_model.options
number = manager.size

Returns:

  • (Integer)

See Also:

Version:

  • SketchUp 6.0