.NET

Reply
Active Member
DieterDorin
Posts: 6
Registered: ‎11-02-2011
Message 1 of 5 (748 Views)
Accepted Solution

Unable to open AutoCAD 2010 from VB.NET 2020

748 Views, 4 Replies
11-02-2011 10:49 AM

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?

 

Active Member
DieterDorin
Posts: 6
Registered: ‎11-02-2011
Message 2 of 5 (743 Views)

Re: Unable to open AutoCAD 2010 from VB.NET 2010

11-02-2011 10:51 AM in reply to: DieterDorin

Sorry that title should read VB.NET 2010

Valued Mentor
jeff
Posts: 322
Registered: ‎05-12-2009
Message 3 of 5 (738 Views)

Re: Unable to open AutoCAD 2010 from VB.NET 2010

11-02-2011 11:27 AM 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
Active Member
DieterDorin
Posts: 6
Registered: ‎11-02-2011
Message 4 of 5 (672 Views)

Re: Unable to open AutoCAD 2010 from VB.NET 2010

11-06-2011 11:01 AM 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.

Active Member
DieterDorin
Posts: 6
Registered: ‎11-02-2011
Message 5 of 5 (666 Views)

Re: Unable to open AutoCAD 2010 from VB.NET 2010

11-06-2011 11:13 AM 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community