I am trying to get all 50 instances to go into the instanceGroup. But for
some I am only getting one instance object in to the group. Could someone
help me with this. Why is my script not nesting all 50 instance into the
group?
import maya.cmds as cmds
import random
random.seed (1234)
result = cmds.ls(orderedSelection=True)
instanceGroup = cmds.group(empty=True, name='Grp_Inst_%s' % (result[0]))
for i in range(0,50):
instObject = cmds.instance(result, name='%s_inst' % (result[0]))
*cmds.parent(instObject, instanceGroup)*
x=random.uniform(-10,10)
y=random.uniform(0,20)
z=random.uniform(-10,10)
cmds.move(x,y,z,instObject)
rotX=random.uniform(0,360)
rotY=random.uniform(0,360)
rotZ=random.uniform(0,360)
cmds.rotate(rotX,rotY,rotX,instObject)
uniformScale=random.uniform(.4,1.4)
uniformScale=random.uniform(.4,1.4)
uniformScale=random.uniform(.4,1.4)
cmds.scale(uniformScale,uniformScale,uniformScale,instObject)
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/6b1438cc-4f10-4143-aea4-74600075f5bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.