SOS: architecture student needs more help
Here I show you one of the procedures that I've created,.. here I'm trying to get the attributes of the nurbs surface (accesibility) in 2 points for each box. This will give them a sign (depending on where the accesibility is higher) and after they will move to the right or the left depending on their sign. (in the X direction)
The boxes are located one next to the other one (in the Z direction) and the value of the accesibility surface (in the Y direction).
In my script I would like to get the attributes of the accesibility in two different point of the X direction. $p should be the position of the box (and it is in the medium point of this one) and I would like to check the accessibility in -6 and +6 from this pont. The value that I should get then,.. It should be different because it's reading a surgace made of curves. But here comes the problem... when I print the values that it is getting,.. they are the same,.. So,. the program it's not reading the surface in a good way,.. and I can not figer out how to do it,.. :-(
I need your help,.. what is it wrong in the $l, and $r?
I should tell you that the surface of accesibility is a nurb with degree UV: 1
Here it goes a part of the script,... and if you need more,.. I can send it to you,...
thank you very much!!!!
pd. maybe it will be useful to know that: $p = getAttr ($name + ".translateX")
proc EkeepInside (int $i, int $ii, int $potentiality, string $name, int $p, int $relativeMovement) {
int $pBL;
$pBL = getAttr ("bL"+$i+".translateX");
int $pBR;
$pBR = getAttr ("bR"+$i+".translateX");
global int $p;
float $l;
float $r;
$l = getAttr ("accesibility.cv["+($p+6)+"]["+$i+"].zValue");
//print ("left"+$name+"_"+$l);
$r = getAttr ("accesibility.cv["+($p-6)+"]["+$i+"].zValue");
//print ("right"+$name+"_"+$l);
int $sign;
if ($l<$r) {
$sign = -1;
}
else if ($l>=$r) {
$sign = 1;
}
int $totalMovement;
$totalMovement = ($p + $sign*$relativeMovement);
int $move;
int $tLength;
$tLength = getAttr ($name+".length");
int $mLength;
$mLength = $tLength/2;
if (($totalMovement + $sign*$mLength)>$pBL) {
$move = ($pBL - $sign*$mLength);
}
else if (($totalMovement + $sign*$mLength)<$pBR ) {
$move = ($pBR - $sign*$mLength);
}
else {
$move = $totalMovement;
}
string $name2;
int $p2;
int $Length2;
int $mLength2;
if (1<$potentiality) {
if ($ii==1){
$name2 = selectShop ($i,($ii+1));
$p2 = getAttr ($name2 + ".translateX");
$Length2 = getAttr ($name2 + ".length");
$mLength2 = $Length2/2;
}
else if ($ii==2){
$name2 = selectShop ($i,($ii-1));
$p2 = getAttr ($name2 + ".translateX");
$Length2 = getAttr ($name2 + ".length");
$mLength2 = $Length2/2;
}
if ((abs($p2-$move))<($mLength2+$mLength)){
if (($p2-$move)<0){
$move = ($move+(($mLength2+$mLength)-(abs($p2-$move))+1));
}
else if (0<=($p2-$move)){
$move = ($move-(($mLength2+$mLength)-(abs($p2-$move))-1));
}
}
}
setAttr ($name+".translateX") $move;
}
$l = getAttr ("accesibility.cv["+($p+6)+"]["+$i+"].zValue"); $r = getAttr ("accesibility.cv["+($p-7)+"]["+$i+"].zValue");