AnsweredAssumed Answered

Python Scripting

Question asked by narayan_khatiwada on Nov 11, 2014
Latest reply on Dec 5, 2015 by Dan_Patterson

Requesting for a help if someone could help me on this. Below is the set of requirements. Thanks


I want write a script that will allow users to batch clip all the featureclasses in a workspace. The workspace can be a folder containing shapefiles or a geodatabase. The script should also contain a test so that it does not clip the clipping features. 


The clipped featureclasses will be named using the base name of the input features plus an underscore with an appended value. The appended value can be obtained from a field in the clipping features or from a user supplied value.


The script will be more generic in that the clipping features may contain more than one feature and the user can select a subset of the features to use for the clipping. For example, the user can select the County layer as the clipping features, and then select X Township from the County layer to do the clipping.


You will need to test two Boolean inputs. One to see if a subset of clipping features is selected and another to see if the append value is obtained from a field or if the user inputs the value.




Data Type






Input workspace

Folder or feature dataset


Clipping features



Select subset of clipping features?


Required with a default value

SQL to select the subset

SQL statement, from clipping features


Append value from a field or user input


Required with a default value

Field from which to obtain append value

Field, from clipping features


User input string





I want to use base name of the features that are being clipped using the .baseName method on a describe object instead of using the .name method to negate having to test if the features class is a shapefile and then removing the .shp extension. For example;



featureClassDescription = arcpy.Describe(featureClass)


featureclassBasename = featureClassDescription.baseName


Instead of:


featureClassDescription = arcpy.Describe(featureClass)


featureclassBasename =