SetControlNetPoint issue

Hi,
I have a problem when using the ControlNetPoint function on a SubD in C#. I’m probably doing something wrong, but I can’t figure it out.

I found in the discussion that the procedure should be as follows:

  1. Find the “vertex” using SubD.Vertices.Find().
  2. Use the position change SubDVertex.SetControlNetPoint(position, false).
  3. Call SubD.UpdateSurfaceMeshCache(true),
    but nothing happens :frowning:

I did an experiment and called:
doc.Objects.Replace(subdObject.Id, subd);
The change applies, but in “smooth” mode it’s displayed incorrectly. After saving and reopening the file, everything is okay in the smooth mode.

I would appreciate any feedback.

Source code
MyAlignCommand.cs (7.7 KB)

Hi everyone,
I wanted to share the solution to an issue I encountered since no one has replied yet, but I figured it out. In case someone has a similar problem, here’s how I resolved it.

After manipulating the control net point, I added a call to the function subD.ClearEvaluationCache() right after subD.UpdateSurfaceMeshCache(true). This cleared up the artefacts, and everything works smoothly now.

To recap, in my code, I first manipulate the control net point:

  1. lsSubDVertices[i].SetControlNetPoint(pt3dPolygonVertex, false);

Then, once all modifications are ready, I call:

  1. subD.UpdateSurfaceMeshCache(true); // Updates the mesh cache
  2. subD.ClearEvaluationCache(); // Clears the evaluation cache → This line fixed my issue!!!
  3. doc.Objects.Replace(subDObject.Id, subD); // Replaces the original SubD object with the modified one

If anyone knows of a more efficient solution, feel free to share. :blush:

1 Like