View Full Version : Iterate NURBS For Duplicate curve

12 December 2012, 03:58 PM

I have a nurbs surface that I want to run duplicatecurve on through python. When I click the button in maya it works by iterating through all the u parameters of the nurbs and duplicating the curve ( i can see in script editor). How can I do this in python? I was able to figure something out with a sphere I created, which i got the min and max value of the U param, then looped over the value and used the iterator as the u value index number, however when using a non conventional nurbs the u values are like: [0.02],[0.04]...[0.6].. etc.

How can I query/iterate through the nurbs to get the values so i can duplicate it.

min_v_val=cmds.getAttr( 'manipSurface.minValueU' )
max_v_val=cmds.getAttr( 'manipSurface.maxValueU' )

while curve_v_id<max_v_val:
surfaceforcurve='manipSurface.u[%d]' % (curve_v_id)
cmds.duplicateCurve(surfaceforcurve,object=True, local=True, range=False,ch=False)

second question:

I am projecting the curves onto a surface and then need to group again. I am getting the underworld error as the projected curves are locked so I am duplicating them again. If I have them in a list (I added each projected curve to a list when creating it) how can I iterate through them, currently i have to type in the string as shown below because the list index says: 'baseSurface->' not 'baseSurfaceShape' ... Is there a better way of doing this?

cmds.duplicateCurve(str(to_dup),object=True, local=True, range=False,ch=False)



CGTalk Moderation
12 December 2012, 03:58 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.