Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Array Selection Question
  RSS 2.0 ATOM  

Array Selection Question
Rate this thread
 
38748
 
Permlink of this thread  
avatar
  • jsells20
  • Posted: 15 January 2010 07:27 AM
  • Location: Savannah
  • Total Posts: 39
  • Joined: 08 December 2008 10:40 AM

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



Replies: 0
avatar
  • jsells20
  • Posted: 17 January 2010 03:07 PM

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 $cvCountZint $curveCountZ)
{

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


for($j 0$j $curveCountZ$j++)
{
 string $curveZ 
"curve ";

      
 for 
($i 0$i $cvCountZ$i++)
{                              
 $curveZ 
$curveZ "-point " $i " " rand(-.21) " " rand(-.4.5) " ";

 
}
evalEcho($curveZ)
rotate 
--os 0 -90 0 ;
//string $selectZ =size ($curveZ)

//select $selectZ;
        
}
}


Replies: 0
avatar
  • THNKR
  • Posted: 18 January 2010 01:45 AM

sets are really handy for this kind of task

// first you create a set for the the loop you’re currently in
string $currentSet = `sets -name ("set" +$j)`;

// after creating the curve you simply add the current selection to the current set
sets -add $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;



Replies: 0
avatar
  • jsells20
  • Posted: 18 January 2010 08:38 AM

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…



Replies: 0
avatar
  • jsells20
  • Posted: 18 January 2010 02:56 PM

Fixed the selection!



Replies: 0
avatar
  • jsells20
  • Posted: 20 January 2010 07:34 AM

Fixed!



Replies: 0