Try assigning your sliced list (curves) to separate variables:

import pymel.core as pm

curves =pm.selected()
masterCurve = curves[0]
slaveCurves = curves[1:]

for crv in curves:
    pm.makeIdentity(crv, apply=True, translate=1, rotate=1, scale=1)

for crv in slaveCurves:    
    pm.parent(crv.getShape(), masterCurve, relative=True, shape=True)
    pm.delete(crv)

It works for me.

Neil

On Thursday, 20 October 2016 04:42:06 UTC+1, Kevin C. Burke wrote:
>
>
>
> Hello,
> I'm trying to write a script for combining multiple NURBS curves. If I 
> scale the curves, then try to combine them, they don't keep their 
> transformations.
>
> import pymel.core as pm
>
> curves = pm.selected()
>
> for curve in curves:
>     pm.makeIdentity(curve, apply=True, translate=1, rotate=1, scale=1)
>
> for curve in curves[1:]:
>     shape = curve.getShape()
>     pm.parent(shape, curves[0], relative=True, shape=True)
>     pm.delete(curve)
>
>
> For some reason, the makeIdentity command (aka Freeze Transformations) 
> won't run before the parent command. I've tried:
>
>    - time.sleep
>    - flushIdleQueue: froze Maya 2016
>    - parenting the transforms to the master transform (curves[0], below) 
>    before running makeIdentity
>
> If I take out the parent command, the makeIdentity works as expected.
>
> I'm running out of ideas. Can anyone help please? Thank you!
>
>
>
> <https://lh3.googleusercontent.com/-OHhLlgUlePI/WAg88lEUfZI/AAAAAAABeGY/gxgDNVlJxJ8pf9ETL77l5ga2fg1dtyDewCLcB/s1600/Capture.PNG>
>
>

-- 
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/9ff2224a-5bdd-49c0-89e2-cb9e4c8e889f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to