Unable to open AutoCAD 2010 from VB.NET 2020

Unable to open AutoCAD 2010 from VB.NET 2020

Anonymous
Not applicable
1,878 Views
4 Replies
Message 1 of 5

Unable to open AutoCAD 2010 from VB.NET 2020

Anonymous
Not applicable

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?

 

0 Likes
Accepted solutions (1)
1,879 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Sorry that title should read VB.NET 2010

0 Likes
Message 3 of 5

jeff
Collaborator
Collaborator

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

You can also find your answers @ TheSwamp
0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution

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.

0 Likes
Message 5 of 5

Anonymous
Not applicable

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.

0 Likes