Activate native tool from Ruby Api?

Is it possible to activate native tools from the Ruby API? as an example, should I enable the Move Tool?

Yes, but the web edition does not have the Ruby API.

Sketchup.send_action("selectMoveTool:")

See:

ok, thank you.

Question - in the latest SketchUp 2026.2 you will get this message:

warning: Sketchup.send_action is deprecated and not being maintained. If you are relying on this method, please log a request in our Issue Tracker.

Whats should the correct method be from now on if you have plugins that use this action to activate actions like this?

Sketchup.send_action(“selectOffsetTool:”)
Sketchup.send_action(“selectScaleTool:”)
Sketchup.send_action(“selectRectangleTool:”)
Sketchup.send_action(“selectMeasureTool:”)

They don’t offer an alternative solution. Follow the instructions in the warning. They might suggest something there. :innocent:

Edit:
BTW, they must have some plan, because for example, their own basic extension - Dynamic Components - also gives the deprecated warning. So, either they didn’t think about it, or they don’t deal with it… perhaps just because it’s deprecated, it might still work, “just” generate this warning message. :wink:

Here is the latest topic about it on the Issue Tracker
Deprecated send_action · Issue #1101 · SketchUp/api-issue-tracker

It seems obvious to me that the Sketchup::Tools class is the place to implement a setter method specifically for activating tools. (There are other non-tool commands that can be implemented elsewhere in other API classes or modules.)

Perhaps:

  • Sketchup::Tools#activate_tool( [Integer or Symbol] )
  • Sketchup::Tools#active_tool=( [Sketchup::Tool] )

* The Sketchup::Model#select_tool method could be a wrapper to these new methods so that the code is maintained in one place.

The method argument could be either a tool id (any one of the top-level CMD_ integer id constants) or a symbol like :ScaleTool , :OffsetTool, etc., (we don’t need the “select” prefix as it’s redundant.)

I prefer the first paradigm (without the “=”) when the argument is not the actual object. In this case the argument would be a symbol name or integer id, which is not an actual tool object. (Note that native tools are not Ruby Sketchup::Tool objects.)

Instance setter methods would act upon the model that the tools collection belongs to. It would be up to the API Team whether it is a no-op when the model is not active, or whether any Sketchup::ToolsObservers are delayed in firing until that model becomes the active model.


@CraigTrickett @tt_su @ene_su @ChrisFullmer @bugra

I don’t think that there is any reason to delay implementing native tool setters.