PDA

View Full Version : for loop setAttr help


gauranga108
12-29-2012, 07:33 AM
sel = cmds.ls(s=True)
for i in range(len(sel)):
cmds.setAttr(sel[i]".scaleX", 5)
cmds.setAttr(sel[i]".scaleY", 5)
cmds.setAttr(sel[i]".scaleZ", 5)

I'm trying to loop through a group of selected polygons and set the Attr's.

This doesn't work and I'm not sure why.

Can someone please give me some pointers?

Thanks

ldunham1
12-29-2012, 12:19 PM
quick glance I notice your cmds.ls flag is for shapes? (i believe you want cmds.ls(sl=True)) and your missing + for the variable and string.
try this.
sel = cmds.ls(sl=True)
for i in range(len(sel)):
cmds.setAttr(sel[i]+".scale", 5, 5, 5)

gauranga108
12-29-2012, 07:02 PM
Thank you.

CGTalk Moderation
12-29-2012, 07:02 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.