User avatar
By deadalvs
#237217
hey there !

i have this question:

i have to create locators with (each) an annotation of it's actual Y-Coordinate that is updated as the object is moved...

how/where can i write this expression or automate the creation of a locator with this feature ?

thanks a lot !
:D
User avatar
By DrMerman
#237226
Hey man,

Try this :
Code: Select all
//create locator and annotation
         spaceLocator -p 0 0 0 -n "myAnnotatedLocator";
         createAnnotation "Y Value is 0";

//get annotation details
         select -r "myAnnotatedLocator";
         PickWalkDown;PickWalkRight;PickWalkDown;PickWalkRight;
         global string $annoName[];
         $annoName = `ls -sl`;

//start scriptjob to update annotation on locator height change
         int $annoUpdate = `scriptJob -ac myAnnotatedLocator.ty "annoUpdateProc"`;

//reselect locator
         select -r "myAnnotatedLocator";

////////////////////////////////////////////////////////////////////////////////////

//proc to update annotation

global proc annoUpdateProc()
{
global string $annoName[];

//delete old nodes
         delete $annoName[0];
         select -r myAnnotatedLocator;
         PickWalkDown;
         PickWalkRight;
         doDelete;

//get locator height
         float $locatorHeight = `getAttr myAnnotatedLocator.ty`;
         
//create new annotation
         select -r myAnnotatedLocator;
         string $annotationLabel = ("Y Value is " + $locatorHeight);
         createAnnotation $annotationLabel;
         
//reselect locator
         select -r myAnnotatedLocator;
}
Cheers,

Matt :)
User avatar
By deadalvs
#237264
hey !

thanks doc... long time no read... :P

* * *

i tried this and the approach seems nice.

i only have a few problems:

1[
when trying to scale down the locators to 0.01 and move the main locator, it scales back to 1.

2[
after creating a second creator with the same script, the stuff does not work any more... (could be done by correct renaming of course)

ah damn, i'll need lots of locators with the y value displayed... :(

let me think some more.
User avatar
By deadalvs
#237452
ah well. i just named the annotations after their height. i don't have to move them so many times...

anyway thanks for that input.

but i have an other question.

how can i select all the children of an object without the object itself?

le's say there are two curves under a parent node and i have the parent node currently selected...
User avatar
By deadalvs
#237483
ha !
found:

listRelatives -children [nodename];

Hey, I guess maxwell is not going to be updates a[…]

Help with swimming pool water

Hi Choo Chee. Thanks for posting. I have used re[…]