User Input Data in ArcObject C#.NET

922
1
03-08-2017 10:41 PM
JoeSh
by
New Contributor

I need to plot automated maps in ArcGIS.

The first, and better, method from my perspective is to create a standalone C#.NET application that will interact with the current instance of ArcGIS (//http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Automating_the_ArcGIS_Desktop_ap...). Customization (such as asking user to browse a csv file, etc.) would be easier with this method. But, I am not being able to access anything. It returns error in line
            ESRI.ArcGIS.Framework.IDocument doc = new ESRI.ArcGIS.ArcMapUI.MxDocumentClass();
I am guessing I might have to do something so that the program can access the current instance of the ArcGIS. It would be great if anyone can point me to the right direction.

Second option is to create add-in. However, it seems more troublesome to ask for user inputs.

Any help would be appreciated.

0 Kudos
1 Reply
ChrisKushnir
New Contributor III

1)  Your app isn't "interacting with the current instance of ArcGIS".  Creating a new MxDocumentClass instance triggers the creation of a new ArcMap application instance, it doesn't cause it to link to an already running instance.  Perhaps this is what you meant, just wanted to clarify.

2)  In theory you'd expect that starting an instance of ArcMap should trigger ArcMap to check out the appropriate license; however, you may need to check out the appropriate license in your app before you can use the API.  Worth trying.

3) If all you want to do is do automated plotting using one of the Export*Classes you may want to use the ArcEngine controls instead i.e. create a C# Form that hosts an ESRI.ArcGIS.Controls.AxPageLayoutControl.  You can create the form hidden and then use the page layout control to generate the export files.  Much lighter weight solution than starting and trying to automate ArcMap.