Hi Ed Jobe, thank you for the response.
Just as I thought I was understanding the possible ways of interacting with AutoCAD and how they are done, this has confused me slightly.
My understanding so far is:
- .NET API = Class Library (DLL)
Uses references (accoremgd.dll, acdbmgd.dll, acmgd.dll) for AutoCAD or (accoremgd.dll, acdbmgd.dll) for AcCoreConsole.
Drawing opens in host application (AutoCAD or AcCoreConsole), then NETLOAD the DLL and run a CommandMethod contained in the DLL.
A script/batch file/3rd party application can be used to trigger the above events (Open drawing, NETLOAD DLL, run CommandMethod).
vb.Net
Code:
Dim doc As Document = [Core.]Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
- COM = VBA or .Net Application
Uses reference to AutoCAD 20** Type Library (acax23enu.tlb) for VBA or (Interop.AutoCAD.dll) for .Net Application.
3rd party app (Excel or .Net Application) programmatically opens/accesses the drawing file and runs operations direct from the 3rd party app. (e.g. draw a line, populate attribute, print to PDF)
This method sees the AutoCAD application visibly open when the 3rd party app opens a drawing to interact with it.
VBA
Code:
Set ACAD = CreateObject("autocad.Application")
Set NewFile = ACAD.Documents.Open("C:\Users\user\Desktop\A3.dwg", False)
vb.Net
Code:
Dim acadApp As AutoCAD.AcadApplication = CreateObject("AutoCAD.Application")
Dim acDoc = acadApp.Documents.Open("C:\Users\user\Desktop\A3.dwg", False)
Please let me know if the above is wrong, because I'm still getting to grips with it all.
In your post you say
You can use the COM api (reference by the Interop dll) to open documents as a "side database", that is, without the gui.
From my above understanding "COM api (reference by the Interop dll)" refers to my second bullet point, which as I state visibly opens the drawing. How is this possible to use as you say "without the gui"?
You then continue to say "Since it doesn't have a gui or command line, you can only run it with a script. However, the script can load a NET dll and call commands from that". So to me that is no longer a COM solution, it's actually my first bullet point a .NET API solution.
Please can you confirm my understandings or explain a bit further please.
Thank you.