In my Maya scene, I have a set that contains objects a, b and c.
I run this:
import maya.cmds as cmds
curSel = cmds.select ('set1')
print curSel
it selects the set's members correctly as stated in Maya's Documentation page. There it literally says "# the following selects all the members of set1".
Please bear with me, I'm trying to learn, but the looking through the search results is like navigating through a forest of excessive tangential info, that doesn't really help much.
while I have managed to make use of the selection, I need clarification on understanding why is print curSel returning "none"? Is there a listing concept that I missing? Thanks!
You can run cmds.select
on any object, be that a set or a mesh, and it will always return None
. Even in the documentation it says:
Return Value:
None
So in this case you can use cmds.ls(sl = True, l = True)
after the select command to store the objects in a variable.
Or if you are just trying to get objects that are in a set you don't have to bother selecting them at all and use cmds.sets('set1', q = True)
, which will give you a list of the objects.