300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 犀牛插件开发-创建圆-Python-点后周长构建圆-Rhino插件

犀牛插件开发-创建圆-Python-点后周长构建圆-Rhino插件

时间:2022-07-20 18:59:30

相关推荐

犀牛插件开发-创建圆-Python-点后周长构建圆-Rhino插件

文章目录

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.作者答疑

如有疑问,请留言。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。