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