Monday, July 25, 2016

Module 10 Creating Custom Tools

This week we focused on the use of custom tools to both automate workflow and share time saving processes with others.  Our goal was to create a tool box to house a script which would perform a clip on multiple objects.

Here are the notes from my process summary  about how to create a script tool and a valuable tip I learned, the hard way!
This list assumes you have a functional stand-along script named SAScript.py
1.       In either Arc Catalog or ArcMap, navigate to the location you want to create the script tool.
2.       Right click on the folder intended to house your script tool and select New, Toolbox.  Name your tool box.  In this case SAScript.tbx
3.       Right click SAScript.tbx and choose add script
4.       In the dialog box name your script (in this case SAScript); repeat in the label field and add a description of what your script does in the description field.  Toggle the Store relative path names to on before choosing next.
5.       Browse for your script file, choose open and then choose next.
6.       At this time, you can skip the adding parameters and just choose finish.
7.       Run the tool either in ArcCatalog or ArcMap; it will say there are no parameters but it will run and either work or return errors if your script has an issue.

8.       After checking this, right click on your script and choose properties.  You may know enter your parameters which will be dependent on the type of script you created.

TIP:  Don't overthink or apply "common sense" to the parameter properties.  Your output file location direction parameter should say Input!  If you change it to output as I did, the tool cannot write to an output file.  This will cause great consternation if you don't catch your mistake!



Tool dialog, Tool results and flow chart for creating the script tool:






No comments:

Post a Comment