Secret Maya flags for PolyEvaluate

Tutorial / 24 May 2022

If you're familiar with scripting for Autodesk Maya you've probably used the PolyEvaluate command. This command is useful for getting information on object vertex count, bounding box size, face area, and many other things. To get the vertex count of an object you would use it like this:

vertex_count = cmds.polyEvaluate(vertex=True)

This is the current documentation on PolyEvaluate:

https://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/polyEvaluate.html

However I was looking at some of the scripts that come with Maya and I was surprised to find some flags that aren't in the documentation. 

These flags are:

uvShell ( -us )
activeUVShells ( -aus )
uvsInShell ( -uis )


uvShell Flag

This flag returns the ID numbers of shells associated with selected faces. Here you can see me using the mel version of the command on a cube:

activeUVShells Flag

This flag returns a numbered list of the selected UV shells in a mesh. Here you can see me using the mel version of the command on a cube:

uvsInShell Flag

This returns a list of the uv points in a specified UV shell. You need to specify the UV shell after the flag. The UV shell number is one of the numbers the other commands return. Here you can see me using the mel version on a cube. 

I have found out that these are documented in the pyMel documentation. However I've tested them and they work fine with Mel and normal Python.