import arcpy import pythonaddins import os class CreateNewPolygon(object): """Implementation for NewPolygon_addin.CPNtool (Tool)""" def __init__(self): self.enabled = True self.cursor = 3 self.shape = "Line" def onLine(self, line_geometry): array = arcpy.Array() part = line_geometry.getPart(0) for pt in part: print pt.X, pt.Y array.add(pt) array.add(line_geometry.firstPoint) polygon = arcpy.Polygon(array) # Local Variables Input = polygon NewPolygons = "C:\Arcfiles\test.gdb\NewPolygons" # Process: Append Polygon to existing file or Create new file if one is not created. if arcpy.Exists("NewPolygons"): arcpy.Append_management(Input, NewPolygons, "Test", "", "") else: arcpy.CopyFeatures_management(Input,NewPolygons, "", "0","0","0")
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.