AXDB type library
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am having issues loading a type library for AxDB. Not sure about the capitalization.
My motivation for doing this is to access some numeric bom values that are too clunky to handle with vlax.
I already finished off the problem of inserting numeric bom values with autohotkey, but the time to run is several minutes for a simple drawing, which is not really good enough.
Meanwhile, back at the .NET app, I also struggled to load SymBBAuto, but managed to pull it off like this:
#+name: prepare-symbbauto
#+begin_src shell :results output :eval never-export :exports both
/c/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v10.0A/bin/NETFX\ 4.8.1\ Tools/TlbImp.exe \
/out:P:\\PersonalData\\AcmBomNum\\bin\\Debug\\net4.8.1\\SymBBAutoENU.dll /namespace:SymBBAuto /machine:Agnostic \
C:\\Program\ Files\\Autodesk\\AutoCAD\ 2023\\Acadm\\symbbautoenu.dll 2>&1
#+end_src
#+RESULTS: prepare-symbbauto
: Microsoft (R) .NET Framework Type Library to Assembly Converter 4.8.9037.0^M
: Copyright (C) Microsoft Corporation. All rights reserved.^M
: ^M
: TlbImp : Type library imported to P:\PersonalData\AcmBomNum\bin\Debug\net4.8.1\SymBBAutoENU.dll^M
Uh yes, sorry about the org stuff. However, I was not as successful with axdb:
#+name: prepare-axdb
#+begin_src shell :results output :eval never-export :exports both
/c/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v10.0A/bin/NETFX\ 4.8.1\ Tools/TlbImp.exe \
/productversion:1.0.0 /machine:Agnostic /out:P:\\PersonalData\\AcmBomNum\\bin\\Debug\\net4.8.1\\AxDb.dll \
/c/Users/myusername/ObjectARX/ObjectARX_for_AutoCAD_2023_Win_64bit_dlm/inc-x64/acax24ENU.tlb 2>&1
#+end_src
#+RESULTS: prepare-axdb
: Microsoft (R) .NET Framework Type Library to Assembly Converter 4.8.9037.0
: Copyright (C) Microsoft Corporation. All rights reserved.
:
: TlbImp : warning TI3019 : Interface 'IAcadShadowDisplay' is marked as [dual], but does not derive from IDispatch. It will be converted as an IUnknown-derived interface.
: TlbImp : Type library imported to P:\PersonalData\AcmBomNum\bin\Debug\net4.8.1\AxDb.dll
I also naïvely tried the one in the program files dir:
#+name: prepare-this-axdb
#+begin_src shell :results output verbatim :eval never-export :exports both
/c/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v10.0A/bin/NETFX\ 4.8.1\ Tools/TlbImp.exe \
/c/Program\ Files/Autodesk/AutoCAD\ 2023/axdb.dll 2>&1
echo
#+end_src
#+RESULTS: prepare-this-axdb
: Microsoft (R) .NET Framework Type Library to Assembly Converter 4.8.9037.0
: Copyright (C) Microsoft Corporation. All rights reserved.
:
: TlbImp : error TI1002 : The input file 'C:\Program Files\Autodesk\AutoCAD 2023\axdb.dll' is not a valid type library.
:
Now, I am probably doing at least 300 things wrong at once, but if I can wrap my head around how to make this ObjectARX stuff compatible with .NET, or figure some other way of getting the required type info, I'll be on my way to chip away at the remaining 299 things. Right now it compiles, but fails at runtime, when trying to load axdb.dll:
Application does not support just-in-time (JIT)
debugging. See the end of this message for details.
************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'AxDb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'AxDb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at AutoCAD_Mechanical_BOM.NumericBOM.Main()
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
=== Pre-bind state information ===
LOG: DisplayName = AxDb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/Autodesk/AutoCAD 2023/
LOG: Initial PrivatePath = NULL
Calling assembly : AcmBomNum, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Program Files\Autodesk\AutoCAD 2023\acad.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files/Autodesk/AutoCAD 2023/AxDb.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Autodesk/AutoCAD 2023/AxDb/AxDb.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Autodesk/AutoCAD 2023/AxDb.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Autodesk/AutoCAD 2023/AxDb/AxDb.EXE.
LOG: Attempting download of new URL file://our.domain/nodfsroot$/USERS/myusername/PersonalData/AcmBomNum/obj/Debug/net4.8.1/AxDb.DLL.
LOG: Attempting download of new URL file://our.domain/nodfsroot$/USERS/myusername/PersonalData/AcmBomNum/obj/Debug/net4.8.1/AxDb/AxDb.DLL.
LOG: Attempting download of new URL file://our.domain/nodfsroot$/USERS/myusername/PersonalData/AcmBomNum/obj/Debug/net4.8.1/AxDb.EXE.
LOG: Attempting download of new URL file://our.domain/nodfsroot$/USERS/myusername/PersonalData/AcmBomNum/obj/Debug/net4.8.1/AxDb/AxDb.EXE.
It's looking where the axdb.dll file is, but it is not the right kind of library:
myusername at myworkstation MSYS ~
$ file /p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/*.dll
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AcCoreMgd.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AcCui.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AcDbMgd.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AcDx.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AcMgd.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AcTcMgd.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AcmBomNum.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AdUIMgd.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AdUiPalettes.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AdWindows.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/Autodesk.AutoCAD.Interop.Common.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/Autodesk.AutoCAD.Interop.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/AxDb.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/SymBBAutoENU.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/System.Runtime.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
/p/PersonalData/AcmBomNum/bin/Debug/net4.8.1/acdbmgdbrep.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections
myusername at myworkstation MSYS ~
$ file /c/Program\ Files/Autodesk/AutoCAD\ 2023/axdb.dll
/c/Program Files/Autodesk/AutoCAD 2023/axdb.dll: PE32+ executable (DLL) (GUI) x86-64, for MS Windows, 6 sections
Any idea how to get some traction here?
I already loaded a bunch of ObjectARX dlls, so aside from this one obstacle, I seem to be getting close.
Here is what I reckon fails at runtime:
var cadApp = new AxDb.AcadApplication(); // for ObjectDBX
cadApp.Visible = true;
var cadDoc = cadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.24");