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

Problem in retreiving the active layout during plotting

1 REPLY 1
Reply
Message 1 of 2
Anonymous
313 Views, 1 Reply

Problem in retreiving the active layout during plotting

Dear All:

 

This error happened to us, when we tried to get the active layout from the acad document. We are using AutoCAD 2009 & C#.NET 4.0 Framework.

The error is as below:

 

Unable to cast COM object of type 'Autodesk.AutoCAD.Interop.Common.AcadLayoutClass' to interface type 'Autodesk.AutoCAD.Interop.Common.IAcadLayout'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C6F55F5A-33AF-4B5F-9949-86C6AEEF1834}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

The piece of snippet looks like the following

 

using Autodesk.AutoCAD.Interop.Common;

 

AcadApplication acadApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application");

AcadDocument acadDoc = acadApp.ActiveDocument;

//The following line throws the error as stated above

AcadLayout aLayout = (AcadLayout)acadDoc.ActiveLayout;

 

But it can be accessed if we change the property " Embed Interop Types " of DLLs (a) Autodesk.AutoCAD.Interop

(b) Stdole

from True to False

 

But again it throws the same error when we try to retrieve any methods from the retrieved AcadLayout.

 

The whole application works fine with AutoCAD 2012 after re-referencing the DLLs.

 

Thank You!

Jagadeesh

1 REPLY 1
Message 2 of 2
Balaji_Ram
in reply to: Anonymous

Hi Jagadeesh,

 

AutoCAD 2009 requires the .Net framework to be set to 3.0.

Do you get the crash only when the .Net framework is set to 4.0 ? 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

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