Hello everybody,I´m a student and new in python. As an excercise I have to create an script, which, using a feature class existing in a geodatabase, should clip other featureclasses existing in the same geodatabase (but not clipping itself) and add the prefix "NewFile" to the feature classes that were clipped, however, I arrive to some point where I´m lost and don´t know exactly how to finish the script, can somebody help me with that?
Thank you in advance!
import arcpy, os
from arcpy import env
arcpy.env.workspace = arcpy.GetParameterAsText(0)
clipFeatures = 'D:\\datosvalle\\Valle.mdb\\Santiago_de_cali'
outWorkspace = 'D:\\datosvalle\\Valle.mdb'
clusterTolerance = ""
try:
fcs = arcpy.ListFeatureClasses()
for fc in fcs:
featureClassName = arcpy.ValidateTableName("Newfile_"+fc, outWorkspace)
outFeatureClass = os.path.join(outWorkspace, featureClassName)
if fc <> os.path.basename (clipFeatures):
arcpy.Clip_analysis(fc, clipFeatures, outFeatureClass, clusterTolerance)
except: arcpy.AddMessage(arcpy.GetMessages(2))
print "The files were correctly clipped"
What are you having a problem with?
Welcome to the site. It is preferable practice to indicate
Your response suggests that you got lost somewhere...but the script looks not bad. Did you get lost early on? if so how did you write the rest of the script? So basically, as Freddie says...what's up? what happened or didn't?
I think what you need to do is remove the clip fc from the list
fcs.remove('Santiago_de_cali')