"Make Selected Curves Dynamic" via python or pymel

1,084 views
Skip to first unread message

charles le guen

unread,
Nov 15, 2011, 11:07:32 PM11/15/11
to python_inside_maya
Hi

Just wondering if anyone here knows the pymel/pythonMaya way to "Make
Selected Curves Dynamic":

Manual recipe to do what I want would be:

1) Draw several curves
2) Select curve1 (only)
3) with curve1 selected, goto [HairMenu]->[MakeSelectedCurvesDynamic]
2) Select curve2 (only)
3) with curve2 selected, goto [HairMenu]->[MakeSelectedCurvesDynamic]
2) Select curve3 (only)
3) with curve3 selected, goto [HairMenu]->[MakeSelectedCurvesDynamic]

The above produces 3 dynamic curves with 3 unizue hair systems and all
the associated connections.

Quick n simple pymel solution aiming to achieve the same result:

1) Draw several curves
2) Select all the curves
3) Run script below:


import pymel.core as pm

for eachIteration in pm.selected():
pm.mel.eval('MakeCurvesDynamic')


The above code results in all three curves being associated with one
hairSystem, whereas I want the option to assign a new hairSystem to
each at creation (which is why I opt to iterate through them).

Any ideas?

Muchas gracias,
C



C

Justin Israel

unread,
Nov 16, 2011, 2:48:17 AM11/16/11
to python_in...@googlegroups.com, python_inside_maya
How about this?

sel = pm.selected()
for eachIteration in sel:
pm.select(eachIteration, r=True)
pm.mel.eval('MakeCurvesDynamic')
pm.select(sel, r=True)

Haven't tested because I'm on my phone.

charles le guen

unread,
Nov 16, 2011, 6:56:48 PM11/16/11
to python_inside_maya
That worked.

Thanks very much Justin!




On Nov 16, 5:48 pm, Justin Israel <justinisr...@gmail.com> wrote:
> How about this?
>
> sel = pm.selected()
> for eachIteration in sel:
>    pm.select(eachIteration, r=True)
>    pm.mel.eval('MakeCurvesDynamic')
> pm.select(sel, r=True)
>
> Haven't tested because I'm on my phone.
>
Reply all
Reply to author
Forward
0 new messages