PDA

View Full Version : Python: setAttr


G.H.O.S.T
03-08-2011, 10:18 AM
Hi all,
how to do this in python?
string $mySelObj[]=`ls -sl`;
setAttr ($mySelObj[0]+".rx") 90;

uiron
03-08-2011, 10:23 AM
from maya import cmds
selection = cmds.ls(sl=True)
cmds.setAttr(selection[0]+".rx",90)

G.H.O.S.T
03-08-2011, 10:38 AM
uiron
Thanks!

mduvekot
03-08-2011, 02:51 PM
or, if you wanted the setAttr to work on all selected objects:


[cmds.setAttr (x+".ry", 45) for x in cmds.ls(sl=True)]

G.H.O.S.T
03-08-2011, 04:05 PM
mduvekot

for in loop :) . Thank you !

CGTalk Moderation
03-08-2011, 04:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.