本帖最后由 筑梦NARUTO 于 2017-2-22 15:55 编辑
不要重新成体是啥意思,你能示范一下你要的结果么我是不是给你发过一段代码用于移动控制单的呀
- #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("选择要移动的控制点")
- surface = rs.GetObject("选择用于干扰的曲面",rs.filter.surface)
- dis = {}
- if (result == r.Commands.Result.Success and surface):
- geo_surface = sc.doc.Objects.Find(surface).Geometry
- 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_surface.Faces[0].DuplicateSurface().ClosestPoint(i.Geometry.Location)
- if Bool[0]:
- cpt = geo_surface.Faces[0].DuplicateSurface().PointAt(Bool[1],Bool[2])
- i.Move(cpt)
- for guid in dis:
- if dis[guid]:
- sc.doc.Objects.GripUpdate(dis[guid],True)
- sc.doc.Views.Redraw()
复制代码
|