import pymel.core as pm
s  = pm.sphere()[0]
g = pm.group()
g.t.set([5,5,5]) #this is how you set attributes on the node.  In this case
I'm setting the compound translate attr, called by its short name

#other methods are bound to the object from functions available via the
Python API, such as 'setTranslation'
#note the relationship of PyMel node types to corresponding MFn classes: #
http://download.autodesk.com/global/docs/mayasdk2012/en_us/index.html

help(s.setTranslation) # use this to see the kwargs available

#set to 5,5,5 in world space.  In other words, don't move it
s.setTranslation([5,5,5], space='world')
s.t.get() #

#compare this to the following

s.setTranslation([5,5,5], space='object')

s.t.get()


#Have fun! -JP


On Tue, Apr 12, 2011 at 7:35 PM, Chad_Fox <[email protected]> wrote:

> Hi all,
>
> I'm having difficulty figuring out how to get and set transform values
> in world space using pymel. Maybe I'm searching for the wrong terms in
> the docs and google, but so far no luck in figuring this out. If you
> know how to do this I would love to hear from you.
>
> Thank you,
>
> Chad
>
> --
> http://groups.google.com/group/python_inside_maya
>



-- 
John Patrick
404-242-2675
[email protected]
http://www.canyourigit.com

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to