How to select only Nurbs curves in scene with Python in Maya (without objects in hierarchy)

827 Views Asked by At

Suggest please a method to select all Nurbs curves in the Maya scene using Python. But I must select only curves without any other objects in the hierarchy before or after. For example, I have a hierarchy like this:

Group |NurbsCurve1 |Group |NurbsCurve2...

I've tried this

cmds.ls(et = "nurbsCurve", ni = True, o = True, r = True)

This code selects the whole hierarchy including "Group" But I need to select only NURBS curves without groups in the hierarchy. How can I do this with Python code? Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

figured out how to do it myself

All_curves = cmds.ls(type='nurbsCurve', ni=True, o=True, r=True, l = True)
curves_transforms = cmds.listRelatives(All_curves, p=True, type = "transform")
cmds.select(curves_transforms)

everything works