Skip to content

Latest commit

 

History

History

CallScriptFromNet

CallScriptFromNet

This Button add-in, when clicked, uses the first Polygon layer in the Map and runs a buffer operation with help of a Python script. It reads the text stream output from python and displays it.

View it live

Language:              C#
Subject:               Geoprocessing
Contributor:           ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization:          Esri, https://www.esri.com
Date:                  04/04/2024
ArcGIS Pro:            3.3
Visual Studio:         2022
.NET Target Framework: net8.0-windows

Resources

Community Sample Resources

Samples Data

  • Sample data for ArcGIS Pro SDK Community Samples can be downloaded from the Releases page.

How to use the sample

  1. This solution file includes an example python script named test1.py which is included as 'Content' (Build action) in the add-in.
  2. This sample also requires an ArcGIS Project with a map that has at least one polygon layer in the Map's table of content.
  3. Rebuild the project in Visual Studio and debug.
  4. In ArcGIS Pro open a project with a map that has one polygon layer in the Map's TOC.
  5. Make sure the Map is the active map.
  6. Go to the ADD-IN Tab, find the "Python Script" group and click "Show Python Feedback" followed by "Run Py Script".
  7. The "Run Python Script" Dockpane will populate the "In" and "Out" feature classes used for the script's buffer operation.
  8. Note: the "In" feature class is derived from the first feature layer in the active Map's table of content.
  9. Note: the "Out" feature class is derived from the "In" feature class with a "_Buffer" appended to the feature class name.
  10. Note: if the "Out" feature class exists the code will delete the feature class in order for the script to work.
  11. The Feedback from Python is displayed in the dockpane:
    UI
  12. If you have ArcGIS Pro installed and licensed on your machine you should be able to run this python script directly from a Windows command prompt.
  13. To do so open a Windows Command prompt and copy/paste the content from the Dockpane's 'Command line' field.
    UI

      ArcGIS Pro SDK for Microsoft .NET Framework              Home | API Reference | Requirements | Download | Samples