用getpoints和addpolyline输入点生成polyline(多段线)——rhinopython

目的:用户输入/指定多个点,生成多段线

用到getpoints(不是getpoint!注意)、addpolyline

geipoints官方文档:

GetPoints(draw_lines=False, in_plane=False, message1=None, message2=None, max_points=None, base_point=None)

Pauses for user input of one or more points
Parameters:
draw_lines (bool, optional): Draw lines between points
in_plane (bool, optional): Constrain point selection to the active construction plane
message1 (str, optional): A prompt or message for the first point
message2 (str, optional): A prompt or message for the next points
max_points (number, optional): maximum number of points to pick. If not specified, an
                  unlimited number of points can be picked.
base_point (point, optional): a starting or base point
Returns:
list(point, ...): of 3d points if successful
None: if not successful or on error

emmm,基本上只用True就行

addpolyline官方文档:

AddPolyline(points, replace_id=None)

Adds a polyline curve to the current model
Parameters:
points ([guid|point, guid|point, ...]): list of 3D points. Duplicate, consecutive points will be
         removed. The list must contain at least two points. If the
         list contains less than four points, then the first point and
         last point must be different.
replace_id (guid, optional): If set to the id of an existing object, the object
         will be replaced by this polyline
Returns:
guid: id of the new curve object if successful

emmm,后面参数记得跟着多个点(points)就行

两个简单的函数,实现起来很简单:

import rhinoscriptsyntax as rs
points = rs.GetPoints(True)
#Getpoints多用True即可,根据需要自行调整
if points: rs.AddPolyline(points)

用grasshopper实现的

当然,如果你会grasshopper,那可以更简单
直接用polyline这个电池,连接points数据即可
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值