430 likes | 595 Views
Introduction to ESRI Add-Ins. GIS/LIS Conference Rochester, MN October, 2014. Agenda. Introductions What are Add-ins? Python Add-ins Break .NET Add-ins Extras. Set Up?. Introductions. Chris Pouliot Application Developer, @MN DNR Avenue, VB6, VB.NET, C#, Python
E N D
Introduction to ESRI Add-Ins GIS/LIS ConferenceRochester, MN October, 2014
Agenda • Introductions • What are Add-ins? • Python Add-ins • Break • .NET Add-ins • Extras
Introductions • Chris Pouliot • Application Developer, @MN DNR • Avenue, VB6, VB.NET, C#, Python • Christopher.pouliot@state.mn.us • Jackie Brost • GIS Specialist, @MN DNR • GIS Training & Support, Python • Jacqueline.brost@state.mn.us
Introductions • Who are you? • Programming experience? • Why are you taking the class?
What are Add-ins? • New model for ArcGIS Desktop application customization • Single tool or group of tools • Button, Tool, Menu, Toolbar, etc • Perform action in response to application event • New Document, Edit, Change Extent, etc • Works on ArcGIS Desktop Products (ArcMap, ArcCatalog, ArcGlobe)
What are Add-ins? • Single compressed file (*.esriAddIn) • Created in .NET, Java, or Python • ArcMap knows how to install and use • VERY easy to distribute and manage • “Well Known Folders”
What are Add-ins? .esriAddIn
When to Use an Add-in? • If only rearranging existing tools into custom toolbar do this in MXD or MXT with no code. • If running a process or batch job of geoprocessing tools then create a model or create a tool in toolbox using python
When to Use an Add-in? • If you need to interact with the User Interface – Map, Layout, Table of Contents, etc then use an addin • If you need code to run based on an ArcMap event (layer turned on/off, new document opened, changed data frame, feature edited) then use an addin
What Languages and IDEs? • .NET (C#, VB.NET) • Visual Studio 2008+ • Visual Studio 2012 works with ArcGIS10.2 • Visual Studio 2010 works with ArcGIS 10.1 • .NET SDK (Comes with ArcGIS Install) • Installed AFTER Visual Studio • Java • Eclipse • .NET SDK (Comes with ArcGIS Install) • Python (New with ArcGIS 10.1!!) • PyWIN, PyScripter, etc • Python Add-In Assistant
Python Add-Ins • New in10.1 • Pros • Simple Code • Uses ArcPy libraries • No DLLs • No ArcObjects • Cons • No ArcObjects • No Forms/Dialogs
Python Add-ins • Supported Types • Buttons • Tools • Toolbars • Tool Palette • Combo boxes • Menus • Extensions • Provides event listeners
Python Add-ins • Not Supported • Dockable Windows • UI (Custom Forms and Dialogs) • Mark Cedarholm – presentation at ESRI’s 2012 Developers Conference was able to create custom forms using WX Python. • ArcObjects– limited to arcpy python module
Python Add-ins Steps to Create a Python Add-in • Use Python Add-In Wizard to create an Add-In framework (define buttons, tools, menus, toolbars, etc) • Write Python Code behind buttons, tools, …. • Compile to create a single Add-In file (makeaddin.py) • Install/Distribute Add-in
Python Add-in Wizard • Free download from http://www.arcgis.com • Simplifies development of Python add-in • Wizard for defining project settings and add-in content
Python Add-in Wizard • Edit Python script that’s been generated in the install folder • Run makeaddin.py to create .esriaddin file • Double-click .esriaddin to open installation utility • Installer copies add-in to the well known default add-in folder (My Documents > ArcGIS)
Python Add-ins Module • New module in Python that enhances Includes functions for supporting Python add-ins • Get selected layer or data frame • Open gp tool • Open and save dialog boxes • Message box
Python Test/Debugging • If tool shows <missing> means probably a syntax error in the config.xml file. Use IDE to check this. • Use Print statements • Information printed to Python window • Assures proper values in variables • Exceptions printed to Python window
.NET Add-ins • What is .NET?? • Development framework to build applications for the Windows Platform • Key Features • Common Language Runtime • Base Class Library • Windows Forms
.NET Add-ins • What is .NET?? • Interacting with databases • Parsing XML • File reading and writing • String manipulation • Working with collections • Forms and Tools
.NET Add-ins • What version of .NET should I be using? • .NET 4.0 is supported at 10.1 and 10.2 • .NET 3.5 is installed with ArcMap
.NET Add-ins • Visual Studio 2008+ • Express • Free • http://www.microsoft.com/visualstudio/eng/downloads • Doesn’t have real-time debugging (similar to Python Add-In Wizard) • Professional • $450 • Great real-time debugging
.NET Add-ins • ArcGIS .NET SDK • ArcObjects Libraries • Building blocks of ArcGIS products. • Fine-grained control • Forms, Dialogs
.NET Add-ins • Supported Types • Buttons • Tools • Combo boxes • Multi-Items • Menus • Context Menus • Toolbars • Tool Palettes • Dockable Windows • Application Extensions • Editor Extensions • Editor Construction Tools • SOE (Server)
.NET Add-ins • Examples: • Quick Layers • Where Window • Forest Inventory Module • Hydrography Tools • Private Forest Management • Native Plant Communities • Wildlife Surveys
.NET Add-ins • Steps to Create a .NET Add-In in Visual Studio • Create Add-In components (button, tool, construction tool, combo box, multi-item, extension, editor extension, dockable window) • Create component containers (Tool Palette, Toolbar, Menu, Context Menu) • Write code behind components • Compile to create a single Add-In file • Install/Distribute
Add-In Versions • Always increment the version.
Add-In Versions • Anatomy of a config file.
Installing • My Add-Ins • Double-Click the .esriaddin file to open installation utility • Shared Add-Ins • Copy .esriaddin file to a Well Known Folder specified in ArcMap’s Add-In Manager • Installer copies add-in file to default add-in folder (C:\Users\chpoulio\Documents\ArcGIS\AddIns\Desktop10.x\) • Digitally sign add-ins • Assures add-in hasn’t been modified since signing
Installing Customizations Easy 10.x 9.x Effort Level 8.x Hard Time
Integrating Existing Components • Existing ESRI component • Need the GUID of the item you’re interested in. These can be found at http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000029s000000
Tips and Tricks • Updating Add-In • If placing in an Add-In folder do NOT leave old version there. Arcmap will see it even if you rename it and change the file extension.
Tips and Tricks • Add-In folder locations • Arcmap is slow in navigating file systems, especially across a VPN. If you do put your add-ins in a location on a network, put them in a single folder without any other extraneous files.
References • Help • ArcGIS Desktop Python Add-ins Guide Book • Web Training • Basics of Python (for ArcGIS 10) • Python Scripting for Map Automation in ArcGIS 10 • Creating Desktop Add-ins Using Python • Instructor-led Training • Introduction to Geoprocessing Scripts Using Python (10.0)