want to select all objects smaller than a certain size. this code runs, but doesn't do what I want. selects objects in a seemingly random fashion.
Some suspicisions:
- maybe bounding box is not returned in world space?
- maybe (($sizeX + $sizeY + $sizeZ) / 3) is not right.
CODE
float $boxSize;
float $sizeX;
float $sizeY;
float $sizeZ;
float $size;
int $i = "0";
string $node;
string $allNodes[];
string $newNodes[];
$allNodes = selectedNodes
;
for ($node in $allNodes)
{
//$node = $allNodes[0];
$sizeX = getAttr ($node + ".boundingBoxSizeX")
;
$sizeY = getAttr ($node + ".boundingBoxSizeY")
;
$sizeZ = getAttr ($node + ".boundingBoxSizeZ")
;
$size = (($sizeX + $sizeY + $sizeZ) / 3);
print ("size: " + $size);
if ($size < 3)
{
$newNodes[$i] = $node; $i++;
}
}
select -cl;
select $newNodes;