I'm writing a script to change the position of the vertices created by an extrude command given a specific vector. But I can't find a way to get the newly generated vertices/faces/edges.
I tried looking in cmds.getAttr('polyExtrudeFace1')
or the query mode of cmds.polyExtrudeFacet
, but I can't find the right attribute/flag to get what I need.
When applying cmds.polyExtrudeFacet
onto a mesh, Maya will automatically select the new faces. Knowing this, it's easy to convert the face components to the new vertexes:
cmds.polySphere(name="pSphere1") # Create a sphere to test with.
cmds.polyExtrudeFacet("pSphere1.f[10]") # Extrude a random face.
sel = cmds.polyListComponentConversion(cmds.ls("*.f[*]", sl=True), fromFace=True, toVertex=True) # Convert faces to verts. Filter `ls` to only get face selections.
cmds.select(sel) # Select the newly created vertexes.