jdrvar

Modify custom Python script to general Toolbox

Discussion created by jdrvar on Jul 15, 2013
I am new to python scripting and began by creating a specific tool. Now, I want to modify the script for any feature class.  How would I modify the script to input/clip/output any feature class?  GetParameterAsText?  Then, I intend to add the script to a toolbox.  The script is as follows:

#Import system modules
import arcpy
from arcpy import env

#Workspace
env.workspace = "E:\User\MillageCode"

#Variables
in_features = "Sales_2006.shp"
clip_features = "EagleHarborSales_temp.shp"
out_feature_class = "Output_temp5.shp"

#Clip the Sales_2006 shapefile to the EagleHarborSales_temp shapefile
arcpy.Clip_analysis(in_features, clip_features, out_feature_class)

#Info (arcpy commands are case sensitive)
print arcpy.GetMessages()

Thanks!

Outcomes