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_name
argument returns a string with the tool name, not the tool class itself. So doing.class
only returns theString
class. -
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_name
I'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
Advertisement