Class: Sketchup::ExtensionsManager

Inherits:
Object
  • Object
show all
Includes:
Enumerable

Overview

The ExtensionsManager class provides a way of accessing the SketchupExtensions that have been registered via the Sketchup.register_extension method.

There is only one ExtensionsManager available. You access it via the Sketchup.extensions method.

Version:

  • SketchUp 8.0 M2

Instance Method Summary collapse

Instance Method Details

#[](index_or_name) ⇒ Object

The [] method is used to get an extension by name, index or ID.

Examples:

manager = Sketchup.extensions
extension = manager[0]
if (extension)
  UI.messagebox extension.name
else
  UI.messagebox "Failure"
end

# You can also get extensions by name.
solarnorth = manager['Solar North Toolbar']

# You can also get extensions by ID.
my_extension = manager['2475A758-6503-46D5-AC5E-16AEA0A3162A']

Returns extension - an SketchupExtension object if successful, otherwise nil.

Parameters:

  • index_or_name

    The index, name or ID of the SketchupExtension object.

Returns:

  • extension - an SketchupExtension object if successful, otherwise nil.

Version:

  • SketchUp 8.0 M2

#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 SketchupExtension objects if successful

Examples:

manager = Sketchup.extensions
number = manager.count

Returns:

  • integer - number of SketchupExtension objects if successful

See Also:

Version:

  • SketchUp 8.0 M2

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

The each method is used to iterate through extensions.

Examples:

manager = Sketchup.extensions
# Retrieves each extension
manager.each { |extension| UI.messagebox extension.name }

Yields:

  • (extension)

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

Returns:

  • nil

Version:

  • SketchUp 8.0 M2

#keysObject

The keys method is used to get a list of keys in the ExtensionsManager, which are the same as the names of the extensions.

Examples:

manager = Sketchup.extensions
keys = manager.keys
for key in keys
  UI.messagebox('The next extension is named: ' + key)
end

Returns:

  • keys - Array of string keys

Version:

  • SketchUp 8.0 M2

#lengthObject

The length method returns the number of SketchupExtension objects inside this ExtensionsManager.

The #size method is an alias for #length.

Examples:

manager = Sketchup.extensions
number = manager.length

Returns:

  • integer - number of SketchupExtension objects if successful

Version:

  • SketchUp 8.0 M2

#sizeObject

The length method returns the number of SketchupExtension objects inside this ExtensionsManager.

The #size method is an alias for #length.

Examples:

manager = Sketchup.extensions
number = manager.length

Returns:

  • integer - number of SketchupExtension objects if successful

Version:

  • SketchUp 8.0 M2