PDA

View Full Version : select NURBS


fbitonti
12-09-2006, 05:04 PM
I have a ton of nurbs curves in a file each one has been given a different color based on a variety of paramiters. I need to be able to select each of these depending on what color they are at a particular time. The script is working as far as I can tell by printing text at varrious points. however the selection function is not working. The nurbs are all seperate objects and not connected in any way. I have tried it with both the -add and -tgl flag and neither seem to be working. can some one please any information would be awsome.


this is the code i'm workig with.


global proc selectCurvesOne (){

//setup you need to select your nurbs objects in order
//in the outliner select the first one on the list then
//shift select the last one in the sequence.
FEMresultArray;
selFEMresult;
string $FEM_selected[] = `ls -sl`;
$femSize=size($FEM_selected);
global string $stressOne[];
global string $stressTwo[];
global string $stressThree[];
global string $stressFour[];
global string $stressFive[];
global string $stressSix[];
global string $stressSeven[];
global string $stressEight[];
int $a = 0;

for ($i = 0; $i < $femSize; $i++) {

string $FEM_shapeNode[] = `pickWalk -d "down" $FEM_selected[$i]`;
int $FEM_getTheColor = getAttr ($FEM_shapeNode[$i] + ".overrideColor");

//sort edges
if ($FEM_getTheColor == 28){

print "SELECTED!";

select -tgl $FEM_selected[$i];

$a++;
}

}
}

brubin
12-09-2006, 06:03 PM
c'mon people,

you have to read the manuals more closely:
"...The pickWalk command allows you to quickly change the selection list relative to the nodes that are currently selected..."

you can't 'pickwalk' and 'select -add ...' at the same time!
what you realy want to do is 'listRelatives'

also

int $FEM_getTheColor = getAttr ($FEM_shapeNode[$i] + ".overrideColor");

will get you into trouble once the iteration continues up to counts larger than the size of shapeNodes under '$FEM_selected[$i]'.

your code should rather look similar to this:

{
string $FEM_selected[] = `ls -sl`;
$femSize=size($FEM_selected);
select -clear ; // once we know what's selected we don't need to keep it!
for ($i = 0; $i < $femSize; $i++)
{

string $FEM_shapeNode[] = `listRelatives -shapes $FEM_selected[$i]` ;
int $FEM_getTheColor = `getAttr ($FEM_shapeNode[0] + ".overrideColor")` ;
// you're really looking for the first item int the array
// which for most regular cases should suffice;
// although: once you have several shapeNodes or more
// nodes under the transform (=constraints, groupings, rigidBodys???)
// you could run into problems... but to simplify things here ...

//sort edges
if ($FEM_getTheColor == 28)
{

print ("SELECTED \""+$FEM_shapeNode[0]+"\"!\n") ;

select -add $FEM_selected[$i]; // now we can add

// $a++; // what is that for???
}

}
}


HIH
s.

CGTalk Moderation
12-09-2006, 06:03 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.