View Full Version : cycleCv's + Add Cluster
05 May 2007, 04:51 PM
This is a simple one for MEL Heads, i'm not there yet unfortunatley. I just pop my head up every now and again then remember why I hate it (but love it) :P
Anyway, what i'm doing is have a script that creates two curves, the user can specify how many CV's they want in it, then Clusters are added, one for each "PAIR" of CV's, so the same cluster deforms rail1.cv and rail2.cv for instance.
Because I don't know how many cv's there are going to be, I need a way of cycling the action:
cluster -n clust01 rail1.cv rail2.cv;
adding a 1 value to the cv and the name until there are no-more CV's left...
I know the principal for doing this, but can't seem to work it out, can anyone lend a MEL Hand?
05 May 2007, 05:02 PM
In fact, come to think about it, I'm not sure if I "CAN" make a curve that the user can specify how many CV's should be in it!!! I was thinking it was like a poly or Nurbs plane where you could go into the channel box and up the U count....
The only way I can think of doing it is to have it create a polyplane that the spans are edited, then get the values of each side's vertices, then create a curve along each side using the xform coords, then delete the poly mesh.... Bit long winded...
05 May 2007, 03:59 AM
just have a look at curve command , you will get the idea,
anyway, here is the code that may help you ,
string $cmd = "curve -d 3 ";
$cmd+=("-p "+$x[$i]+" "+$y[$i]+" "+$z[$i]+" ");
you can append -knot flag in curve command if you want to ,
05 May 2007, 09:22 PM
Thanks for that, I'll try it out as soon as I can, too many project deadlines mounting up on me at the moment. I'll let you know how it goes.
05 May 2007, 04:19 PM
There you go:
Select the two curves and run, you can change the num' of Clusters.
int $numOfClusters = 10;
string $myCurves = `ls -sl`;
for ($everyCurve in $myCurves)
rebuildCurve -kr 0 -s $numOfClusters $everyCurve;
cluster -name ("clusterPoint_"+$count) ($myCurves+".cv["+$i+"]") ($myCurves+".cv["+$i+"]")
I forgot to tell ya, the script will rebuild u'r curves so they will have the same number of CVs...
05 May 2007, 04:19 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.