Go to: Synopsis. Return value. Related. Flags. Python examples.
polyEvaluate(
[poly poly...]
, [accurateEvaluation=boolean], [area=boolean], [boundingBox=boolean], [boundingBox2d=boolean], [boundingBoxComponent=boolean], [boundingBoxComponent2d=boolean], [displayStats=boolean], [edge=boolean], [edgeComponent=boolean], [face=boolean], [faceComponent=boolean], [format=boolean], [shell=boolean], [triangle=boolean], [triangleComponent=boolean], [uvComponent=boolean], [uvSetName=string], [uvcoord=boolean], [vertex=boolean], [vertexComponent=boolean], [worldArea=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
polyEvaluate is undoable, NOT queryable, and NOT editable.
Returns the required counts on the specified objects.
If no objects are specified in the command line, then the
objects from the active list are used.
In MEL, the values are returned in the same order as the flags are set.
Under Python, there is no concept of argument ordering, so the items are
returned in a dictionary keyed by the name of the flag. In Python, if only
one item is requested, then it will not be returned in a dictionary.
For user convenience, if no flag is set, then all values are echoed.
All flags (except -fmt/format) are in fact query-flags. For
user convenience, the -q flag may be ommitted.
Some comments for non-formatted output :
- 3d bounding boxes are returned as 3 couples of floats,
2d ones as 2 couples of floats.
-
if a bounding box is queried and cannot be computed (for example
the component bounding box when no component is selected, or 2d bounding box for
and unmapped object) 0 is returned for each array element, so that
indices in the output array remain consistent.
-
int values (queried by topological flags) cannot be
mixed with float values (queried by bounding box flags).
Thus if no flag is set, only int values are returned.
Any | a MEL array of values, a Python dictionary, or a string, depending on
the format requested and the language called from. |
polyInfo
accurateEvaluation, area, boundingBox, boundingBox2d, boundingBoxComponent, boundingBoxComponent2d, displayStats, edge, edgeComponent, face, faceComponent, format, shell, triangle, triangleComponent, uvComponent, uvSetName, uvcoord, vertex, vertexComponent, worldArea
Long name (short name) |
Argument types |
Properties |
|
accurateEvaluation(ae)
|
boolean
|
|
|
used to get accurate results for the bounding box computation
For objects with large vertex counts, accurate evaluation takes more time
|
|
area(a)
|
boolean
|
|
|
returns the surface area of the object's faces in local space as a float
|
|
boundingBox(b)
|
boolean
|
|
|
returns the object's bounding box in 3d space
as 6 floats in MEL: xmin xmax ymin ymax zmin zmax, or as
a tuple of three pairs in Python: ((xmin,xmax), (ymin,ymax), (zmin,zmax))
|
|
boundingBox2d(b2)
|
boolean
|
|
|
returns the object's uv bounding box (for the current map if one is not specified) in 2d space
as 4 floats in MEL : xmin xmax ymin ymax, or as
a tuple of three pairs in Python: ((xmin,xmax), (ymin,ymax), (zmin,zmax))
|
|
boundingBoxComponent(bc)
|
boolean
|
|
|
returns the bounding box of selected components in 3d space
as 6 floats in MEL : xmin xmax ymin ymax zmin zmax, or as
a tuple of three pairs in Python: ((xmin,xmax), (ymin,ymax), (zmin,zmax))
|
|
boundingBoxComponent2d(bc2)
|
boolean
|
|
|
returns the bounding box of selected uv coordinates in 2d space
as 4 floats in MEL : xmin xmax ymin ymax, or as
a tuple of two pairs in Python: ((xmin,xmax), (ymin,ymax))
|
|
displayStats(ds)
|
boolean
|
|
|
toggles the display of poly statistics for the active View.
All other flags are ignored if this flag is specified (Obsolete
- refer to the headsUpDisplay command)
|
|
edge(e)
|
boolean
|
|
|
returns the number of edges as an int
|
|
edgeComponent(ec)
|
boolean
|
|
|
returns the object's number of selected edges as an int
|
|
face(f)
|
boolean
|
|
|
returns the number of faces as an int
|
|
faceComponent(fc)
|
boolean
|
|
|
returns the object's number of selected faces as an int
|
|
format(fmt)
|
boolean
|
|
|
used to display the results as an explicit sentence
|
|
shell(s)
|
boolean
|
|
|
returns the number of shells shells (disconnected pieces) as an int
|
|
triangle(t)
|
boolean
|
|
|
returns the number of triangles as an int
|
|
triangleComponent(tc)
|
boolean
|
|
|
returns the number of triangles of selected components as an int
|
|
uvComponent(uvc)
|
boolean
|
|
|
returns the object's number of selected uv coordinates as an int
|
|
uvSetName(uvs)
|
string
|
|
|
used when querying texture vertices to specify the uv set. If a uv set
is not specified then the current map for the object will be used
|
|
uvcoord(uv)
|
boolean
|
|
|
returns the number of uv coordinates (for the current map if one is
not specified) as an int
|
|
vertex(v)
|
boolean
|
|
|
returns the number of vertices as an int
|
|
vertexComponent(vc)
|
boolean
|
|
|
returns the object's number of selected vertices as an int
|
|
worldArea(wa)
|
boolean
|
|
|
returns the surface area of the object's faces in world space as a float
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
import maya.cmds as cmds
cmds.polyPlane( n='plg', sx=4, sy=4, w=5, h=5 )
cmds.select( 'plg.f[2]', 'plg.f[4]' )
# query the number of faces
cmds.polyEvaluate( f=True )
# Result: 16
# query the number of triangles
cmds.polyEvaluate( t=True )
# Result: 32
# query the number of selected faces
cmds.polyEvaluate( faceComponent=True )
# Result: 2
# query the number of vertices and faces
cmds.polyEvaluate( v=True, f=True )
# Result: {'vertex': 25, 'face': 16}
# formatted query of the number of vertices and faces
cmds.polyEvaluate( v=True, f=True, fmt=True )
# Result: "face=16 vertex=25"
# query all
cmds.polyEvaluate()
# Result: {'vertexComponent': 0, 'shell': 1, 'triangle': 32, 'faceComponent': 2, 'vertex': 25, 'face': 16, 'triangleComponent': 0, 'edge': 40, 'uvcoord': 25, 'uvComponent': 0, 'edgeComponent': 0}
#formatted query of all information
cmds.polyEvaluate( fmt=True )
# Result: vertex=25 edge=40 face=16 uvcoord=25 triangle=32 shell=1
# vertexComponent=0 edgeComponent=0 faceComponent=2 uvComponent=0
# boundingBox= X[-2.50,2.50] Y[0.00,0.00] Z[-2.50,2.50]
# boundingBoxComponent= X[-2.50,1.25] Y[0.00,0.00] Z[0.00,2.50]
# boundingBox2d= U[0.00,1.00] V[0.00,1.00]
# boundingBoxComponent2d= U[0.00,0.75] V[0.00,0.50]
# area=25.00 worldArea=25.00
# accurate bounding box evaluation
cmds.polyCylinder( r=1, h=2, sx=20, sy=1, sz=1, ax=(0, 1, 0), tx=1, ch=1 )
# Result: pCylinder1 polyCylinder1 #
cmds.rotate( 38.340875, 0, 0, r=True, os=True )
cmds.rotate( 0, 0, -36.177835, r=True, os=True )
cmds.polyEvaluate( b=True )
# Result: ((-1.3974823703620598, 1.39748217791327), (-1.7164316223605844, -1.7164316223605844), (-1.6512467204212007, 1.6512465272260637)) #
cmds.polyEvaluate( b=True, ae=True )
# Result: ((-1.3974823951721191, 1.39748215675354), (-1.4071073532104492, -1.4071073532104492), (-1.3598332405090332, 1.3598330020904541)) #
# Local and World Space Area
cmds.polyCube( w=1, h=1, d=1, sx=1, sy=1, sz=1, ax=(0, 0, 1), cuv=1, ch=1 )
cmds.setAttr( 'pCube1.scaleY', 2 )
cmds.polyEvaluate( a=True )
# Result: 6
cmds.polyEvaluate( wa=True )
# Result: 10