|
自学了几天python。。楼主的问题其实用python很好解决的。
思路是利用核心函数rs.ispointonsurface来算出点是否在曲线生成的平面内,然后利用得到的布尔值对点集合进行分组。具体代码如下------
import rhinoscriptsyntax as rs
from math import*
pt=rs.GetObjects("points to test",1)
cur=rs.GetObject("curve",4)
plane=rs.AddPlanarSrf(cur)
b=[]
insidepoints=[]
outsidepoints=[]
for i in range(0,len(pt)):
a=rs.IsPointOnSurface(plane,pt[i])
b.append(a)
for i in range(0,len(pt)):
if b[i]==True:
insidepoints.append(pt[i])
else:
outsidepoints.append(pt[i])
rs.DeleteObject(plane)
把变量代换一下就能做成grasshopper的按钮了。
望采纳~~~{:08:}
|
|