Hello everyone. I model a lot of shapes with wide flowing curved surfaces. I already wrote a script to convert my selected poly edge to a curve and automatically rebuild it with a specified number of spans. I do this so that I can have a nice smooth guide to conform my verts to. The problem is that I have to do this manually. I would like to write a script that automaticly snaps each of the selected verts to the closest point on the curve. Problem is I have no earthly idea how that would be done. Any ideas?
btw here is my first script.
global proc UpdateProc ()
{
string $sel[] = `ls -sl`;
rebuildCurve -ch 1 -rpo 1 -rt 0 -end 1 -kr 0 -kcp 0 -kep 1 -kt 0 -s 6 -d 3 -tol 0.01 $sel;
// change -s 6 to -s the number of number of spans you want the curve to be. for example -s 12 will make 12 spans.
}
//start
polyToCurve -form 2 -degree 3;
DeleteAllHistory;
UpdateProc ();
Replies
For scripting your own, you could try the closest point on curve function, and create clusters for your affected vertices. Then constrain the clusters to the point on curve node, I'm not sure how to go directly from vertex > point on curve.
Let me know if you find anything...
There are 3 things I can not find out how to do. I don't know how to output the number of lines in the selection list and I also do not know how to read specific lines in said selection list. I also don't know how to create a cluster deformer on a specific item command. The CreateCluster command just assumes it should created 1 deformer on all selected items. Anyone know how to any of that or am I WAY off with how it should be done?
string $verts[] = `ls -sl`; print $verts;
$verts[$i] refers to the current iteration in the index of $verts for creating both the cluster node and the cluster handle (its transform). You can see that with just $verts, it creates a single handle. if you add a "print $vertCluster;" you can see the makeup of that array, where it's been created as cluster/clusterhandle. But what I don't understand why this numbering starts at 1 instead of 0, maybe someone else can answer that? (e: oh yes i do. it's because when using name#, numbering starts at 1.)