I have created Buildings footprint in Autocad and exported to SHP which is having so many Donut polygons. Is there any way to clip polygons in SHP files (Batch)

I have found one script on net but it is creating issue as it is clipping overlapping errors too.

Modified Script: import arcpy import pythonaddins import os ,sys

System Variables:

mxd = arcpy.mapping.MapDocument(r"Current") df = arcpy.mapping.ListDataFrames(mxd)[0] arcpy.env.overwriteOutput = True

Local Variables:

Vendor = arcpy.GetParameterAsText(0) donutLayerUnion = arcpy.GetParameterAsText(1) idField = arcpy.GetParameterAsText(2) Donut_Processed = arcpy.GetParameterAsText(3)

Union analysis

arcpy.Union_analysis ("Vendor","donutLayerUnion","ALL","","GAPS")

Delete Identical analysis

arcpy.DeleteIdentical_management ("donutLayerUnion","Shape;Shape_Area","","")

Copy Feature Class

arcpy.FeatureClassToFeatureClass_conversion ("donutLayerUnion","C:/Temp","Donut_Processed.shp",where_clause="",field_mapping="",config_keyword="")

Delete Layers

arcpy.Delete_management("c:\temp\Donut_Processed.shp", data_type="ShapeFile")

Delete layer from active frame

for df in arcpy.mapping.ListDataFrames(mxd): for lyr in arcpy.mapping.ListLayers(mxd, "donutLayerUnion", df): arcpy.mapping.RemoveLayer(df, lyr) pythonaddins.MessageBox ('Process Done..','Kailash',0)

  • You want to Fill-in the donut holes? – klewis May 8 '19 at 16:20
  • Yes, I want to clip and fill the hole created by donut – Kaichand03 May 9 '19 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.