Curves to Guides with Python/MEL

Curves to Guides with Python/MEL

Anonymous
Not applicable
931 Views
1 Reply
Message 1 of 2

Curves to Guides with Python/MEL

Anonymous
Not applicable

Hi, 
For my current Houdini/Maya project I need a tool for quick conversion of externally generated curves to Xgen.
Import works fine but couldn't figure out a way to convert via Python/MEL. 

 

cmds.xgmMakeGuideDynamic(createFromCurves = True,deleteCurves = False, preserveDynamicLink = False)

Python code above failed with following error message (with Curves selected):

# RuntimeError: No valid modifier node specified.
# XGen: (kFailure): Unexpected Internal Failure #

Thanks

 

 

0 Likes
932 Views
1 Reply
Reply (1)
Message 2 of 2

rmacalusoFCLT4
Explorer
Explorer

I just stumbled on this post.... trying to find the command library for interactive xgen modifier creation... Thanks for the lead :D.

You were so close.... you just need to supply better arguments.

 

cmds.xgmMakeGuideDynamic(curve_list, linearWire_name, createFromCurves = True, deleteCurves = False, preserveDynamicLink = True)

 

I passed a python list of curves, and the linear wire that i wanted to make dynamic guides for. In my case i didnt want to delete the curves, and i wanted to preserve the link, but these obviously are just flags.

 

To get the linearwire:

groomDescriptLinearWires_list = []
attachLinearWire = None
groomDescript = selection[0]
groomDescript_name = groomDescript.split(":")[-1]
groomDescriptShape = cmds.listRelatives(groomDescript, shapes = True, fullPath = True)
if groomDescriptShape:
    groomDescriptShape = groomDescriptShape[0] 
    groomConnections = cmds.listConnections(groomDescriptShape)
    for groomCon in groomConnections:  
        if cmds.nodeType(groomCon) == "xgmModifierLinearWire":
            groomDescriptLinearWires_list.append(groomCon)
if len(groomDescriptLinearWires_list) == 1: 
    attachLinearWire = groomDescriptLinearWires_list[0]

If you haven't solved this I hope this helps.

 

 

0 Likes