I am attempting to rewrite a VBA program in VB.NET for AutoCAD Mechanical 2012, 64 bit, Windows 7 using Visual Studio 2010 Pro. The program extracts Mechanical BOM data and exports it to a formatted Excel Bill of Material. I have the following error that I cannot resolve:
Cannot embed interop type 'SymBBAuto.IAcadObjectEvents_Event' because the source interface 'Autodesk.AutoCAD.Interop.Common.IAcadObjectEvents
There is no Line or Column referenced in the error list. Clicking on the error does not expose the source or location of the error. I have referenced AutoCAD 2012 Type Library, Mechanical 1.0 Type Library, GeAuto 2.0 Type Library, SymBBAuto 3.0 Type Library, and AutoCAD.Interop.Common, all as COM types, and AcDbMgd, AcMgd, and AutoCAD.Interop as .NET types. I have declared SymBBAuto, Autodesk.AutoCAD.Interop, and Autodesk.AutoCAD.Interop.Common as Imports along with many other AutoCAD namespaces.
Any help would be greatly appreciated
Solved! Go to Solution.
Can you post the code where you are using the Interop.common library?
Otherwise... you might want to do some research of the Interop libraries and 64-bit issues.
I know when I was trying to run a program 32-bit vs 64-bit you have to be real careful how things are setup.
Obviously, your project is targeting .NET4.0, which automatically embeds interop assembly in the project if a COM reference is set, by default.
However, in the most cases of setting refernces to AutoCAD (and its vertical products') COM interops, embedding COM interop assemblies does not work. That is, you DO NOT embed the interop assemblies. You need to set the "Embed.." property to "False" in conjunction of "Copy Local" also being set to "False".
The one interop assembly that I found have to be embedded is the Sheetset COM interop assembly (AcSmComponents17/8), when working with Acad2012(I did not try with other versio of Acad).
Attached is some of the Code and the errors I am getting.
Dim symbb As McadSymbolBBMgr Dim bommgr As McadBOMMgr Dim stdmgr As McadStandardMgr Dim util As Autodesk.AutoCAD.Interop.AcadUtility symbb = oDoc.Application.GetInterfaceObject("SymBBAuto.Mca
dSymbolBBMgr") bommgr = symbb.BOMMgr stdmgr = symbb.StandardMgr util = oDoc.Utility Dim standard As McadStandardMgr standard = symbb.StandardMgr Dim BOMstd As McadBOMStandard Dim plistStd As McadPartListStandard standard = stdmgr.GetStandard("ANSI") BOMstd = standard.BOMStandard plistStd = BOMstd.PartListStandard Dim target As Autodesk.AutoCAD.Interop.Common.AcadBlock Dim BOM As McadBOM Dim name As String target = oDoc.ModelSpace If bommgr.BOMTableExists(target) Then BOM = bommgr.GetBOMTable(target, name) Else BOM = bommgr.AddBOMTable("WM", target) End If Dim plist As McadPartList plist = oDoc.PaperSpace.AddCustomObject("AcmPartList")
Thank you Norman,
In the project References I checked the Embed Interop Types property and it was set to True for both the SymBBAuto and GeAuto type libraries. I set these to False and the error cleared itself. Copy Local was already set to False.
From your screen shot it is obvious that you need to add a reference to AXDBLib. Under your References the first entry is blank with a notice that the system cannot find the reference specified. Is it possible that there had been a reference to AXDBLib but for some reason your project lost it. Remove the first entry. Then re-add the required reference.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.