123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::Tools

Relationships
Inherits: Object

Overview

The Tools class contains methods to manipulate a collection of SketchUp tools. You access this collection by calling the Model.tools method.

Examples:

tools = Sketchup.active_model.tools

Version:

  • SketchUp 6.0

Instance Method Summary

Instance Method Details

#active_toolObject?

The #active_tool method is used to obtain the active Ruby tool.

Examples:

tools = Sketchup.active_model.tools
tool = tools.active_tool

Returns:

  • (Object, nil)

    Returns the active Ruby tool, or ‘nil` otherwise.

Version:

  • SketchUp 2019

#active_tool_idObject

The active_tool_id method is used to retrieve the active tool’s id.

Examples:

tools = Sketchup.active_model.tools
id = tools.active_tool_id

Returns:

  • id - the active tool’s id.

Version:

  • SketchUp 6.0

#active_tool_nameObject

The active_tool_name method is used to retrieve the active tool’s name.

Examples:

tools = Sketchup.active_model.tools
if tools.active_tool_id.equal? 0
  puts "Tools collection is empty"
else
  name = tools.active_tool_name
end

Returns:

  • name = the active tool’s name.

Version:

  • SketchUp 6.0

#add_observer(observer) ⇒ Object

The add_observer method is used to add an observer to the current object.

Examples:

tools = Sketchup.active_model.tools
observer = Sketchup::ToolsObserver.new
status = tools.add_observer observer

Parameters:

  • observer

    An observer.

Returns:

  • status - true if successful, false if unsuccessful.

Version:

  • SketchUp 6.0

#modelObject

The model method is used to get the model associated with this tools object.

Examples:

tools = Sketchup.active_model.tools
model = tools.model

Returns:

  • model - the Model object associated with this tools collection.

Version:

  • SketchUp 6.0

#pop_toolObject

The pop_tool method is used to pop the last pushed tool on the tool stack.

Examples:

tools = Sketchup.active_model.tools
tool = tools.pop_tool

Returns:

  • the last pushed Tool object, if it is a Ruby tool. If a native tool is active, selects the default native tool and returns nil.

Version:

  • SketchUp 6.0

#push_tool(tool) ⇒ Object

The push_tool method is used to push (aka activate) a user-defined tool. See the Tool interface for details on creating your own SketchUp tool.

Examples:

tools = Sketchup.active_model.tools
status = tools.push_tool tool

Parameters:

  • tool

    A user.

Returns:

  • status - true if successful, false if unsuccessful.

Version:

  • SketchUp 6.0

#remove_observer(observer) ⇒ Object

The remove_observer method is used to remove an observer from the current object.

Examples:

tools = Sketchup.active_model.tools
observer = Sketchup::ToolsObserver.new
tools.add_observer observer
status = tools.remove_observer observer

Parameters:

  • observer

    An observer.

Returns:

  • true if successful, false if unsuccessful.

Version:

  • SketchUp 6.0