OnActiveToolChanged - What RubyTool is it?
-
I noticed that onActiveToolChanged returns "RubyTool" as the toolname whenever a ruby scripted tool is used. I had expected it to be the classname of the tool which was returned.
Any way to identify which ruby tool is being used? -
Does it respond to
.class? -
The
tool_nameargument returns a string with the tool name, not the tool class itself. So doing.classonly returns theStringclass. -
I think some of the built in tools, like the line tool, return a more specific name. But a lot of them are generic. I suspect that Ruby Tool is a default name that tools can override but seldom do (though I do see any method for that in the API).
-
Yea, I can differ from the built-in tools. But with the large flora of great plugin tools it'd be nice to be able to detect these as well.
-
Whenever I want the name of the active tool, I use:
Sketchup.active_model.tools.active_tool_nameI've never had "RubyTool" returned as a tool name. Does that work for you?
-
I was mistaken. Custom tools are always "RubyTool", no matter what you do. Yes, that's very strange.
-
You can identify active tool by its ID. Each tool has its own ID. You can't know its name. Try a look here, I played with tool IDs...

-
@matt666 said:
You can identify active tool by its ID. Each tool has its own ID. You can't know its name. Try a look here, I played with tool IDs...

But is the id the same across sessions and computers? From my other thread on IDs; the ID of even the native tools might not be consistent. So I have4 mu doubts that ruby tools will have consistent IDs
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement