pymel.core.modeling.polyReduce

polyReduce(*args, **kwargs)

Simplify a polygonal object by reducing geometry while preserving the overall shape of the mesh. The algorithm for polyReduce was changed in 2014 to use a new algorithm derived from Softimage. However, the command still defaults to using the old algorithm for backwards compatibility. Therefore, we recommend setting the version flag to 1 for best results as the new algorithm is better at preserving geometry features. Additionally, some flags only apply to a specific algorithm and this is documented for each flag.

Flags:
Long name (short name) Argument Types Properties
border (b) float  
   
caching (cch) bool ../../../_images/create.gif ../../../_images/edit.gif
 
Toggle caching for all attributes so that no recomputation is needed
cachingReduce (cr) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Cache intermediate reductions for speed at the expense of memory. It is recommended that caching be enabled when using the new algorithm. (-version 1) However, caching is not recommended when using then old algorithm because it can cause stability issues.C: Default is false.Q: When queried, this flag returns a boolean.

colorWeights (cwt) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag only applies when using the old algorithm and is provided for backwards compatibility. How much consideration vertex color is given in the reduction algorithm. A higher weight means the reduction will try harder to preserve vertex coloring.C: Default is 0.Q: When queried, this flag returns a float.

compactness (com) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag only applies when using the old algorithm and is provided for backwards compatibility. Tolerance for compactness for the generated triangles A value of 0 will accept all triangles during decimation A value close to 0 will attempt to eliminate triangles that have collinear edges (zero area triangles) A value closer to 1 will attempt to eliminate triangles that are not strictly equilateral (of equal lengths) The closer to 1.0, the more expensive the computationQ: When queried, this flag returns a float.

constructionHistory (ch) bool ../../../_images/create.gif ../../../_images/query.gif
 

Turn the construction history on or off (where applicable). If construction history is on then the corresponding node will be inserted into the history chain for the mesh. If construction history is off then the operation will be performed directly on the object.Note:If the object already has construction history then this flag is ignored and the node will always be inserted into the history chain.

detail (d) float  
   
geomWeights (gwt) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag only applies when using the old algorithm and is provided for backwards compatibility. How much consideration vertex positions are given in the reduction algorithm. A higher weight means the reduction will try harder to preserve geometry.C: Default is 1.Q: When queried, this flag returns a float.

invertVertexWeights (iwt) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag controls how weight map values are interpreted. If true, a vertex weight of 1.0 means a vertex is unlikely to be reduced. If false, a vertex weight of 0.0 means a vertex is unlikely to be reduced. This flag only applies when using the new algorithm. (-version 1)C: Default is true.Q: When queried, this flag returns a boolean.

keepBorder (kb) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
If true, reduction will try to retain geometric borders and the border of the selection.C: Default is true.Q: When queried, this flag returns a boolean.
keepBorderWeight (kbw) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If keepBorder is on, this flag specifies the weight to assign to borders. Setting this value to 0 will disable border preservation and a value of 1 will exactly preserve all border vertices which is useful for matching adjacent meshes. This flag only applies when using the new algorithm. (-version 1)C: Default is 0.5.Q: When queried, this flag returns a float.

keepColorBorder (kcb) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If true, reduction will try to retain color borders. These are determined according to color Ids. This flag only applies when using the new algorithm. (-version 1)C: Default is true.Q: When queried, this flag returns a boolean.

keepColorBorderWeight (kcw) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If keepColorBorder is on, this flag specifies the weight to assign to color borders. Setting this value to 0 will disable color border preservation and a value of 1 will exactly preserve all color borders. This flag only applies when using the new algorithm. (-version 1)C: Default is 0.5.Q: When queried, this flag returns a float.

keepCreaseEdge (kce) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If true, reduction will try to retain crease edges.C: Default is true. This flag only applies when using the new algorithm. (-version 1)C: Default is true.Q: When queried, this flag returns a boolean.

keepCreaseEdgeWeight (cew) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If keepCreaseEdge is on, this flag specifies the weight to assign to crease edges. Setting this value to 0 will disable crease edge preservation and a value of 1 will exactly preserve all crease edges. This flag only applies when using the new algorithm. (-version 1)C: Default is 0.5.Q: When queried, this flag returns a float.

keepFaceGroupBorder (kfb) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If true, reduction will try to retain borders of face groups, which are mostly used to define material assignments. This flag only applies when using the new algorithm. (-version 1)C: Default is true.Q: When queried, this flag returns a boolean.

keepFaceGroupBorderWeight (kfw) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If keepFaceGroupBorder is on, this flag specifies the weight to assign to material borders. Setting this value to 0 will disable group border preservation and a value of 1 will exactly preserve all group borders. This flag only applies when using the new algorithm. (-version 1)C: Default is 0.5.Q: When queried, this flag returns a float.

keepHardEdge (khe) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
If true, reduction will try to retain hard edges.C: Default is true.Q: When queried, this flag returns a boolean.
keepHardEdgeWeight (khw) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If keepHardEdge is on, this flag specifies the weight to assign to hard edges. Setting this value to 0 will disable hard edge preservation and a value of 1 will exactly preserve all hard edges. This flag only applies when using the new algorithm. (-version 1)C: Default is 0.5.Q: When queried, this flag returns a float.

keepMapBorder (kmb) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If true, reduction will try to retain UV borders. A UV border is present if the faces on either side of the edge do not share UV Ids.C: Default is true.Q: When queried, this flag returns a boolean.

keepMapBorderWeight (kmw) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

If keepMapBorder is on, this flag specifies the weight to assign to UV map borders. Setting this value to 0 will disable UV map border preservation and a value of 1 will exactly preserve all UV borders. This flag only applies when using the new algorithm. (-version 1)C: Default is 0.5.Q: When queried, this flag returns a float.

keepOriginalVertices (kev) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag only applies when using the old algorithm and is provided for backwards compatibility. If true, vertices will try to retain their original positions and will not be repositioned for optimal shape.NOTE: In the newer algorithm vertices always retain their exact original positions. (though the Ids will change)C: Default is false.Q: When queried, this flag returns a boolean.

keepQuadsWeight (kqw) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag controls how much consideration is given to oreserving quad faces during reduction. A higher weight means the reduction will try harder to keep quad faces and avoid creation of triangles. If the version flag is set to 1 (-version 1) and the keepQuadsWeight flag is set to 1.0 then a special quad reduction algorithm is used that does a better job of preserving quads. Howver, this special quad reduction algorithm does not support symmetry so those flags will be ignored when the keepQuadsWeight flag is set to 1.0.C: Default is 0.Q: When queried, this flag returns a float.

line (l) float  
   
name (n) unicode ../../../_images/create.gif
 
Give a name to the resulting node.
nodeState (nds) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Defines how to evaluate the node. 0: Normal1: PassThrough2: Blocking3: Internally disabled. Will return to Normal state when enabled4: Internally disabled. Will return to PassThrough state when enabled5: Internally disabled. Will return to Blocking state when enabledFlag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

percentage (p) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag specifies how many vertices to remove during reduction as a percentage of the original mesh. This flag only applies if the termination flag is set to 0 or when using the old algorithm.C: Default is 0. 100 will remove every possible vertex, 0 will remove none.Q: When queried, this flag returns a float.

preserveTopology (top) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

this flag guarantees that the topological type will be preserved during reduction. In particular, if the input is manifold then the output will be manifold. This option also prevents holes in the mesh from being closed off. This flag only applies when using the new algorithm. (-version 1)C: Default is true.Q: When queried, this flag returns a boolean.

replaceOriginal (rpo) bool ../../../_images/create.gif
 

Create “in place” (i.e., replace) (not available in all commands). NOTE: This flag is intended for use by the “Reduce” menu item. If ‘polyReduce -rpo 0’ is executed from the command line, Shader information will not be copied from the original mesh to the result.

sharpness (shp) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Sharpness controls the balance between preserving small, sharp details versus larger shapes. At low values, details that are small relative to the general shape of the object are more likely to be collapsed. At high values, they are more likely to be kept. This flag only applies when using the new algorithm. (-version 1)C: Default is 0.Q: When queried, this flag returns a float.

symmetryPlane (sym) float, float, float, float  
   
symmetryPlaneW (sw) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

W value of the symmetry plane. This flag only applies when using the new algorithm (-version 1) and the useVirtualSymmetry flag is set to 2.C: Default is 0.Q: When queried, this flag returns a float.

symmetryPlaneX (sx) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

X value of the symmetry plane. This flag only applies when using the new algorithm (-version 1) and the useVirtualSymmetry flag is set to 2.C: Default is 0.Q: When queried, this flag returns a float.

symmetryPlaneY (sy) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Y value of the symmetry plane. This flag only applies when using the new algorithm (-version 1) and the useVirtualSymmetry flag is set to 2.C: Default is 0.Q: When queried, this flag returns a float.

symmetryPlaneZ (sz) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Z value of the symmetry plane. This flag only applies when using the new algorithm (-version 1) and the useVirtualSymmetry flag is set to 2.C: Default is 0.Q: When queried, this flag returns a float.

symmetryTolerance (stl) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Tolerance to use when applying symmetry. For each vertex of the mesh, we find its exact symmetric point, then we look for the closest vertex to the exact symmetry up to the tolerance distance. Higher values risk finding more spurious symmetries, lower values might miss symmetries. The value is distance in object space. This flag only applies when using the new algorithm (-version 1) and the useVirtualSymmetry flag is not set to 0.C: Default is 0.Q: When queried, this flag returns a float.

termination (trm) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag specifies the termination condition to use when reducing the mesh. This flag only applies to the new algorithm. (-version 1)0 Percentage1 Vertex count2 Triangle countC: Default is 0.Q: When queried, this flag returns an integer.

triangleCount (tct) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag specifies a target number of triangles to retain after reduction. Note that other factors such as quad and feature preservation may take precendence and cause the actual number of triangles to be different. This flag only applies when using the new algorithm (-version 1) and the termination flag is set to 2.C: Default is 0.Q: When queried, this flag returns an integer.

triangulate (t) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag only applies when using the old algorithm and is provided for backwards compatibility. This attribute specifies if the geometry or the selected faces has to be triangulated, before performing reduction.C: Default is true.Q: When queried, this flag returns a boolean.Common flags

useVirtualSymmetry (uvs) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag controls whether symmetry is preserved during the reduction. This flag only applies when using the new algorithm (-version 1) and the keepQuadsWeight flag is less than 1.0.0 No symmetry preservation1 Automatic. Try to find suitable symmetry during reduction.2 Plane. Specify a symmetry plane to use during reduction.C: Default is 0.Q: When queried, this flag returns an integer.

uvWeights (uwt) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag only applies when using the old algorithm and is provided for backwards compatibility. How much consideration uv positions are given in the reduction algorithm. A higher weight means the reduction will try harder to preserve uv positions.C: Default is 0.Q: When queried, this flag returns a float.

version (ver) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Version of the poly reduce algorithm to use.0 Old algorithm used in Maya 2013 and prior for backwards compatibility1 New algorithm derived from Softimage and used in Maya 2014 and laterThe default is 0 for backwards compatibility but for best results it is recommended that the new algorithm is used as it is better at preserving mesh details. Some flags only apply to a specific algorithm and this is documented for each flag.C: Default is 0 for backwards compatibility.Q: When queried, this flag returns an integer.

vertexCount (vct) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag specifies a target number of vertices to retain after reduction. Note that other factors such as quad and feature preservation may take precendence and cause the actual number of vertices to be different. This flag only applies when using the new algorithm (-version 1) and the termination flag is set to 1.C: Default is 0.Q: When queried, this flag returns an integer.

vertexMapName (vmp) unicode ../../../_images/create.gif ../../../_images/query.gif
 

Name of a color set to be added to the output mesh that stores a mapping from vertices in the output mesh to vertices in the input mesh. The color set is RGB. The original vertex Id that maps to an output vertex is of a vertex is 65536*r + g where r and g are the red and green channel at a vertex. The blue channel is always zero. Each vertex in the output mesh has a shared color. This flag only applies when using the new algorithm. (-version 1)Q: When queried, this flag returns a string.

vertexWeightCoefficient (vwc) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag specifies a constant value to multiply to each weight map value. A value of zero turns off the weight map. This flag only applies when using the new algorithm. (-version 1)C: Default is 1.Q: When queried, this flag returns a float.

weightCoefficient (wc) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

This flag only applies when using the old algorithm and is provided for backwards compatibility. The weight of each vertex is multiplied with this coefficient when the reduction is performed. This value does not have to be edited, normally. It gives finer control over the weighted reduction. This attribute is replaced by vertexWeightCoefficient in the new algorithm when the version flag is set to 1.C: Default is 10000.Q: When queried, this flag returns a float.

Derived from mel command maya.cmds.polyReduce

Example:

import pymel.core as pm

pm.polySphere( ver=1, n='plg' )
pm.polyReduce( ver=1, p=35, 'plg.f[0:399]' )

Previous topic

pymel.core.modeling.polyQueryBlindData

Next topic

pymel.core.modeling.polySelect

Core

Core Modules

Other Modules

This Page