Array Selection Question

Array Selection Question

Anonymous
Not applicable
442 Views
5 Replies
Message 1 of 6

Array Selection Question

Anonymous
Not applicable
I am trying to figure out a way to incrementally make a random curve grid. With geometry it makes more sense but cv curves I'm running into problems how I would build a base plane on xy, xz, and yz then spacing of the curves. Any suggestions or hints would be wonderful.

~Jon
0 Likes
443 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Ive figured out how to do what I initially had posted but now I'm running into array selection issues. Basically I will have 3 dimensions of squiggles which are placed in 3 separate mel files so when ran you get a grid.

My issue is how to select just the curves being created where the loops will not interfere with the new set of curves when later duplicated. A string such as string $selectZ[] = `ls -dag -lf -ap -o`; works fine for one selection then obviously the next set reads and duplicates all the dag objects in the scene.

Here's a snippet of the top part of the script.

BTW the 3 scripts will make squiggly lines on the x y and z axis forming a grid and has settings for spacing as well. The selection of the beginning part of the script needs to select all the curves created then I will be able to implement this with the rest of the code so the selection is based just on the current selection, not all the dag objects in the scene.

Still learning arrays so any suggestions will be helpful.


global proc js_squigglyGridZ (int $cvCountZ, int $curveCountZ)
{

int $j;
int $i;
//string $myCurvesX[];


for&#40;&#36;j = 0; &#36;j < &#36;curveCountZ; &#36;j++&#41;
{
string &#36;curveZ = "curve ";


for &#40;&#36;i = 0; &#36;i < &#36;cvCountZ; &#36;i++&#41;
{
&#36;curveZ = &#36;curveZ + "-point " + &#36;i + " " + rand&#40;-.2, 1&#41; + " " + rand&#40;-.4, .5&#41; + " ";

}
evalEcho&#40;&#36;curveZ&#41;
rotate -r -os 0 -90 0 ;
//string &#36;selectZ =size &#40;&#36;curveZ&#41;

//select &#36;selectZ;
}
}
0 Likes
Message 3 of 6

Anonymous
Not applicable
sets are really handy for this kind of task

// first you create a set for the the loop you're currently in
string &#36;currentSet = `sets -name &#40;"set" +&#36;j&#41;`;


// after creating the curve you simply add the current selection to the current set
sets -add &#36;currentSet;


// and you can select the members of the set simply by selecting the set
// which is conveniently named after the iteration of the loop you were in
select set0;
0 Likes
Message 4 of 6

Anonymous
Not applicable
Ok, maybe I'm not placing the code in the correct spot. Would you mind showing me. I've never used sets before. As is, the script runs and only selects the last curve, and does not rename...
0 Likes
Message 5 of 6

Anonymous
Not applicable
Fixed the selection!
0 Likes
Message 6 of 6

Anonymous
Not applicable
Fixed!
0 Likes