Plug-in/Script as a background task

Hello, I hope I’m on the right place hier!

My question is:

is it possible to run a Rhino-Plug-in (or may be a script) on program start and let it run in the background?
When exiting/closing the file, the plugin/script has to perform some actions.

Thank you

Vitali

Your plugin could run a background thread or even background process.

You’d probably want to let the main thread do the talking to Rhino and then use the idle event to sync up and do any display or data updates in Rhino:

RhinoApp.Idle event (rhino3d.com)

You can also let the main thread catch document close events and sync up with your other thread(s) at that time.

As Nathan mentioned yes, you can run your logic in another thread, and set a flag, so that when the idle event in rhino fires, it can act on the flag.

The IDLE event happens a LOT. So you shouldn’t do slow work in that event, unless you are quick about it. We use the IDLE event to check and see if we need to update our UI to match the current state of Rhino.

So when another Rhino Event fires that indicates we need to update (Such as Document Updates, File Updates, Layer Updates, etc.), we set a flag, rather than doing the work. Then in the IDLE event we act upon the flag, and reset the flag.

That way our plugin isn’t slowing Rhino down, it is only “updating” when Rhino is Idle.