So I would like to create additional options for custom shapes when editing a polygon feature. Something to the same functionality of the 'Construction Tools' as pictured below, but with a greater variety of shapes (like a triangle, pentagon, irregular shape as below, etc).
Wondering what the best method would be to go about this? I'm assuming it's not possible to add custom shapes directly into the already existing Construction Tools panel (tho I'm not technically versed enough to know).. but in that case would writing an Add-In be the best way? Is it possible?
..I probably won't be doing this by myself unless it requires minimal coding experience, but I'd really appreciate if someone can point me to the correct basic approach!
Hey,
Change the U: to 😧 (See below)
I use PythonWIN to write my code and save it as a script. I open the script to edit. Not sure if this matters.
with arcpy.da.InsertCursor ("GC_R20", ["SHAPE@"]) as U:
Switched the U: to 😧 in the code, I guess I'm just not sure what results I should be encountering..!
Thanks for helping my supreme newbieness..
Do you see anything off in the process below or my attribute table?
Hey,
So you created a point shapefile? Send me your code you have been working on.
James
OH. No... I created a polygon in the shape of what I want to replicate (in the previous image, the green shape, still called "GC_R20"). Should I be using pure points in a formation?
import arcpy, os
arcpy.env.workspace = "D:/ARCGIS_TESTING"
pointList=[]
try:
with arcpy.da.SearchCursor ("GC_R20", ["SHAPE@XY"]) as cursor:
for row in cursor:
xy = row[0]
pointList.append(XY)
with arcpy.da.InsertCursor ("GC_R20", ["SHAPE@"]) as 😧
for pnt in pointList:
lowX = pnt[0]
lowY = pnt[1]
# find the upper right
highX = lowX + 162.2539
highY = lowY + 123.2639
array = arcpy.Array([arcpy.Point(lowX, lowY),
arcpy.Point(lowX, highY),
arcpy.Point(highX, highY),
arcpy.Point(highX, lowY),
arcpy.Point(lowX, lowY)])
polygon = arcpy.Polygon(array)
D.insertRow([polygon])
except:
Hey,
You will create one point.shp or many. The polygon is drawn based on the location of the point.shp XY.
James
Ok! It's making more sense now... thank you!
So say I want to create a pentagon.. can you reference one point file called "PENTAGON" that has five points in it? Or do I need five separate shapes, with one point in each?
I notice in the code there is:
highX = lowX + 162.2539
highY = lowY + 123.2639
I'm not sure what it's referring to- is this something I would have to edit for each point? And what units?
Hello,
The code is based on a single point then draws the polygon based on the point's X and Y positions. So if you have over one point it will draw more than one polygon. For my project I needed to create a bunch of squares based on a certain square feet area. You can enhance the code to draw as you want.
To draw a building's foot print you are going to have to alter the dimensions of below:
highX = lowX + 162.2539
highY = lowY + 123.2639
I believe the math can be done. Look at trigonometry. I will look and see if I can find any supporting documentation.
Thanks
Also, You may be able to cut...
#Populates a field with DONE so the delete cursor will find and delete.
#This will enable a clean attribute table so dublicates will be eliminated.
arcpy.CalculateField_management("GC_R20","File", "\"Done\"", "PYTHON", "")
print "Process for new polygons is complete"