Get control points of a surface

When I am trying to get control points from surface as below, it is giving me, control points for untrimmed surface. For example if I have a close polygon and then if I draw a planer surface, I will get 4 corner points of untrimmed surface. I will not get the corner points of polygon. How to get them ? Please help.

           NurbsSurface srf = surface.ToNurbsSurface();
           NurbsSurfacePointList pt_list = surface.ToNurbsSurface().Points;
           int u= pt_list.CountU;
           int v = pt_list.CountV;

        for(int ii=0;ii<u;ii++)
          {
        for(int jj=0;jj<v;jj++)
          {
           ControlPoint pt= pt_list.GetControlPoint(ii, jj);
           pt_list_r.Add(pt.Location);
          }
          }

How to get the real control points of the polygonal planar plan. I guess this is the same way I can get control points for other trimmed surfaces.

What you are seeing are the ‘real’ control points for a surface created in the manner that you describe. You can verify this by running Rhino and making such a surface and then run the PointsOn command to turn on the control points.

If you want to get the polygon points from the surface, you will have to get the edge curves from the owning Brep object and then get the starting and ending point of each curve.

Rhino.Geometry.Brep.Edges
1 Like

Dear Dale, I have many types of surfaces and Breps. I guess what I want is the control point for such irregular surfaces/trimmed surfaces.

This one in the image is a trimmed surface, if I am not wrong.
So I am looking for the actual control points of the trimmed surfaces.

Untrimmed surfaces, which we built by lofting or by network surfaces , they keep the surfaces on the point.

Is there a method to get control points on trimmed surfaces or I have to rebuild the surface as untrimmed?
I always rebuild surface to get the untrimmed surface and then get the control point.

I am wondering , is it the same as before, or is there a new way to find control points of the trimmed surface.

I know in normal cases will need to rebuild the surface as untrimmmed, so I will get the control points only on the surface, not outside. Am I correct ?

Many thanks !

the actual control points of the trimmed surfaces

There is no such thing. Maybe this picture helps in understanding the structure of a BRep (Boundary Representation), which is used to make a trimmed (poly)surface.

You can get the edge curves from Rhino.Geometry.Brep.Edges like @dale said, or the vertices from Rhino.Geometry.Brep.Vertices.

Brep b = surface.ToBrep();
foreach(BrepVertex bv in b.Vertices)
{
    pt_list_r.Add(bv.Location);
}

foreach(BrepEdge be in b.Edges)
{
    pt_list_r.Add(be.PointAtStart);
    pt_list_r.Add(be.PointAtEnd);
}
1 Like

Dear Menno,
I understand brep structure. Looks like I am getting short term memory losses.

I need to be conscious about my head memory.

Many thanks for keeping patience and reply me. Next time I will try to remember before posting any question.
Many thanks!
Best regards