Get SubD Control Point location based on index with Rhinocommon?

I’m trying to get the location of SubD control points and then move the control point to a new location. I can move it just fine using something like

.SetVertexSurfacePoint(10, New Point3d(1000, 0, 0))

But I’m having a hard time figuring out how to get the position of the control point with a particular index to begin with, say index 10 as in the line of code above.

Basically, I want to cycle through all the control points of a SubD object and apply some logic, moving points as necessary. This is for Rhinocommon (VB). Any tips?

Thank you,
Sam

SubDVertexs have a ControlNetPoint read/write property that you can use to get and set the control net position. The SubDVertex limit surface position is available with SurfacePoint().

To get a SubDVertex from a SubD and a vertex index, use SubD.Vertices.Find(int).

Note that if you are modifying multiple vertices at the same time:

Thanks Pierre, that has got me going!

What I’m doing is dropping the bottom of a shoe last down to a new lower surface representing a sole bottom. Manually in Rhino I can just pull the SubD vertices to the surface and it works great. But for some reason when I’m moving the vertices with Rhinocommon, I get some odd results as shown in the pics below. Any idea what is going on here and how I can fix it?

Still trying to figure this out… Oddly, if I close and open the file, it looks fine. It’s like something needs to be refreshed or something…

Also, if I try to convert it to a brep using .ToBrep, it’s not a valid brep that gets created. I can’t add the brep to the doc. So something about using .SetControlNetPoint to move the vertices of the SubD is causing problems.

Any help appreciated, thanks.

Can you share the code you are using to set the vertices, and which Rhino version you are using? You might be running into the same issue as in this other thread.

As I mentionned above, if you are using SubDVertex.SetControlNetPoint(position, false), you need to call SubD.UpdateSurfaceMeshCache(true) when you are done with the modifications.

1 Like

I was using SubD.UpdateSurfaceMeshCache(false)… switching to true fixed it, thanks!