This should work: (unless google screws up my indentation)
import arcgisscripting
gp = arcgisscripting.create()
geometry = [[(10, 10),
(10, 20),
(20, 20),
(20, 10),
],
[(25, 25),
(50, 50),
(50, 25),
],
]
workspace = r'c:\tmp'
output_fc = r'multi.shp'
def main():
gp.Workspace = workspace
gp.CreateFeatureClass(workspace, output_fc, 'POLYGON')
part_array = gp.CreateObject('Array')
point_array = gp.CreateObject('Array')
point = gp.CreateObject('Point')
cur = gp.InsertCursor(output_fc)
row = cur.NewRow()
part_array.RemoveAll()
for part in geometry:
# first loop indentation
point_array.RemoveAll()
for x, y in part:
# second loop indentation
point.X = x
point.Y = y
point_array.Add(point)
# second loop ends here
# close the loop, repeat first point
x, y = part[0]
point.X = x
point.Y = y
point_array.Add(point)
print 'Adding %d points' % point_array.Count
part_array.Add(point_array)
# first loop ends here
print 'Adding %d parts' % part_array.Count
row.Shape = part_array
cur.InsertRow(row)
if __name__ == '__main__':
main()
/Niklas Norrthon