raysarray.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:freecad-pyoptools 作者: cihologramas 项目源码 文件源码
def execute(self,obj):
        import Part,FreeCAD

        dist = obj.distribution.lower()


        if dist not in ["polar","cartesian"]:
            obj.distribution="polar"
            print "Ray Distribution not understood, changing it to polar"

        if dist == "polar":
            r=5*tan(radians(obj.angle))
            d=[]
            for x in linspace(-obj.xSize/2,obj.xSize/2,obj.Nx):
                for y in linspace(-obj.ySize/2,obj.ySize/2,obj.Ny):
                    d.append(Part.makeCone(0,r,5,FreeCAD.Vector(x,y,0)))
        else: #Todo: Cambiar cono a piramide
            r=5*tan(radians(obj.angle))
            d = []
            for x in linspace(-obj.xSize/2,obj.xSize/2,obj.Nx):
                for y in linspace(-obj.ySize/2,obj.ySize/2,obj.Ny):
                    d.append(Part.makeCone(0,r,5,FreeCAD.Vector(x,y,0)))


        obj.Shape = Part.makeCompound(d)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号