Wednesday, July 2, 2008

script lattice tool

 








 


polyCube -ch on -o on -sw 3 -sh 3 -sd 3 -cuv 4 ;

rename pCube1 motherobject;

int $iRow = 5;
int $iCol = 5;

for($i=0; $i<$iRow; $i++)
{
for($j=0; $j<$iCol; $j++)
{
$sName = "cell_"+$i+"_"+$j;
select motherobject;
duplicate motherobject;
rename $sName;
setAttr ".t" ($i*2) ($j*2) 0;
}
}

setAttr "motherobject.visibility" 0;
select -r cell_0_0 cell_0_1 cell_0_2 cell_0_3 cell_0_4 cell_1_0 cell_1_1 cell_1_2 cell_1_3 cell_1_4 cell_2_0 cell_2_1 cell_2_2 cell_2_3 cell_2_4 cell_3_0 cell_3_1 cell_3_2 cell_3_3 cell_3_4 cell_4_0 cell_4_1 cell_4_2 cell_4_3 cell_4_4 ;

lattice -divisions 2 2 2 -objectCentered true -ldv 2 2 2 -exclusive "Create new partition";

$iNumVectors = 8;
string $myArray[8] = {"ffd1Lattice.pt[0][0][1]", "ffd1Lattice.pt[0][1][1]", "ffd1Lattice.pt[1][1][1]", "ffd1Lattice.pt[1][0][1]", "ffd1Lattice.pt[0][1][0]", "ffd1Lattice.pt[1][1][0]", "ffd1Lattice.pt[1][0][0]", "ffd1Lattice.pt[0][0][0]" } ;
for ($a = 1; $a <= $iNumVectors; $a++)
{
$ax = rand (1,10);
$ay = rand (1,10);
$az = rand (1,10);
$myObject = $myArray[$a - 1];
select -r $myObject ;
move $ax $ay $az;
}

No comments: