Hey, trying to create a radial pattern with a sphere in Python, but somehow 
I am missing the last sphere.

[image: sphere.png]

As you can see by the image and code below, I am trying to distribute 7 
spheres in 180 degrees. If I set it to 360 degrees works fine as it already 
has the last point, the first sphere. But if I set it to 90 or 180 for 
example, it misses the last sphere. I need to somehow add this last sphere, 
but not sure how.

Increasing the number of spheres (max_iterations) won't do the trick as it 
will distribute one more object within a similar radius.

btw, this can easily be done with MASH and duplicate special, but I need 
this in python.
Thank you.

    import maya.cmds as cmds

    degrees = 180
    max_iterations = 7

    for i in range(max_iterations):
        #print (i)
        rotation = (degrees/max_iterations) * i
        #print(rotation)
        my_sphere = cmds.polySphere(r=0.15)
        cmds.move(2,my_sphere, x=1 , absolute=1)   
        cmds.move( 0,0,0, [ my_sphere[0]+'.scalePivot', 
my_sphere[0]+'.rotatePivot' ], xyz=1, absolute=1 )
        
        cmds.rotate(rotation, my_sphere, y=1)

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/32352ddd-7840-4e3a-a0da-194d7410b28bn%40googlegroups.com.

Reply via email to