.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Invoke command or function from other thread

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
malst
2048 Views, 5 Replies

Invoke command or function from other thread

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.

5 REPLIES 5
Message 2 of 6
caddzone
in reply to: malst

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.



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Message 3 of 6
malst
in reply to: caddzone

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.

Message 4 of 6
caddzone
in reply to: malst

I already said that you can't call Invoke() from another thread.

 

It can only be called from the document exection context.



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Message 5 of 6
malst
in reply to: malst

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.

Message 6 of 6
malst
in reply to: malst

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost