How to run scripts synchronized?

rhinocommon

#1

How do i run a script synchronized if i’m outside a rhino script command? i know i can declare a script as script runner and every script called inside it will be sync but what if i’m outside a script command?


(Menno Deij - van Rijswijk) #2

What do you mean by synchronized? I’m not sure I understand the term in this context.


#3

like using Invoke(). When you call RhinoApp.RunScript() it runs asynchronous (like using beginInvoke()) but i want it to be synchronous.

The only way i know to do that is to run scripts inside a script declared as script runner, and every script that runs inside it will be synchronous but if i’m outside a RunCommand i can’t find a way to run them synchronous.


(Dale Fugier) #4

HI Matteo,

Rhino is not a multi-threaded application. Thus, command scripts, run with RhinoApp.RunScript() should be run asynchronously.

– Dale


#5

Hi Dale,
I do know it… so let’s ask the same thing in a different way. How do i know if a script is completely executed?


(Dale Fugier) #6

When called from a script running command, RhinoApp.RunScript() won’t return until the command has finished.

You can also watch for the Command.BeginCommand and Command.EndCommand events if need.


-_Insert command never triggers Command.EndCommand?
#7

This is what i did. I was hoping on something else. Thank you.