ArcGIS Python拱形面

# -*- coding: utf-8 -*-
#by gisoracle 2021.01.23
import arcpy
import math
#保存数据
def Save(polygon,rows):

    row = rows.newRow()
    #row.setValue(shapefieldname,featureList)
    row.shape=polygon
    rows.insertRow(row)
    del row

x=500000 
y=0
r=200.0
pi=3.1415926
outFeature=arcpy.GetParameterAsText(0)
array = arcpy.Array()
#point = arcpy.Point()
for i in range(0,180):
    x1=x+r*math.cos(i*pi/180)
    Z=r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y,Z)
#point.X=x1 #point.Y=y #point.Z=Z arcpy.AddMessage("Z="+str(Z)) array.add(point) y=300 for i in range(180,0,-1): x1=x+r*math.cos(i*pi/180) Z=r*math.sin(i*pi/180) point = arcpy.Point(x1,y,Z) #point.X=x1 #point.Y=y #point.Z=Z array.add(point) arcpy.AddMessage("Z=" + str(Z)) rows = arcpy.InsertCursor(outFeature) polygon = arcpy.Polygon(array,None,True) Save(polygon, rows) polygon = None

 

# -*- coding: utf-8 -*-
#by gisoracle 2021.01.23
import arcpy
import math
#保存数据
def Save(polygon,rows):

    row = rows.newRow()
    #row.setValue(shapefieldname,featureList)
    row.shape=polygon
    rows.insertRow(row)
    del row

x=500000 
y1=0
r=200.0
pi=3.1415926
outFeature=arcpy.GetParameterAsText(0)
array = arcpy.Array()
#point = arcpy.Point()
for i in range(0,181):
    x1=x+r*math.cos(i*pi/180)
    Z=r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y1,Z)
    #point.X=x1
    #point.Y=y
    #point.Z=Z
    #arcpy.AddMessage("Z="+str(Z))
    array.add(point)
y2=300
for i in range(180,-1,-1):
    x1=x+r*math.cos(i*pi/180)
    Z=r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y2,Z)
    #point.X=x1
    #point.Y=y
    #point.Z=Z
    array.add(point)
    #arcpy.AddMessage("Z=" + str(Z))
rows = arcpy.InsertCursor(outFeature)
polygon = arcpy.Polygon(array,None,True)
Save(polygon, rows)
#下面底面
array.removeAll()
p1 = arcpy.Point(x-r, y1, 0)
array.add(p1)
p1 = arcpy.Point(x+r, y1, 0)
array.add(p1)
p1 = arcpy.Point(x+r, y2, 0)
array.add(p1)
p1 = arcpy.Point(x-r, y2, 0)
array.add(p1)
polygon = arcpy.Polygon(array,None,True)
Save(polygon, rows)
#外侧面

array.removeAll()
for i in range(0,181):
    x1=x+r*math.cos(i*pi/180)
    Z=-r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y1,Z)
    arcpy.AddMessage(u"Z==="+str(Z))
    array.add(point)

for i in range(180,-1,-1):
    x1=x+r*math.cos(i*pi/180)
    Z=-r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y2,Z)

    array.add(point)
    arcpy.AddMessage(u"Z===" + str(Z))
rows = arcpy.InsertCursor(outFeature)
polygon = arcpy.Polygon(array,None,True)
Save(polygon, rows)


polygon = None

 修改后代码

# -*- coding: utf-8 -*-
#by gisoracle 2021.01.23
import arcpy
import math
#保存数据
def Save(polygon,rows):

    row = rows.newRow()
    #row.setValue(shapefieldname,featureList)
    row.shape=polygon
    rows.insertRow(row)
    del row

x=500000 
y1=500
r=200.0
pi=3.1415926
basicz=500
outFeature=arcpy.GetParameterAsText(0)
array = arcpy.Array()
#point = arcpy.Point()
for i in range(0,181):
    x1=x+r*math.cos(i*pi/180)
    Z=basicz+r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y1,Z)
    #point.X=x1
    #point.Y=y
    #point.Z=Z
    #arcpy.AddMessage("Z="+str(Z))
    array.add(point)
y2=800
for i in range(180,-1,-1):
    x1=x+r*math.cos(i*pi/180)
    Z=basicz+r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y2,Z)
    #point.X=x1
    #point.Y=y
    #point.Z=Z
    array.add(point)
    #arcpy.AddMessage("Z=" + str(Z))
rows = arcpy.InsertCursor(outFeature)
polygon = arcpy.Polygon(array,None,True)
Save(polygon, rows)
#下面底面
array.removeAll()
p1 = arcpy.Point(x-r, y1, basicz)
array.add(p1)
p1 = arcpy.Point(x+r, y1, basicz)
array.add(p1)
p1 = arcpy.Point(x+r, y2, basicz)
array.add(p1)
p1 = arcpy.Point(x-r, y2, basicz)
array.add(p1)
polygon = arcpy.Polygon(array,None,True)
Save(polygon, rows)
#外侧面

array.removeAll()
for i in range(0,181):
    x1=x+r*math.cos(i*pi/180)
    Z=basicz+-r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y1,Z)
    arcpy.AddMessage(u"Z==="+str(Z))
    array.add(point)

for i in range(180,-1,-1):
    x1=x+r*math.cos(i*pi/180)
    Z=basicz+-r*math.sin(i*pi/180)
    point = arcpy.Point(x1,y2,Z)

    array.add(point)
    arcpy.AddMessage(u"Z===" + str(Z))
rows = arcpy.InsertCursor(outFeature)
polygon = arcpy.Polygon(array,None,True)
Save(polygon, rows)


polygon = None
原文地址:https://www.cnblogs.com/gisoracle/p/14324583.html