selectedObject = cmds.ls( selection=True) dagObject = selectedObject[0].split('.')[0] cmds.select(dagObject)
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b36e49be-3d5b-4969-8175-c6468b3acd18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Have a look at passing objectsOnly=True to the ls() function.
--
selectedObject = cmds.ls( selection=True)dagObject = selectedObject[0].split('.')[0]cmds.select(dagObject)
Currently I am able to return the dag object by using a split method, is there a cleaner way of doing this?
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 python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b36e49be-3d5b-4969-8175-c6468b3acd18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/kQmQD76OsXY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0BA1BC98-E165-42B1-832D-C637D77CECE4%40gmail.com.
Hm, that should work. Here’s an example that works for me in Maya 2016.
cmds.file(new=True, force=True)
cmds.polyCube()
cmds.select("pCube1.vtx[0]")
dag_object = cmds.ls(sl=True, objectsOnly=True)
cmds.select(dag_object)
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/kQmQD76OsXY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC8-w9M91HQDbvBnLnE_uRw52nXBS6MbMBmiCRZ9%2BBWNw%40mail.gmail.com.