can I make and transform in one line

15 views
Skip to first unread message

jettam

unread,
Oct 11, 2017, 5:02:09 PM10/11/17
to Python Programming for Autodesk Maya
Is there a way to make an object and transform it in the same line. 
Along these lines. 

mc.polyCube(name="Bob",(.setAttr(t=10,5,6,) ) 

Michael Boon

unread,
Oct 11, 2017, 11:44:28 PM10/11/17
to Python Programming for Autodesk Maya
It's pretty weird-looking, but this works:
setAttr(cmds.polyCube(name="Bob")[0]+'.t', (10,5,-6))

I'm not sure what your real requirement is, but to get it on one line I'd be happier using a semicolon:
bob = cmds.polyCube(name="Bob")[0]; cmds.setAttr(bob+'.t', 10,5,7)

(I'm using cmds instead of mc, but I think it's the same thing)
Reply all
Reply to author
Forward
0 new messages