文章目录
1.算法程序2.作者答疑1.算法程序
犀牛软件是一款专业的三维设计软件。简单实用方便,在三维矢量领域有着广泛的用途,开发拓展这款软件的插件,可以方便设计师摆脱一些繁重的重复劳动,有着现实的需求。作者整理了一个python开发的脚本,功能是点和周长构建圆,作为范例,源代码如下:
# Create a circle from a center point and a circumference.import rhinoscriptsyntax as rsimport mathdef CreateCircle(circumference=None):center = rs.GetPoint("Center point of circle")if center:plane = rs.MovePlane(rs.ViewCPlane(), center)length = circumferenceif length is None: length = rs.GetReal("Circle circumference")if length and length>0:radius = length/(2*math.pi)objectId = rs.AddCircle(plane, radius)rs.SelectObject(objectId)return lengthreturn None# Check to see if this file is being executed as the "Main" python# script instead of being used as a module by some other python script# This allows us to use the module which ever way we want.if __name__ == '__main__':CreateCircle()# NOTE: see UseModule.py sample for using this script as a module
2.作者答疑
如有疑问,请留言。