SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

Extension class

The Extension class contains methods allowing you to create and manipulate SketchUp extensions. Extensions are Ruby scripts that can be loaded and unloaded using the Extension manager (Extensions panel of the Preferences dialog box). Generally you should register your ruby scripts as an extension to give SketchUp users the ability to disable it through the user interface.

Parent: Object

Methods:new ,copyright, copyright=, creator, creator=, description, description=, load, name, name=, version, version=

Example Code:utilities.rb

Class Methods


new

The new method is used to create a new SketchupExtension class.

Syntax

 sketchupextension = SketchupExtension.new "Title" "path"

Arguments

"Title" - the title for the new extension that will appear in the Extensions portion of the Preferences dialog box.

"path" - the relative path to the extension.

Return Value

sketchupextennsion - the new SketchupExtension object

Example

extension = SketchupExtension.new "Stair Tools" "utilities/stairTools.rb"

Instance Methods


copyright 

The copyright method is used to get the value for the copyright of an extension.

Syntax

copyright = sketchupextension.copyright

Return Value

copyright - a string representing the copyright of the extension.

Comments

The default copyright string is "2005, @Last Software." Change the copyright using the copyright= method if the copyright of the extension is other than 2005, @Last Software.

Example

copyright = se.copyright


copyright= 

The copyright= method is used to set the value for the copyright of an extension.

Syntax

copyright = sketchupextension.copyright = "Copyright"

Arguments

Copyright - a string representing the copyright of the extension.

Return Value

copyright - a string representing the copyright of the extension.

Example

utilitiesExtension.copyright=$uStrings.GetString("2004-2005 Joe Software")


creator  

The creator method is used to get the value for the creator of an extension.

Syntax

creator = sketchupextension.creator

Return Value

creator - a string representing the creator of the extension.

Comments

The default creator string is "@Last Software." Change the creator using the creator= method if the creator of the extension is other than @Last Software.

Example

creator = se.creator


creator= 

The creator= method is used to set the value for the creator of an extension.

Syntax

creator = sketchupextension.creator= "CreatorName"

Arguments

"CreatorName" - a string representing the name of the extension's creator

Return Value

creator - a string representing the creator of the extension.

Comments

The default creator string is "@Last Software." Change the creator using the creator= method if the creator of the extension is other than @Last Software.

Example

utilitiesExtension.creator=$uStrings.GetString("Fred Smith")


description 

The description method is used to get the value for the description of an extension.

Syntax

description = sketchupextension.description

Return Value

description - a string representing the description of the extension.

Example

description = se.description


description= 

The description= method is used to set the value for the description of an extension.

Syntax

description = sketchupextension.description = "Description"

Arguments

Description - a string representing the description of the extension.

Return Value

description - a string representing the description of the extension.

Example

utilitiesExtension.description=$uStrings.GetString("Adds Tools->Utilities to the SketchUp inteface.  The Utilities submenu contains two tools: Create Face and Query Tool.")


load 

The load method is used to load an extension from the Ruby extension manager.

Syntax

Extension.load

Comments

You will generally not call this method from a Ruby script. This method exists primarily to be called when an extension is turned on using the SketchUp extension manager.


name

The name method is used to get the value for the name of an extension.

Syntax

name= sketchupextension.name

Return Value

name - a string representing the name of the extension.

Example

name = se.name


name= 

The name= method is used to set the value for the name of an extension.

Syntax

name= sketchupextension.name= "Name"

Arguments

Name - a string representing the name of the extension.

Return Value

name - a string representing the name of the extension.

Example

utilitiesExtension.name=$uStrings.GetString("Stair Tool")


version 

The version method is used to get the value for the name of an version.

Syntax

version= sketchupextension.version

Return Value: 

version - a string representing the name of the version

Comments

The default version string is "1.0" Change the creator using the version= method if the version of the extension is other than 1.0.

Example

version = se.version


version= 

The version= method is used to set the value for the version of an extension.

Syntax

version = sketchupextension.version= "Version"

Arguments

Version - a string representing the version of the extension.

Return Value

version - a string representing the version of the extension.

Example

utilitiesExtension.version=$uStrings.GetString("1.0")

 

SketchUp  Ruby API Reference: Extension

© Google Inc. 2007 sketchup.google.com