Solved it! I need to define the transform node[0] to the variable called 
dupObj.   *dupObj = mc.duplicate(masterGroup)[0]*   Once that was done 
setAttr knew what it had to operate on. 

On Friday, September 15, 2017 at 11:11:47 AM UTC-7, jettam wrote:
>
> I am confused,  If I remove the part that says  mc.setAttr(dupObj+
> ".translate",trX,trY,trZ,type="double3")    I will get 10 duplicates of 
> my object. But if I add back in I only get 2 duplicates?   Could someone 
> explain whats going on here. 
>
>
>
>
>
> def makeStairs(number=10):
>     import random    
>     
>     if number >= 1:
>         masterGroup = mc.group(empty=True, name='MasterGroup')
>         for x in range (10):
>             step = mc.polyCube(name='TED_'+str((x)+1))
>             mc.parent(step[0], masterGroup)
>             print 'making step_' + str((x)+1)
>         stepsAreReady = (1)
>         
>     if stepsAreReady == (1) :
>         trX = random.uniform (-30,30)
>         trY = random.uniform (-30,30)
>         trZ = random.uniform (-30,30)
>         # duplicate and position steps #
>         for x in range (number):
>             dupObj = mc.duplicate(masterGroup)
>             mc.setAttr(dupObj+".translate",trX,trY,trZ,type="double3")
>             print "duplicate and position steps"
>             
>     else:
>         print 'Dont make stairs'
>
>
>
>
> makeStairs(10)
>
>

-- 
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/4fd2dedd-20d3-45d2-b892-a5027817ab0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to