PDA

View Full Version : cycleCv's + Add Cluster


JellyFire
05-08-2007, 05: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[0] and rail2.cv[0] 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[0] rail2.cv[0];

adding a 1 value to the cv[0] 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?

Thanks
JellyFire

JellyFire
05-08-2007, 06: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...

Any ideas...
JellyFire

vishangshah
05-09-2007, 04:59 AM
hi jellyfire,

just have a look at curve command , you will get the idea,

anyway, here is the code that may help you ,


int $numcv=5,$i=0;
float $x[]={5,6,7,8,9};
float $y[]={1,2,3,1,0};
float $z[]={0,0,0,0,0};
string $cmd = "curve -d 3 ";
for($i=0;$i<$numcv;$i++){
$cmd+=("-p "+$x[$i]+" "+$y[$i]+" "+$z[$i]+" ");
}
eval($cmd);


you can append -knot flag in curve command if you want to ,

:)
Vishang Shah

JellyFire
05-21-2007, 10: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.
Thanks
JellyFire

Sick Spider
05-22-2007, 05: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;
int $i=0;
for ($i=0;$i<=($numOfClusters+3);$i++)
cluster -name ("clusterPoint_"+$count) ($myCurves[0]+".cv["+$i+"]") ($myCurves[1]+".cv["+$i+"]")

EDIT !
I forgot to tell ya, the script will rebuild u'r curves so they will have the same number of CVs...

CGTalk Moderation
05-22-2007, 05: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.