Select to view content in your preferred language

Creating a tool from a pyton script

743
2
09-13-2011 01:40 PM
EdPoole
Occasional Contributor
Hey everyone, I have a question that seems to stumping me currently (I can't find anything in the help).  I have created a custom pyton script that will generate sample plots on a polygon and also buffer the resultant points inside the boundary of the polygon (thus creating a grid and plot radius that can be added to a GPS).  I would like to create a button on the tool bar that will automatically launch the python script (tool) for our foresters, let them add in the layer and run the script. 

I originally made this tool in model builder, but exported it to python (I am not a python expert).  Can anyone walk me though the process on how to create a .dll file from the python script so I can add it on the tool bar?  If there is a help article out there simply point me in the right direction and I can go from there...  Thanks!
Tags (2)
0 Kudos
2 Replies
JoelCalhoun
Deactivated User
Are you using ArcGIS 10? 
If so, the easiest solution is to either use your model directly or create a python script tool.
Either of these can be added to ArcMap as a button.  Just make sure that on your model your input layer is set as a parameter or that your python script tool is set up to get an input parameter.

To create a script tool from a python script: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/A_quick_tour_of_creating_script_tools/...

To add your model or python script tool to ArcMap:
1) Open the "Customize" dialog.
2) Select the "Commands" tab.
3) Scroll to the bottom of the commands and select [Geoprocessing Tools].
4) Click the new "Add Tools..." button that appears below.
5) Navigate to your model or python script tool and click the "Add" button
6) Your model or script tool should show up in the right pane of the "Commands" tab.
7) Drag your model or script tool onto the ArcMap taskbar.
😎 Close the "Customize" dialog
9) Click on the newly added button to lauch your program


If you are not using ArcGIS 10, I'm not sure how this can easily be accomplished.


Anyway, I hope this helps,


Joel
0 Kudos
EdPoole
Occasional Contributor
I am using ArcGIS 10.  I have already set up the parameters and tested on another box and the script works.  I am looking for an easy drag and drop option (which it seems you have provided), for our field staff our foresters have very little experience with ArcGIS or GIS period.  You would be surprised how little forestry students are exposed to ArcGIS these days.  I took 2 classes in undergrad and one in grad school, some of these kids barely know how to start the program!  Thanks for your assistance!
0 Kudos