Get the top as a single array

I need to get all selected vertices and store them in an array so that I can execute a loop and find out information about each vertex.

Although I can’t figure it out.

sel = cmds.ls(sl=1) print sel 

Return:

 //[u'pCube1.vtx[50:53]', u'pCube1.vtx[74:77]'] 

More or less, I need my sel variable to print:

 pCube1.vtx[50] pCube1.vtx[51] pCube1.vtx[52] pCube1.vtx[53] pCube1.vtx[74] pCube1.vtx[75] pCube1.vtx[76] pCube1.vtx[77] 

Does anyone know how to do this without breaking the column separately? I think this is a very dirty way to get around it and would like to know if there is another possibility! Maybe with the Maya API using OpenMaya?

+4
source share
1 answer

Well, it seems the study has paid off!

 cmds.ls(sl=1, fl=1) 

the 'fl' flag means "Flatten", Flatten returns a list of objects, so that each component is identified individually.

+7
source

All Articles