1

I'm writing a BaseGeoprocessingTool with the ArcObjects API and I need to open an Mxd then change the current document by this opened document.

I managed to open the Mxd document:

IMapDocument mapDocument = new MapDocument();
mapDocument.open(filename, "");

And inside a geoprocessing tool, it's possible to get the current map or page layout by using gpUtilities.getMap() or gpUtilities.getActiveView().

But is it possible to get the current IApplication in order to set the current document?

Or is there another way to change the current document?

Else, I need to handle the current document, in order to change data frame settings, Maplex settings, print and export settings... not only layers.

I use ArcMap 10.2.

2

But is it possible to get the current IApplication in order to set the current document?

If you can't get a reference to the application object, may be you can instantiate a new AppRef object

IApplication baseApp = (IApplication)Activator.CreateInstance(Type.GetTypeFromProgID("esriFramework.AppRef"));

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000000nm000000

  • Thanks for your reply. Actually I use the Java SDK. So, I tried to instanciate 'IApplication application = new com.esri.arcgis.framework.AppRef();' and I get a 'AutomationException: 0x8000ffff - Catastrophic failure'. I also tried 'IApplication application = new com.esri.arcgis.arcmap.Application();' then I get a 'AutomationException: 0x80040154 - Class not registered'. Maybe, there are other things to do before, maybe it's not possible to create these objects in Java side. Does it works in .NET? – superrache Jun 11 '15 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.