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

AcMapMap.GetCurrentMap() failing in AutoCAD 2012

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
andy.hinz
687 Views, 2 Replies

AcMapMap.GetCurrentMap() failing in AutoCAD 2012

I have a plugin I've written that works fine in AutoCAD Civil 3D 2011. But when I try to run the same plugin in AutOCAD Civil 3D 2012, I get an exception when using the AcMapMap.GetCurrentMap() function. 

 

Here is the unhelpful stack trace:

OSGeo.MapGuide.MgUnclassifiedException: Failed to retrieve message for "MgUnclassifiedException".
   at OSGeo.MapGuide.MapApiPINVOKE.SWIGExceptionHelper.ThrowCustomException(String className, IntPtr cptr)
   at OSGeo.MapGuide.MapApiPINVOKE.AcMapMap_GetCurrentMapInternal()
   at Autodesk.Gis.Map.Platform.AcMapMap.GetCurrentMap()

 

Does anyone know why this function will not work? I have tried building a separate project which references the 2012 OSGeo DLLs, and I still get the same exception.

 

Thanks,

-andy

2 REPLIES 2
Message 2 of 3

Hi Andy,

 

I would suggest you repost this question on Civil 3D forum with a small code sample. As you can see, this is a 'unclassified' exception, which usually can have some different reasons...such as not closed resources.

 

Regards,

Augusto Goncalves

Autodesk Developer Network

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 3

I figured out that some kind of initialization needs to take place before calling GetCurrentMap(). The initialization happens when showing the Task Pane with "mapwspace on ", or with "__MAPSTARTWSPACE". I've added code to run that command when AutoCAD starts and everything is working now.

 

 

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