I have made three different script tools to run in a module that is going to clean multiple sets of data as I get them.
import arcpy
fc = "C:\Users\CartoFront\Desktop\Chicago Update\Chicago Update.gdb\ChiMetroJoin12012016practice"
arcpy.AlterField_management(fc, "SitusStdHouseNbr", "sthsnum", "sthsnum")
arcpy.AlterField_management(fc, "SitusStdDirectionLeft", "stdir", "stdir")
arcpy.AlterField_management(fc, "SitusStdStreet", "ststname", "ststname")
arcpy.AlterField_management(fc, "SitusStdMode", "stsuffix", "stsuffix")
arcpy.AlterField_management(fc, "SitusStdUnitType", "stunitprfx", "stunitprfx")
arcpy.AlterField_management(fc, "SitusStdUnitNbr", "stunitnum", "stunitnum")
I have previously just been editing the fc every time I run the script for the necessary input. However, I find this very counter-intuitive because I enter the same file input into my script tool every time I run it. Is there any way that I am able to set my inital fc variable to the input that I am entering into my script tool?
-
My apologies, just made the edit to change that. I have read through both of those Esri Help desk pages prior to asking, maybe I am just looking over the answer that is there. Just boggled down with the codes they provide for examples. I cant seem to see a way to set my initial code variable to the input in that example, is it just convoluted? Do you have any input on where I could look within that code? Sorry!ducksfloat– ducksfloat2016年12月02日 21:53:42 +00:00Commented Dec 2, 2016 at 21:53
-
I am running it as an actual script tool from a custom ArcGIS toolboxducksfloat– ducksfloat2016年12月02日 22:00:06 +00:00Commented Dec 2, 2016 at 22:00
1 Answer 1
Add a feature class or feature layer parameter in the script tool properties (right click the tool in your custom toolbox). Then use fc = arcpy.GetParameterAsText(0)
in your script.
See Setting script tool parameters and Accessing parameters in a script tool for more details.
-
Works perfect. Thank you so much for your help, I greatly appreciate it.ducksfloat– ducksfloat2016年12月06日 16:22:55 +00:00Commented Dec 6, 2016 at 16:22
Explore related questions
See similar questions with these tags.