How to call an ArcGIS Pro SDK (C#) Add-in project from Python ?

481
4
09-07-2018 09:09 AM
FabianOrtega
New Contributor

Hi ! I created an Add-in project using the ArcGIS Pro SDK for .NET (C#) and now I'm trying to call the Add-in methods from my Python scripts using ArcPy but I didn't find neither documentation nor examples how to achieve this, I've tried some things however it didn't work and now I'm stuck... So I'm wondering if someone knows or has any ideas how to do this ?

Thank you.

Reply
0 Kudos
4 Replies
CharlieGorman
New Contributor II

What type of functionality is in your C# code that you would like to call from Python?

A more typical code pattern would be to have C# code call Python using the Geoprocessing API as demonstrated in this sample:

Github Esri/arcgis-pro-sdk-community-samples: CallScriptFromNet 

Reply
0 Kudos
FabianOrtega
New Contributor

Hi Charlie!

 

Actually all our production line is based on ArcPy scripts, however we’re using ArcGIS Pro SDK for .Net (C#) for one specific functionality that can’t be done with ArcPy: export the annotations baselines (the polylines not the bounding box polygons) into a new Feature Class, that’s why we need to call C# code from Python.

 

So the functionalities that have been implemented in C# are:

  1. Retrieve the annotations baselines and the attributs from a given Annotation Layer
  2. Create a new Feature Class
  3. Insert the annotations baselines and the attributs into the new Feature Class

 

Would you have any idea how we could accomplish this?

 

Thank you for your attention to this matter. Best regards.

Reply
0 Kudos
MarvisKisakye1
New Contributor III

Did you ever find out if there's a way to call an ArcGIS Pro SDK Add-in from a python script? Charlie Gorman

Reply
0 Kudos
FabianOrtega
New Contributor

Hi !

Currently there's no way to call an ArcGIS Pro SDK Add-In from a python script.

So, I implemented a workaround: I created a Console Application, which will be called from a python script, like an entry-point.

Note: This workaround only works if you're working with "ArcGIS.Core" and "ArcGIS.Corehost" assemblies, it crashes for all the other assemblies (ArcGIS.Desktop.*)

Cheers,

Reply
0 Kudos