Updating control point locations of existing nurbs surface

Dear all,

I am trying to modify the location of the control points of an existing nurbs-surface within a brep.

foreach(var brep_surface in brep.Value.Faces)
{

var nurbs_surface = brep.Surfaces[brep_surface.SurfaceIndex].ToNurbsSurface();
int u = 0;
int v = 0;
foreach (var control_point in control_points)
{
    var ControlPointID = v * nurbs_surface.Points.CountU + u;

    var nodal_displacements = new double[] {1.0, 0.0, 0.0};
    nurbs_surface.Points.SetPoint(u, v,
        new Rhino.Geometry.Point3d(
            control_point[0] + nodal_displacements[0] * scalingFactor,
            control_point[1] + nodal_displacements[1] * scalingFactor,
            control_point[2] + nodal_displacements[2] * scalingFactor),
        control_point.Value[3]);

    u++;
    if (u >= nurbs_surface.Points.CountU)
    {
        u = 0;
        v++;
    }
}
}

This works fine up to here. However, I do not succeed to update the respective surface within the brep, which results that, I cannot see anything.

(I know that in the given case I could use Transpose, however, for the full example the imposed displacements to vary)

Would anyone have any idea how to update the nurbs-surface, or ideally get the nurbs-surface as a reference that this update would be watertight?

Many thanks for your help :slight_smile:
Tobias

The algorithm I’d use is:

1.) Explode the Brep
2.) Modify the surface(s)
3.) Join the pieces back into a single Brep

– Dale

Thank you very much Dale!

After some “playing around” it seems this is the best way.