PDA

View Full Version : "Arrays" Problem


codenamejyn
04-10-2004, 05:12 PM
float $my_sizeX = object.boundingBoxSizeX ;
float $my_sizeY = object.boundingBoxSizeY ;
float $my_sizeZ = object.boundingBoxSizeZ ;

float $my_mass= ( $my_sizeX + $my_sizeY + $my_sizeZ ) * 0.1 ;

print ($my_mass);

How do I write a script that would perform that for multiple object selected...

Here is what I tried but failed...Could anyone point where my mistake lies?

string $my_selection [] = `ls -sl` ;

float $my_sizeX [] = object.boundingBoxSizeX ;
float $my_sizeY [] = object.boundingBoxSizeY ;
float $my_sizeZ [] = object.boundingBoxSizeZ ;

float $my_mass [] = ( $my_sizeX + $my_sizeY + $my_sizeZ ) *0 .1 ;

print ($my_mass);

Thanks in advance.

westiemad
04-10-2004, 07:20 PM
to cycle through everything u have 2 choices

string $selected[] = `ls -sl`;

string $current;

for($current in $selected)
{


or

string $selected[] = `ls -sl`;

for($i=0;$i < size($selected);$i++)
{

you also might want to try something like

float $my_sizeX = `getAttr ($selected[] + ".boundingBoxSizeX")

assuming getattr works with bounding box, and it returns a single value.

AnDy

CGTalk Moderation
01-17-2006, 11:00 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.