Push_tool
-
Hello,
I'm trying to temporarily switch to SU native selection tool on a key depress, do my seleections and return back to my tool on key release. From searching around, it looks like
push_tool and pop_tool might do the trick.
Dan Rathbun mentions here
that the parameter is a UI::Tool class object. Is there a way to get this value for the native selection tool?Thanks,
Arun -
Afraid not, pop_tool and push_tool is for Ruby tools only.
Maybe you can use the ToolsObserver or the SelectionObserver to reactivate your own tool?Btw, why do you need to temporarily switch to the native selection tool?
-
The SelectionTool is not an "interruptor" type tool (like the various Zoom, Orbit and Pan tools.)
You can program single item select into your tool using
Sketchup::PickHelper
class.What many people do is have a custom tool command appear on the right-click context menu, but only if they are items in the selection set. Ie:
unless Sketchup::active_model.selection.empty?
-
By the way,... you can activate the SelectionTool two ways:
model = Sketchup.active_model model.select_tool(nil)
or...
Sketchup.send_action("selectSelectionTool:")
-
Thanks guys. Yes, I was doing a pickhelper or ray intersection and figuring out the object being clicked on and added it to the global selection. That worked fine, but only allowed selecting one entity at a time. I wanted to switch to select tool so I can use the group selection features that are available in it. Like thomthom suggested, I managed to get that working by backing up the current tool before doing Sketchup.send_action("selectSelectionTool:") and then restoring the older tool on release. This probably won't retain the tool state since I'm actually exiting the tool and re-entering, but it seems to work for my purpose.
Thanks again!
Advertisement