BP (Before Pro) – Why Pro? – Python Add-Ins – Choosing the Right Tools § The Journey – Learning C# – Dev Summit – Practice, Collaboration and Testing § Your Turn: Getting Started § Scenarios – Simple: Launch a native GP tool using C# – Hybrid: Launch a custom python script and run in command shell – Advanced: Completely rewrite tool in C# – C# Wiz: Customize the UI using WPF (dock panes!) § Lessons Learned
Time Period – Why Pro? 4 § End of ArcMap Era in sight § ArcGIS Pro – Multi-threaded/64-bit – C# .NET architecture – Dark Mode!! § Development of tools not on Pro roadmap or locked behind extension (Roads and Highways)
Time Period – Python Add-Ins 5 § Python Add-In Wizard § Mostly limited to launching GP Tools, external python scripts § Tried to write LRS tools for Pro in python, but results weren’t consistent
Patterns: – Configure UI through settings, and workflows through Tasks (Backstage Tab, limited, no code) – Automate using geoprocessing and Python. (arcpy and arcgis API) – Extend with your own custom tools and solutions using the Pro SDK. (C# Add-Ins) – https://github.com/esri/arcgis-pro- sdk/wiki/ProConcepts-Migrating-to-ArcGIS-Pro § C# Patterns – Custom Add-Ins – Managed Configurations – Tons of options (dropdowns, context menus, dockpanes, map tools, sounds, etc) BP (Before Pro) Time Period – Choosing the Right Tools
Learning C# 7 § Used Esri credits to bring out teachers – 2-Day ArcGIS Pro Course – 4-Day Extending ArcGIS Pro with Addins (EAPA) Course § Beginner/Intermediate knowledge of C# recommended for EAPA § ‘Firehose’ of information/Big learning curve § Previous programming experience helps! § After the C# course we were developing perfect add-ins with no problems!***
Practice, Collaboration and Testing 11 § Weekly learning sessions working through guide together § Esri Documentation – API/SDK Page – Community Samples – Pro Snippets – GeoNet § Testing team and bug fixes § Practice!
Started 12 § Visual Studio 2017 (Community Edition is free) § ArcGIS Pro (Not free) § ArcGIS Pro SDK (Software Development Kit) – Downloaded through Visual Studio – Inserts code templates – IntelliSense
“Simple”: Launch a native GP tool using C# § Hybrid: Launch a custom python script and run in command shell § Advanced: Completely rewrite tool in C# § C# Wiz: Customize the UI using WPF 13
Want to run GP tool with one click § Useful for quick, commonly used operations § Control over where button is placed (context menu) § Call using C# § Example: Calculate Geometry 14
Create new VS project and add button using Pro SDK § Set path to GP tool using its alias § Set arguments based on Python documentation § Construct value array and pass those args to ExecuteToolAsync() 15
Add reference to button in the DAML (markup file) § Controls where the button is located in the application § Default is on “Add In” tab along top ribbon § Customized to add to specific context menu § Can add anywhere 16
Want to launch custom Python script with button § Pass args to script and run externally in command shell § Useful when working with legacy (i.e. 2.x) Python scripts § Allows migration to Pro without rewriting entire codebase § Example: Hello World 17
§ Script launches, accepting input from user § Passes input as args in script § Could be OIDs, map selection, attributes, etc. § Useful for getting up and running quickly § Familiar Python prog patterns § Use existing scripts
Need to completely rewrite Python script in C# § Not only is syntax different, not always a corresponding method § C# more verbose, many, many more ways to do one thing § Example: Jump To Google/Jump To Streetview 20
Same logic, syntax and methods different § Save time/sanity by reading documentation FIRST! § Ex: Camera property accesses Scale § Use original script as pseudocode 21