您当前的位置: 首页 >  Python

插件开发

暂无认证

  • 1浏览

    0关注

    492博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

插件开发 发布时间:2022-04-17 07:27:52 ,浏览量:1

文章目录
    • 1.算法程序
    • 2.作者答疑

1.算法程序

  犀牛软件是一款专业的三维设计软件。简单实用方便,在三维矢量领域有着广泛的用途,开发拓展这款软件的插件,可以方便设计师摆脱一些繁重的重复劳动,有着现实的需求。作者整理了一个python开发的脚本,功能是点和周长构建圆,作为范例,源代码如下:

# Create a circle from a center point and a circumference.
import rhinoscriptsyntax as rs
import math

def CreateCircle(circumference=None):
    center = rs.GetPoint("Center point of circle")
    if center:
        plane = rs.MovePlane(rs.ViewCPlane(), center)
        length = circumference
        if 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 length
    return 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.作者答疑

  如有疑问,请留言。

关注
打赏
1665481431
查看更多评论
立即登录/注册

微信扫码登录

0.0365s