Is it possible to run a rhino script from a background thread? I am getting an error:

Attempted to read or write protected memory. 

I am working on plugin development in which c#  plugin has to process a .3dm file and at the end of it open this .3dm file.

The processing happens on a background thread.. And when the processing is complete it runs a script to open this file from this background thread.  

I have tried running very simple script such as _new and others which does not require any inputs on background thread. But all of them throw the same error. 

Thanks for your help.. 

Tags: C#, Multithreading, Script, Threading, plugin

Views: 140

Replies to This Discussion

Neither Rhino not RhinoScript is thread safe. If you try to access either Rhino or RhinoScript in another tread, you will most likely crash Rhino.

You can, though, perform non-Rhino calculations in worker threads. But when you access Rhino (e.g. SDK functions), then you need to make these calls from the main thread.

 -- Dale

RSS

Translate

© 2014   Created by McNeel Admin.

Badges  |  Report an Issue  |  Terms of Service