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) ⇒ SketchupExtension?

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

Examples:

manager = Sketchup.extensions
extension = manager[1]
if (extension)
  puts extension.name
else
  puts "No Extensions installed"
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']
Note:

Index starts at 1.

Parameters:

  • index_or_name (Integer, String)

    The index, name or ID of the SketchupExtension object.

Returns:

Version:

  • SketchUp 8.0 M2

#countInteger

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.

Examples:

manager = Sketchup.extensions
number = manager.count

Returns:

  • (Integer)

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| puts 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

#lengthInteger

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

Examples:

manager = Sketchup.extensions
number = manager.length

Returns:

  • (Integer)

See Also:

Version:

  • SketchUp 8.0 M2

#sizeInteger

The #size method is an alias of #length.

Examples:

manager = Sketchup.extensions
number = manager.size

Returns:

  • (Integer)

See Also:

Version:

  • SketchUp 8.0 M2