Script and custom tool work together ?
-
Hi,
Is this possible ?- Start a script execution
- Pause the script and launch a custom tool (such as a "getpoint" tool for instance and return the clicked Point3D)
- Resume the main script and use the Point3D variable.
#start script #... point=Sketchup.active_model.select_tool MyGetPointTool.new #... # resume script
The problem is that if it is not possible, one has to encapsulate all the script in the tool itself.
Any hint someone
-
Pretty sure you can't pause it.
You don't have to encapsulate the entire script into the Tool class, just make the Tool's
deactivate
event trigger your main script again. -
Hi tt,
@unknownuser said:
make the Tool's deactivate event trigger your main script
Sorry, but how to do that ?
def deactivate() ???? end
-
yeah, exactly.
def deactivate my_script end
Just have it call your script again when it de-activates. You could even set up your script to accep arguments so you can send in the point3d.
Chris
-
Something like:
module MyModule def some_method # lalala Sketchup.active_model.tools.push( MyTool.new ) end def continue(args) # lalala end class MyTool # Collect data... def deactivate MyModule.continue(args) end end
-
Cool, thanks a million
Advertisement