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

Unable to open AutoCAD 2010 from VB.NET 2020

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
DieterDorin
1257 Views, 4 Replies

Unable to open AutoCAD 2010 from VB.NET 2020

I have a piece of code  that opens and controls AutoCAD from VB.NET. It was working fine with AutoCAD 2008 and VB.NET 2003 or 2008 on XP. I have since upgraded to Wndows 7 (32 bit), VS 2010, and AutoCAD 2010.

I have downloaded and installed the ObjectARX 2010 sdk.

I have referenced the

Autodesk.AutoCAD.Interop.Common.dll and

AutoDesk.AutoCAD.Interop.dll

from C:\ObjectARX 2010\inc-win32 in my project.

Copy Local for these 2 references is set to True. If I set it to False and try start debugging, it can't find them.

The code I used with AutoCAD 2008 to open a new instance of the application was:

PublicShared oAcad As AutoCAD.AcadApplication

oAcad = New AutoCAD.AcadApplication

This generates the error:

Retrieving the COM class factory for component with CLSID {6D7AE628-FF41-4CD3-91DD-34825BB1A251} failed due to the following error: 80040154

 

I have also tried the GetObject (with AutoCAD already open) and CreateObject(with AutoCAD not open) methods of invoking AutoCAD as follows:

 

oAcad = GetObject(, "AutoCAD.Application.18")

oAcad = CreateObject("AutoCAD.Application.18")

 

These methods generate the error:

Cannot create ActiveX component

I think there is something basic I am doing wrong or is not installed correctly, Anyone know what it is?

 

4 REPLIES 4
Message 2 of 5
DieterDorin
in reply to: DieterDorin

Sorry that title should read VB.NET 2010

Message 3 of 5
jeff
in reply to: DieterDorin

For VB with 2010 I think you have to set Embed Interops Types to false also.

You can also find your answers @ TheSwamp
Message 4 of 5
DieterDorin
in reply to: jeff

This turned out to be a problem with the AutoCAD 2010 installation. It was not packaged correctly for distribution as a Virtual Application. Once I reinstalled locally with the setup from AutoDesk the application's COM components got propertly registered and the interop assemblies could invoke them.

 

Now I have a different problem where I get the same errorabout 60% of the time. AutoCAD loads, but often is too slow and results in the same error anyway. Obviiously there is a timeout period which is too quick for AutoCAD to load and register as an ActiveX component.

Message 5 of 5
DieterDorin
in reply to: DieterDorin

I will close this thread an open a new one for the problem of getting an error of

Cannot create ActiveX Component

before AutoCAD has finished loading when it is slow to load.

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