I have python code that I want to turn into a script.
I want the end user to be able to navigate to the feature class the code should be run on.
The code I have currently speaks to a specific feature class and doesn't allow for picking what feature class the code is to be run on.
How do I change my code so I can have the parameters in the script allow the end user to pick what feature class the code should be run on?
This is the piece of code I need to change to allow the end user pick the feature class..
What do I need to change in my code to allow for the peramiters I set up in the script to replace this line of code? I need fc to equal the input the end user selects not a specific feature class as the code currently stands.
I changed that line of code to fc = arcpy.GetParameterAsText(0) and set up parameters in my script dialogue but it errors out on me every time. Code works fine w/out the "getparametersastext" addition mentioned above.
Solved! Go to Solution.
If your tying your script to a tool box its pretty simple
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00150000001r000000.htm
How are you wanting your user to execute your code? Do you want them to execute it via a Script tool within the ArcGIS Desktop application? Are you wanting them to paste your code into the python window? Are you wanting to execute it standalone from a DOS prompt or python IDE?
If your tying your script to a tool box its pretty simple
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00150000001r000000.htm
Wes... you can't use 10.2 links...they go nowhere...it is a known bug, there is a workaround but use 10.3.1 links since (unless there is a difference) they are largely the same.
Dan Patterson how do i find 10.3.1 links i searched "add python script to toolbox 10.3.1" but it doesn't return any results for 10.3.1 I'm using IE10
The top level help for Python in 10.3 is http://desktop.arcgis.com/en/desktop/latest/analyze/python/what-is-python-.htm
Tools in Toolboxes is discussed Adding a script tool—Help | ArcGIS for Desktop
Travis, can you give a snapshot of how you have the dialog box setup? also, what is the error you are getting?
Thank you
Rebecca thanks for the feedback....below are two snap shots my my dialog box set up.
Comments...
Apparently I had a bug in ArcMap. I had to reinstall the software and once I did that the script worked fine.