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 scriptThe 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
deactivateevent 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 endJust 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

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