Modify Surface using Control Points

    RhinoDoc activeDoc = RhinoDoc.ActiveDoc;
    IEnumerable<RhinoObject> brepObjects = activeDoc.Objects.GetObjectList(ObjectType.Brep);
    RhinoObject object1 = brepObjects.ElementAt(0);
    Brep brepBody = Brep.TryConvertBrep(object1.Geometry);
    BrepFace face1 = brepBody.Faces.ElementAt(1);
    NurbsSurface sur = face1.ToNurbsSurface();
    NurbsSurfacePointList pointlist = sur.Points;
    ControlPoint point = pointlist.ElementAt(1);
    Point3d cpoint = new Point3d(point.X, point.Y, point.Z);
    int countu = pointlist.CountU;//9
    int countv = pointlist.CountV;//2
    pointlist.SetPoint(7, 1, 0, 0, 0);
    A = countv;


Here I have used SetPoint method to set a control point at a given location but the surface havent changed after running the script.
I have a Brepbody and pickedup a surface ->converted it into nurbs surface and want to deform it using control points.
How can I do it ?

latest after this line

you will have a NurbsSurface without any reference to your object1

use AddSurface to see it

To access the surfaces of a Brep see

to get the Surface (Index) that belongs to a face

but I am not sure what happens if you modify the control points of underlaying surfaces - as trimming / curves also need to be updated.

what are you after - your other post / topics point in similar direction like Push/Pull stuff.
maybe it s easier to build a new Brep then modifying an existing one ?

setpoint returns true, how can I access the new surface?

I want to modify the object by accessing control points. So that I can get new surface/model with such squishy adjustments.


you might be able to access the Breps Grips and modify them.
check out this topic:

setPoint returns true…

as fare as i can see you duplicated a face to a surface “sur”.
Then modify it - the relation to the initial Brep is lost.


if you really want to dig into the Brep:
search “build brep from scratch”

and check this for background - another example there…

kind regards -tom

Thank you so much Tom_P, I am trying with the grips. AddSurface worked but it created a new surface.
Will try building breps.

what exactly are you trying to do ?
Maybe handling with vertices of a brep is the wrong approach ?

Simply adding a vertex to a brep to change it s shape is not possible (I guess) because the vertices depend on the typology of the brep.

And please keep your related questions in one place / topic. thx.

kind regards - tom