Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- arcpy.env.workspace = strInPath
- # create a set to hold the attributes
- attributes=set([])
- # ---- create a list of feature classes in the current workspace ----
- listOfFeatures = arcpy.SearchCursor(strInPath,"","",strFieldName,"")
- for row in listOfFeatures:
- attributes.add(row.getValue(strFieldName))
- count=1
- try:
- for row in attributes:
- stroOutputClass = strBaseName + "_" +str(count)# (str(row.getValue(strFieldName))).replace('/','_')
- strOutputFeatureClass = os.path.join(strOutGDBPath, stroOutputClass)
- arcpy.Select_analysis(strInPath,strOutputFeatureClass,strQueryExp)#"["+strFieldName+"]"+"='"+row+"'")
- count=count+1
- del attributes
- except:
- arcpy.AddMessage('Error found')
- # Created on: 2015-05-19 15:26:10.00000
- # (generated by ArcGIS/ModelBuilder)
- # Description:
- # ---------------------------------------------------------------------------
- # Import arcpy module
- import arcpy
- # Load required toolboxes
- arcpy.ImportToolbox("Model Functions")
- # Local variables:
- Selected_Features = ""
- Value = "1"
- # Process: Iterate Feature Selection
- arcpy.IterateFeatureSelection_mb("", "", "false")
- import arcpy, os
- shp = r'C:tempyourSHP.shp'
- outws = r'C:temp'
- with arcpy.da.SearchCursor(shp, ["OBJECTID","SHAPE@"]) as cursor:
- for row in cursor:
- outfc = os.path.join(outws, "fc" + str(row[0]))
- arcpy.CopyFeatures_management(row[1], outfc)
- import arcpy
- cursor = arcpy.SearchCursor(BOUNDARY_POLYGON_FC)
- for row in cursor:
- feature_file_path = ('{}/{}_{}.shp').format(WORKSPACE, row.OBJECTID, row.NAME)
- arcpy.CopyFeatures_management(row.shape, feature_file_path)
Add Comment
Please, Sign In to add comment