Based on the script mentioned before I created something.
It simply moves a vertical lines from left to right and starts to cut the polygon until a polygon is found that is within the tolerance.
See code below:
def main():
# based on: https://community.esri.com/message/627405#comment-627648
# author: https://community.esri.com/people/fcbassongis
import arcpy
# path to input and output featurecladss
fc_in = r'C:\GeoNet\SplitPolygon\Surface Mining Plan.shp'
fc_out = r'C:\GeoNet\SplitPolygon\datos.gdb\split_polygons06'
# number of splits
splits = 5
# get first (only) polygon and extent
polygon = arcpy.da.SearchCursor(fc_in, ('SHAPE@')).next()[0]
extent = polygon.extent
sr = polygon.spatialReference
# start creating vertical lines and cut polygon
stepsize = 0.2
total_area = polygon.area
tolerance = total_area * 0.0001
split_polygons = []
d = extent.XMin + stepsize
work_pol = polygon
i = 0
while d < extent.XMax:
i += 1
if i % 100 == 0:
print "step: {}".format(i)
percentage = (d - extent.XMin) / (extent.width) * 100.0
vertical_line = CreateVerticalLine(d, extent, sr)
left_pol, right_pol = CutPolygon(work_pol, vertical_line)
if not left_pol is None and not right_pol is None:
if abs(left_pol.area - total_area / splits) < tolerance:
split_polygons.append(left_pol)
work_pol = right_pol
d += stepsize
if len(split_polygons) == splits - 1:
split_polygons.append(right_pol)
break
arcpy.CopyFeatures_management(split_polygons, fc_out)
def CreateVerticalLine(d, extent, sr):
pnt1 = arcpy.Point(d, extent.YMin - 1)
pnt2 = arcpy.Point(d, extent.YMax + 1)
polyline = arcpy.Polyline(arcpy.Array([pnt1, pnt2]), sr)
return polyline
def CutPolygon(polygon, polyline):
try:
polygons = polygon.cut(polyline)
return polygons[0], polygons[1]
except Exception as e:
return None, None
if __name__ == '__main__':
main()
This results in:
... including a multipart polygon (in green)
ArcGIS Pro has now this tool that can subdivide polygons: