Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Query an objects attribute (https://simplymaya.com/forum/showthread.php?t=18349)

mayakid14 19-09-2005 07:12 PM

Query an objects attribute
 
Lets say you created an float variable

float $testvar;

then say you create a polygon cube in your scene.

polyCube;
//Result: pCube1

then you wanted to query the value of pCube1's translateY and assign it to the $testvar float attribute.

how do you query the value of a transform's attribute.
like pCube1.ty?

I have been in situations where i had to query the value of other things like UI elements but UI elements like windows already have a flag for querying.

Ex. maybe you ran into one of these before

if((`window -q -exists testwindow`)==true) deleteUI testwindow;

well is there some kind of query flag for transforms also?

Alan 20-09-2005 08:54 AM

it's an attribute so you need to use the getAttr command:

float $ty = `getAttr pCube1.ty`;

that will do it.

to set it use the setAttr command

setAttr pCube1.ty 10;



:ninja:
A

mayakid14 20-09-2005 12:52 PM

:headbang: Dummy....how could i have not fingured that out ....

Thanks you've been a big help.:beer:


All times are GMT. The time now is 09:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018