Hi, I'm trying to build a script, my first, so that it would create another version of some polygons in a shapefile (per example zoning)by erasing some polygons contained in a different shapefile (called hydro). I don't have a Pro license, so I use the "Union then delete" method instead of the erase tool. I don't want the attributes from the hydro table. I want to duplicate the script to apply those modification to other shapefiles. So here is what I found for the moment:
# Import the system modules
from arcpy import env
# Set the current workspace
# (to avoid having to specify the full path to the feature classes each time)
env.workspace = "c:/data/data.gdb"
# For first layer
#Turn off all fields of hydro.shp so when union is done, the attributes table will only keep the fields from "zoning", leaving out the turned off fields of "hydro"
#Can't find script lines for that
#union layerName with hydro.shp
arcpy.Union_analysis (["layerName", "hydro", "layerName_union", "ALL")
#select FID_hydro <> -1
arcpy.SelectLayerByAttribute_management ("layerName_union", "NEW_SELECTION", " [FID_hydro] <> '-1' ")
#If selection > 0, delete FID_hydro <> -1
if int(arcpy.GetCount_management(layerName_union).getOutput(0)) > 0:
#export data layerName_union as shapefile
# Repeat for other layers
Anyone know how to use script to turn off all the field of a layer?
Would those steps work? Is there something missing?