• 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
  • 相关阅读:
    Vue动画
    Vue的生命周期
    《JavaScript高级程序设计第三版》——细碎知识痛点整理(第六章)
    《JavaScript高级程序设计第三版》——细碎知识痛点整理(第五章)
    stylus(css预编译器)
    《JavaScript高级程序设计第三版》——细碎知识痛点整理(第三章到第四章)
    nodejs安装配置
    mac安装sudo pip install MySQL-python报错EnvironmentError: mysql_config not found解决方法
    2016
    chrome浏览器自动刷新问题
  • 原文地址:https://www.cnblogs.com/gisoracle/p/14324583.html
Copyright © 2020-2023  润新知