PDA

View Full Version : Smart array makes me stupid


Andrei2k
10-04-2005, 08:01 AM
Hello all, I am using a for loop to create a lot of various pieces of geometry and I need to add the resulting geometry from the array into another array while combining the pieces using the following example:

string $geoPieces[];
int $numberOfPieces = result of other proc1;
for ( $i = 0; $i < $numberOfPieces; $i++ )
{
$geoPieces[$i]= `proc2 result`;
// now at the end i want to make all these different polies into one poly if there X ammount
if ( `size $geoPieces` > 50 )
{
string $singlePoly[] = `polyUnite -ch 0 $geoPieces` ;
}
}


The problem is I keep getting the error "No object matches name:" on the line:
string $singlePoly[] = `polyUnite -ch 0 $geoPieces` ;

Am I using wrong syntax? Can you not combine everything in an array with `polyUnite -ch 0 $geoPieces` ; ?? Thank you in advance

Robert Bateman
10-04-2005, 12:06 PM
string $geoPieces[];
int $numberOfPieces = result of other proc1;
for ( $i = 0; $i < $numberOfPieces; $i++ )
{
$geoPieces[$i]= `proc2 result`;
// now at the end i want to make all these different polies
// into one poly if there X ammount
if ( `size $geoPieces` > 50 )
{
select -r $geoPieces;
string $singlePoly[] = `polyUnite -ch 0` ;
}
}

Andrei2k
10-04-2005, 12:40 PM
thanks but I get the same error."No object matches name:"

If I do this, it works but is not desirable because the select all would limit my usage of the script in an empty file instead of anywhere.

select -r -all;
string $singlePoly[] = `polyUnite -ch 0` ;


I can't see what is going on...

Robert Bateman
10-04-2005, 01:21 PM
proc2 must be to blame.

CGTalk Moderation
10-04-2005, 01:21 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.