Hey guys-
I am looking to create a script that deletes duplicates based on exactWorldBoundingBox. So Far so good, I am sure it sould be much shorter, but here goes... I need to redefine the variable: $objs, each time it loops, but I get an error the the first object no longer exists because it deleted it. I am unsure of where to redefine the variable in the loop. Any help would be great.
CODE
string $objs[];
{
$objsTemp = ls -type mesh
;
$objs = $objsTemp;
$objsSize = size ($objs);
for ($u = 0; $u < $objsSize; $u++){
select -r $objs;
select -d $objs[$u];
$otherObjs = `ls -sl -fl`;
$otherObjsSize = size ($otherObjs);
select -r $objs[$u];
float $bb[] = exactWorldBoundingBox
;
float $rpX = (( $bb[ 3 ] - $bb[ 0 ] ) / 2 + $bb[ 0 ] );
float $rpY = (( $bb[ 4 ] - $bb[ 1 ] ) / 2 + $bb[ 1 ] );
float $rpZ = (( $bb[ 5 ] - $bb[ 2 ] ) / 2 + $bb[ 2 ] );
float $rp[3];
$rp[0] = $rpX;
$rp[1] = $rpY;
$rp[2] = $rpZ;
for ($y = 0; $y < $otherObjsSize; $y++){
select -r $otherObjs[$y];
float $bb[] = exactWorldBoundingBox
;
float $rpX = (( $bb[ 3 ] - $bb[ 0 ] ) / 2 + $bb[ 0 ] );
float $rpY = (( $bb[ 4 ] - $bb[ 1 ] ) / 2 + $bb[ 1 ] );
float $rpZ = (( $bb[ 5 ] - $bb[ 2 ] ) / 2 + $bb[ 2 ] );
float $rp2[3];
$rp2[0] = $rpX;
$rp2[1] = $rpY;
$rp2[2] = $rpZ;
if ( $rp[0] == $rp2[0]){
if ( $rp[1] == $rp2[1]){
if ( $rp[2] == $rp2[2]){
delete $otherObjs[$y];
}
}
}
}
}
$objsTemp =ls -type mesh
;
}
Hope that is kinda clear
I have done this before, but can't seem to figure it out. I know this is really basic, but hey...
Thanks
Sheriif