Hi @Henry_Wede, try below to get a NurbsSurface from the brep. (A brep consists of brep faces and each brep face has an underlying surface which can be converted to a nurbs surface:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DoSomething():
srf_id = rs.GetObject("Select surface", rs.filter.surface, True, False)
if not srf_id: return
brep = rs.coercegeometry(srf_id)
if brep.Faces.Count != 1: return
surface = brep.Faces[0].ToNurbsSurface()
control_pt = surface.Points.GetControlPoint(0, 0)
scriptcontext.doc.Objects.AddPoint(control_pt.Location)
scriptcontext.doc.Views.Redraw()
DoSomething()
Note two things, you cannot do something like this in your example:
SomePoint = RhinoSurface.NurbsSurfacePointList.GetControlPoint(0.5, 0.5)
To access the NurbsSurfacePointList you might use surface.Points
instead. To access control points using surface.Points.GetControlPoint
you need to pass integers (not floats) as these numbers are the indices of the points along uv directions.
No, it should be possible. Below is an example which does it and moves the first control point (u=0
and v=0
) along the normal by 5.0
units:
def DoSomething():
srf_id = rs.GetObject("Select surface", rs.filter.surface, True, False)
if not srf_id: return
brep = rs.coercegeometry(srf_id)
if brep.Faces.Count != 1: return
surface = brep.Faces[0].ToNurbsSurface()
control_pt = surface.Points.GetControlPoint(0, 0)
rc, u, v, n = surface.Points.UVNDirectionsAt(0, 0)
xform = Rhino.Geometry.Transform.Translation(n * 5.0)
new_pt = Rhino.Geometry.Point3d(control_pt.Location)
new_pt.Transform(xform)
surface.Points.SetPoint(0, 0, new_pt)
scriptcontext.doc.Objects.AddSurface(surface)
scriptcontext.doc.Views.Redraw()
DoSomething()
does this help a bit ? btw. you might as well check out Surface.CreateSoftEditSurface method…
_
c.