dvelasco
12-15-2012, 05:14 AM
Hello!
I need to create some variables with the eval command on-the-fly, and I must be doing something wrong! If I use "print" instead of eval, it will print exactly what I need (If I executed the printed commands one by one by hand, it would work). However, the command seems to not be interpreting what´s inside. It almost seems like I need to eval again. Is this possible? The script follows:
select -r pSphere1;
global proc stretch (int $div)
{
// cria lattice
string $lat[] = eval ("lattice -divisions 2 " + $div + " 2 -cp -objectCentered true -ldv 2 2 2");
string $latTop[] = `pickWalk -d up`;
CenterPivot;
scale -r 1.2 1.2 1.2 ;
TemplateObject;
// variaveis
string $Clusters = `group -em`;
string $latClusters[];
string $sel[] = `ls -sl`;
// LATTICE -------------------------------------------------
int $latLoop = 0;
int $latLayer = $div - 1;
int $clusterNum = 1;
while ($latLoop < $div)
{
eval ("select -r " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][0] " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][1] ") ;
print ("select -r " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][0] " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][1] \n") ;
eval ("string $C" + $latLoop + "[] = `newCluster \"-relative -envelope 1\"`");
print ("string $C" + $latLoop + "[] = `newCluster \"-relative -envelope 1\"` \n");
eval ("$latClusters[" + $latLoop + "] = $C" + $latLoop + "[0]");
print ("$latClusters[" + $latLoop + "] = $C" + $latLoop + "[0] \n");
print ("Cluster " + $clusterNum + " = \"$C" + $latLoop + "[0]\" \n \n \n");
eval ("select -add " + $Clusters);
parent;
$latLoop = $latLoop + 1;
$latLayer = $latLayer -1;
}
// why does this next line not work? I want it to be a working variable -------------------------------
print $C6[0];
}
stretch 7;
I need to create some variables with the eval command on-the-fly, and I must be doing something wrong! If I use "print" instead of eval, it will print exactly what I need (If I executed the printed commands one by one by hand, it would work). However, the command seems to not be interpreting what´s inside. It almost seems like I need to eval again. Is this possible? The script follows:
select -r pSphere1;
global proc stretch (int $div)
{
// cria lattice
string $lat[] = eval ("lattice -divisions 2 " + $div + " 2 -cp -objectCentered true -ldv 2 2 2");
string $latTop[] = `pickWalk -d up`;
CenterPivot;
scale -r 1.2 1.2 1.2 ;
TemplateObject;
// variaveis
string $Clusters = `group -em`;
string $latClusters[];
string $sel[] = `ls -sl`;
// LATTICE -------------------------------------------------
int $latLoop = 0;
int $latLayer = $div - 1;
int $clusterNum = 1;
while ($latLoop < $div)
{
eval ("select -r " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][0] " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][1] ") ;
print ("select -r " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][0] " + $lat[0] + "Lattice.pt[0:1][" + $latLayer + "][1] \n") ;
eval ("string $C" + $latLoop + "[] = `newCluster \"-relative -envelope 1\"`");
print ("string $C" + $latLoop + "[] = `newCluster \"-relative -envelope 1\"` \n");
eval ("$latClusters[" + $latLoop + "] = $C" + $latLoop + "[0]");
print ("$latClusters[" + $latLoop + "] = $C" + $latLoop + "[0] \n");
print ("Cluster " + $clusterNum + " = \"$C" + $latLoop + "[0]\" \n \n \n");
eval ("select -add " + $Clusters);
parent;
$latLoop = $latLoop + 1;
$latLayer = $latLayer -1;
}
// why does this next line not work? I want it to be a working variable -------------------------------
print $C6[0];
}
stretch 7;
