Hello everyone
I want to move the control point to the curve,But I have some problems.Only the first control point is correct, the other is not the result I want.
I want to do this effect.
my code:
#coding=utf-8
import Rhino.Geometry as rg
import Rhino as r
import rhinoscriptsyntax as rs
import scriptcontext as sc
result,grips = r.Input.RhinoGet.GetGrips("选择要移动的控制点")
curve = rs.GetObject("选择用于干扰的曲线",rs.filter.curve)
dis = {}
if (result == r.Commands.Result.Success and curve):
geo_curve = sc.doc.Objects.Find(curve).Geometry
t = 0
for i in grips:
oid = i.OwnerId
obj = sc.doc.Objects.Find(oid)
if (obj and dis.has_key(oid)==False):
dis.Add(oid,obj)
Bool = geo_curve.ClosestPoint(i.Geometry.Location,t)
if Bool[0]:
cpt = geo_curve.PointAt(Bool[1])
i.Move(cpt)
for guid in dis:
if dis[guid]:
sc.doc.Objects.GripUpdate(dis[guid],True)
sc.doc.Views.Redraw()
MoveGrips.py (824 Bytes)
MoveGrips.3dm (559.5 KB)
Thanks
——NARUTO
