SubD looks weird when move SubDVertex programmatically

Hi,

I have a normal subd as shown in the pic below. I moved one of its vertex in python as follows

vt = subdgeo.Vertices.Find(vtId)
vt.ControlNetPoint = newPt

When the operation finishs, the shape looks weird. But if I manually move other parts of the subd, it gets fixed automatically. I guess I am missing some clean up steps in the code. Can someone point me to the right direction?

Thanks,
v.

before
z
after
x

1 Like

@dale could you help on this?

@pierrec - is this something you can help with?

Hi @vincentfs,

What version of Rhino are you running? In recent versions of Rhino 8 (I think starting from the first commercial release of 8.0), the SubDVertex.ControlNetPoint setter should take care of cleanup for you.

In older versions, you will need to call subdgeo.ClearEvaluationCache() before you add or replace the modified SubD into the document.

If that doesn’t work, or if you are using a recent Rhino 8 version, please share a full example including the 3dm file and the script you are using so I can take a deeper look.

1 Like

I need to make the script compatible for Rhino 7. subdgeo.ClearEvaluationCache() works like a charm. Thanks for your help!

Cheers,
v.

Hi @pierrec, I’m having trouble finding the option to Transform or move a SubdFace in Grasshopper. It seems that SubdFace.Transform(xf) is disabled. Any suggestions?

private void RunScript(
	SubD subd,
	int indexf,
	double m,
	ref object a)
    {
      
var vf = subd.Faces.Find(indexf);
var v=vf.ControlNetCenterNormal;
var xf=Transform.Translation(v*m);
vf.Transform(xf);?????????????disabled 
    subd.ClearEvaluationCache();
    }

Can you please assist me?

now i use this method for vertex only =

private void RunScript(
	SubD subd,
	List<Point3d> pt,
	List<int> index,
	ref object a)
    {

	foreach (var i in index)
	{foreach(var p in pt)
		{var vt = subd.Vertices.Find(i);
vt.ControlNetPoint=p;
	}	
	}
	subd.ClearEvaluationCache();
a=subd;

    }
	
} 

Subd- move cr vertex.gh (24.0 KB)