目的:用户输入/指定多个点,生成多段线
用到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,那可以更简单
直接用polyline这个电池,连接points数据即可