pymel.core.modeling.polyAverageNormal

static modeling.polyAverageNormal(*args, **kwargs)

Set normals of vertices or vertex-faces to an average value when the vertices within a given threshold. First, it sorts out the containing edges, and set them to be soft, if it is possible, so to let the normals appear to be merged. The remained components then are sorted into lumps where vertices in each lump are within the given threshold. For all vertices and vertex-faces, set their normals to the average normal in the lump. Selected vertices may or may not on the same object. If objects are selected, it is assumed that all vertices are selected. If edges or faces are selected, it is assumed that the related vertex-faces are selected.

Flags:
Long name (short name) Argument Types Properties
allowZeroNormal (azn) bool ../../../_images/create.gif
 
Specifies whether to allow zero normals to be created. By default it is false. If it is false, replaceNormal is needed.
distance (d) float ../../../_images/create.gif
 
Specifies the distance threshold. All vertices within the threshold are considered when computing an average normal. By default it is 0.0.
postnormalize (pon) bool ../../../_images/create.gif
 
Specifies whether to normalize the resulting normals. By default it is true.
prenormalize (prn) bool ../../../_images/create.gif
 
Specifies whether to normalize the normals before averaging. By default it is true.
replaceNormalXYZ (xyz) float, float, float ../../../_images/create.gif
 

If the allowZeroNormalis false, this value is used to replace the zero normals. By default it is (1, 0, 0). Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.polyAverageNormal

Example:

import pymel.core as pm

# To average normals when they are within 0.2 distance.
pm.polyAverageNormal( distance=0.2 )
# To average normals when they are within 0.2 distance.
# Normalize the normals before computing the average.
pm.polyAverageNormal( distance=0.2, prenormalize=True )
# To averge normals when they are within 0.2 distance. Do not
# normalize the normals before computing the average (so to get weighted
# average). But do normalize the resulting normal.
pm.polyAverageNormal( distance=0.2, postnormalize=True )
# To average normals when they are within 0.2 distance. Do not
# allow zero normal and replace zero normal with (1 0 0).
pm.polyAverageNormal( distance=0.2, allowZeroNormal=False, replaceNormalXYZ=(1,0,0) )

Previous topic

pymel.core.modeling.polyAutoProjection

Next topic

pymel.core.modeling.polyAverageVertex

Core

Core Modules

Other Modules

This Page