.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoCAD console EXE with managed map API

6 REPLIES 6
Reply
Message 1 of 7
norman.yuan
1046 Views, 6 Replies

AutoCAD console EXE with managed map API

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.

Norman Yuan

Drive CAD With Code

EESignature

6 REPLIES 6
Message 2 of 7
SENL1362
in reply to: norman.yuan

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. 

 

 

Message 3 of 7
norman.yuan
in reply to: norman.yuan

I finally found a bit time and tried, got the answer:

 

No, I cannot use Map ObjectARX API with AutoCAD console EXE.

 

More details:

 

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.

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 4 of 7

Hi 

 

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/getting-started-with-accoreconsole.html .



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

Message 5 of 7

Thank you for confirming this.

Norman Yuan

Drive CAD With Code

EESignature

Message 6 of 7
fieldguy
in reply to: norman.yuan

@norman.yuan

Do you know if there has been any change since 2014?  I would like to use the core console to assign a projection to a batch of files if possible (Autodesk.Gis.Map.Project.ProjectModel).

 

Thanks!

Message 7 of 7
norman.yuan
in reply to: norman.yuan

AFAIK, local core console, it seems, still does not support Map/C3D features. Autodesk has been saying its Forge Design Automation would support C3D (hence also Map) for quite a while, but I still have not verified that (been using Forge Design Automation with AutoCAD only for a few apps, but never Map/C3D).

Norman Yuan

Drive CAD With Code

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost