While this is more of AutoCAD Map question, but may also apply to other AutoCAD vertical products that many of us .NET API programming use.
Does any one know whther one can write some managed API code with Map functionality (defined in ManagedMapApi.dll), such accessing ObjectData, attaching/detaching drawings and run with AutoCAD console EXE (of course the computer has AutoCAD Map 2013, not a vanilla AutoCAD, or later installed)?
While I can spend some time to try it out, I thought someone may have already tried.
Maybe this idea might help you to get on track.
I had more or less the same problem: i needed some funtionality of a document management system in my AutoCAD program.
However that document management program may or may not be installed so i don't want to add references to these libraries.
My solution is building a separate class with this (managed) document management functionality and then dynamically load this when required.
You can also generate+compile+load this code while running you're program.
I finally found a bit time and tried, got the answer:
No, I cannot use Map ObjectARX API with AutoCAD console EXE.
1. I have AutoCAD Map 2015 installed.
2. I wrote a simple .NET Add-in DLL, which has a command defined to count block reference with give block name, and write the count to an external file.
3. I created a simple AutoCAD script, which do (a), NETLOAD the .NET DLL and (b) call the command defined in the .NET DLL
4. run accoreconsole.exe with a drawing file anme and the script file anme as arguments. The .NET command executed correctly and the block count was written into the external file.
5. In the command method, add a couple of lines of code to call API defined in Map ObjectARX API (getting MapApplication, which is the very basic step of doing Acad Map work).
6. Run accoreconsole.exe with the same arguments.
7. In the "DOS" window, I noticed there is error message showing before the "DOS" window closed down. Examine the external file, the block count was correctly written. That means, the code worked in the console until call to Map API.
In order to debug what error occurs when console app runs into Map API call, I used Windows.Forms.MessageBox in try...catch... block to hold the console app. Indeed, the message box pops up during console execution and only continue after the message box dismissed. The message box in the catch... clause let me know that it is the first line of code that call Map .NET API raised the exception and said the operaion is not valid. So, it looks like console app can only be used to do vanilla AutoCAD stuff.
I hope someone from ADN development support could confirm this.
You can not use MapApplication in accoreconsole.exe. infact you should not use AcadApplication in accoreconsole.exe. I will say refer http://adndevblog.typepad.com/autocad/2012/04/gett
Access a broad range of knowledge to help get the most out of your products and services.