I know that ObjectARX API not available from other threads except AutoCAD thread. But maybe I can invoke command or function from other thread to run command in AutoCAD thread?
And what is Application.Invoke() method? I can't find info about this method.
Thanks.
Solved! Go to Solution.
Solved by malst. Go to Solution.
Solved by caddzone. Go to Solution.
You can try calling the ActiveX SendCommand() method from the
other thread, and use it to invoke a CommandMethod you define,
that can do the work in the AutoCAD thread.
The Invoke() method invokes LISP functions, but only works from the
document context.
caddzone, thank you for the answer, but I don't understand, how Invoke() method of Application object can be used. Application object available from any thread, and I can use Alert() method from other thread, for example.
Please explain how I can use invoke() method. Maybe you can give a sample.
I already said that you can't call Invoke() from another thread.
It can only be called from the document exection context.
I've solved this problem by calling ActiveX SendCommand method from my background thread. But it's very odd solution - call AutoCAD by ActiveX from self!
I think it's important to implement invoking commands and methods from other threads in AutoCAD. maybe, not from Document.Editor, maybe from Application object, but multithreading is important now. It's useful in huge area - from parallel computing to AJAX-like interfaces.
Also I've found another solution. I can implement multithreading via windows form and it's Invoke() method. Form loads in autodesk thread, so I can access object model from form methods. Other threads call Invoke() method.