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

Multithreaded app - no access to acad objects

9 REPLIES 9
Reply
Message 1 of 10
dahovey
333 Views, 9 Replies

Multithreaded app - no access to acad objects

I'm trying to use a multithreaded app and the second thread cannot access any other the autocad objects...such as the

imports acadapp = autodesk.autocad.applicationservices.autocad

it seems that the objects are not exposed to the second thread. Can anyone help me?

Thanks!
9 REPLIES 9
Message 2 of 10
dmarcotte4
in reply to: dahovey

I don’t think the API supports multiple threads, the stuff I tried failed miserably.
Message 3 of 10
dahovey
in reply to: dahovey

Well I was able to make it work. I just couldn't use my acadapp variable as shown below. I had list it out explicity. if that makes sense.

imports acadapp = autodesk.autocad.applicationservices.application
Message 4 of 10
GlennR
in reply to: dahovey

From Tips and Techniques in the ObjectARX documentation:

"ObjectARX Does Not Support Multi-Threaded Programming

If you spawn multiple threads in your application, make sure that no more than one of the threads at a time invokes anything in the ObjectARX system."
Message 5 of 10
dmarcotte4
in reply to: dahovey

Thanks for pointing that out Glenn
Daniel
Message 6 of 10
dahovey
in reply to: dahovey

Well thats not good...

Thanks for the help though...
Message 7 of 10
dgorsman
in reply to: dahovey

So, the implication is that other threads CAN be spawned, as long as they don't have anything to do with AutoCAD, is that correct?
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 8 of 10
GlennR
in reply to: dahovey

That's always been my understanding of the situation.
Message 9 of 10
amiltonf
in reply to: dahovey

I've had success with multiple threads accessing AutoCAD in the past but it was more work than it was worth and AFAIK you *can* use mutliple threads that access AutoCAD but, as the docs say, you have to make sure that they don't do it at the same.

Regards,
Andy F.
Message 10 of 10
dahovey
in reply to: dahovey

Interesting...With the plotting program I'm using wanted the actual plotting process and loops to be in a separate thread. While the dialog itself would have been accessing autocad but not at the same time as the plotting thread.

But because of using the autocad provided interface for the plotprogress dialog the benefit of multithreading in my app is really very little or nill.

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