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

MultiThread App causes AutoCAD Crash

4 REPLIES 4
Reply
Message 1 of 5
alberto_manero_geograma
628 Views, 4 Replies

MultiThread App causes AutoCAD Crash

Hello,

I'm developng an app in VB.NET that has to get many images from an WMS server and insert them into the active drawing, but it's an slow operation, so I want to open one execution thread for each image.

Doing this, My AutoCAD crashes when one of the threads tryes to get the active document.

Has anyone have had such a problem?

Any help will be wellcome!
Luis Alberto Manero, Geograma.com
4 REPLIES 4
Message 2 of 5

While you can spin off threads for other tasks, anything from AutoCAD (i.e. getting the active Document object) must be in the same thread.

----------------------------------
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 3 of 5
Anonymous

You can't access the AutoCAD API from threads spawned
by your own code. How to go about doing this depends on
whether your application is blocking or not. E.g., are you
requiring the user to wait until the data has been downloaded?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message
news:6283298@discussion.autodesk.com...
Hello,

I'm developng an app in VB.NET that has to get many images from an WMS
server and insert them into the active drawing, but it's an slow operation,
so I want to open one execution thread for each image.

Doing this, My AutoCAD crashes when one of the threads tryes to get the
active document.

Has anyone have had such a problem?

Any help will be wellcome!
Message 4 of 5

Hello,

I worked hard and finally solved the problem by launching requests in Async mode and calling one method once the request is made. This way it works perfectly without requiring the user to wait.

But now I have another little problem:
My app can make zooms to some coordinates (to view municipalityes for example) while requests are made, this works great when I execute my app in debug mode, but when I load my DLL AutoCAD crashes.

Surelly It's a problem with document locks so I'm working on it, but any ideas will be wellcome
Luis Alberto Manero, Geograma.com
Message 5 of 5

I reviewed my code an I found that the problem occurs when document events are used. When I click on any button of my palette I get the TreadID "3", but when an document event is captured, I get the ThreadID "5", so, it is another thread...

When I run the same code in debug mode, I allways get the same ThreadID ("3")...

So, my question is: Is there a way to force my application to be single thread?

Any help please?
Luis Alberto Manero, Geograma.com

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