Can you call a Geoprocessing tool within a Pro SDK Console App (standalone)?

1354
1
12-12-2017 01:57 PM
GregBunce1
New Contributor

Does anyone know if I can run/call a geoprocessing tool from within a Pro SDK Console App env (using ArcGIS.CoreHost)?  The API docs lead me to think you need to be within the Add-In (Desktop UI) environment to do so.  Currently, I'm calling a python script, from within .net, that executes the gp tool and it works fine - but I'm wondering if there's a way of doing this within the .net managed pro sdk env.  

0 Kudos
1 Reply
GregBunce1
New Contributor

If you're looking for a workaround to this issue, below is some sample code of how I'm calling a python script (which executes a gp tool) from within the pro sdk.  The .net calling code is synchronous so the app waits until the python script finishes before it moves on.

  • I have a class called ExecuteArcpyScripts.cs that runs the python script.
  • Then, to execute this (and run the arcpy script) you would just call the class and pass in the script location/file name as well the parameters that the gp tool needs.  It would look something like this: commands.ExecuteArcpyScript.run_arcpy(pythonFile, gp_params);
0 Kudos