SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Query an objects attribute
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 19-09-2005, 07:12 PM   #1
mayakid14
Registered User
 
mayakid14's Avatar
 
Join Date: Nov 2004
Location: Florida
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?
__________________
I hope you didn't waste your time reading this line.
mayakid14 is offline   Reply With Quote
Old 20-09-2005, 08:54 AM   #2
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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;




A
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 20-09-2005, 12:52 PM   #3
mayakid14
Registered User
 
mayakid14's Avatar
 
Join Date: Nov 2004
Location: Florida
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Thanks you've been a big help.
__________________
I hope you didn't waste your time reading this line.
mayakid14 is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem solving many dynamic objects in a pile? rohiniduggal Dynamics & Special Effects 3 14-01-2011 06:26 PM
Strange Problem - Unable to change attributes for multiple objects anthonysw3 Technical Issues 4 04-12-2010 10:56 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.