I'm having a couple of issues referencing some assemblies using IronPython so i can import the namespaces to read/edit a CAD file using the AutoCAD API.
I can add reference and import the Autodesk.AutoCAD.Interop assembly just fine, but for some reason I can't add the acdbmgd.dll, acmgd.dll, accoremgd.dll or the AecBaseMgd.dll.
It could have something to do with this post:
"AutoCAD does have an api. there are 4 assemblys. Two for in-process and two for COM.
inprocess : acdbmgd.dll acmgd.dll
COMInterop : Autodesk.Autocad.Interop.dll Autodesk.Autocad.Interop.Common.dll"
The Autodesk developers guide states:
Browse to the install directory for AutoCAD Civil 3D, and select the base libraries acdbmgd.dll, acmgd.dll, accoremgd.dll, AecBaseMgd.dll, and AeccDbMgd.dll. Note: These are the base AutoCAD and AutoCAD Civil 3D managed libraries. Your .NET assembly can use classes defined in additional libraries.
I'm guessing the inprocess is the issue? I just don't know why.
Here is my code:
The error: IOError: [Errno 127] A procedure imported by 'acdbmgd.dll' could not be loaded.
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
sys.path.append(r'C:\Program Files\Autodesk\AutoCAD 2016')
sys.path.append(r'C:\Program Files\Autodesk\AutoCAD 2016\C3D')
import clr
#Add standard AutoCAD References
clr.AddReferenceToFile('acdbmgd.dll')
clr.AddReferenceToFile('acmgd.dll')
clr.AddReferenceToFile('accoremgd.dll')
clr.AddReferenceToFile('AecBaseMgd.dll')
#Add Civil Reference
clr.AddReferenceToFile('AeccDbMgd.dll')
#AutoCad namespaces
import Autodesk.AutoCAD.Runtime
import Autodesk.AutoCAD.ApplicationServices
import Autodesk.AutoCAD.DatabaseServices
import Autodesk.AutoCAD.EditorInput
#Civil namespaces
import Autodesk.Civil
import Autodesk.Civil.ApplicationServices
EDIT:
Thanks to Hans Passant, just a version issue. Now another issue:
The standard Autocad files have imported, but trying to import the civil one (AeccDbMgd.dll) spits out this error:
IOError: [Errno 2] Could not load file or assembly 'AeccDbMgd.dll' or one of its dependencies. The specified module could not be found.
Thanks to everyone who read this! I appreciate your time.
Cheers,
TJ