Hi, This is my first post on the site, although I am a fan and use it often. I am trying to establish an array of named objects that do not overlap with Maya 2008, but when I run this script, I get a error message saying
// Error: line 0: Cannot find procedure "getAttrfloor1unit0.translateX". //
I don't understand why this is happening. I am new to MEL so forgive me if it is an easy solution that I missed but could someone help me out with a suggestion?
CODE
for ($i=0; $i<30; $i++){
for ($i=0; $i<15; $i++){
$name = "floor" + $i + "unit" + $i;
polyCube -w 4 -d 1 -h 1 -name $name;
$rangex = 3;
$rangey = 5;
$sv = 0;
while(true){
$rx = rand(-$rangex,$rangex);
$ry = rand(-$rangey,$rangey);
$overlap = false;
for($j=0; $j<$i; $j++){
$name = "floor" + $i + "unit" + $j;
$px = eval("getAttr" + $name + ".translateX");
$py = eval("getAttr" + $name + ".translateY");
$diffx = abs((float)($rx-$px));
$diffy = abs((float)($ry-$py));
if($diffx < 4. && $diffy < 1.) $overlap = true;
};
if($overlap == false){
move $rx $ry 0;
break;
}
$sv++; if($sv>100){print("not found\n");
break;
}
}
}
select -all;
group;
rotate 0 0 90;
move -r 0 0 -1;
}
Hope you can help!