Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm having trouble parenting each item in my range with each item in another range. Just wonder how to parent each new cube with 1 nurbs curve. Sorry I'm really new and this is my second project for school.
import maya.cmds as cmds
#Object Creation
import random
item_count = 50
myScale = random.uniform(0.1,3)
for number in range (item_count):
cube = cmds.polyCube()[0]
cmds.setAttr(cube + '.ty', 0.5)
cmds.setAttr(cube + '.tx', random.uniform(-20,20))
cmds.setAttr(cube + '.ty', random.uniform(-20,20))
cmds.setAttr(cube + '.tz', random.uniform(-20,20))
for number in range (item_count):
ctrl = cmds.circle(nr=(0,1,0))[0]
cmds.setAttr(ctrl + '.ty', 0.5)
cmds.setAttr(ctrl + '.ry', random.uniform(0,360))
for number in range (item_count):
cmds.parent(cube,ctrl)
Solved! Go to Solution.