pymel.core.modeling.polySelectConstraint

polySelectConstraint(*args, **kwargs)

Changes the global polygonal selection constraints. In query mode, return type is based on queried flag.

Flags:
Long name (short name) Argument Types Properties
angle (a) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on).
anglebound (ab) float, float ../../../_images/create.gif ../../../_images/query.gif
 

min and max angles. The given value should be in the current units that Maya is using. See the examples for how to check the current unit.For vertices : angle between the 2 edges owning the vertex.For edges : angle between the 2 faces owning the edge.

border (bo) bool ../../../_images/create.gif ../../../_images/query.gif
 
If true, selection will be extended to all connected border components so that the whole “loop” is selected.
convexity (c) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(concave) 2(convex).
crease (cr) bool ../../../_images/create.gif ../../../_images/query.gif
 
If true, selection will be extended to all connected creased components.
disable (dis) bool ../../../_images/create.gif
 

Toggles offall constraints for all component types, but leaves the other constraint parameters.This flag may be used together with other ones toggling some constraints on: if so, all constraints are disabled first (no matter the position of the -disable flag in the command line) then the specified ones are activated.

dist (d) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(to point) 2(to axis) 3(to plane).
distaxis (da) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
axis. (Normal to the plane in case of distance to plane).
distbound (db) float, float ../../../_images/create.gif ../../../_images/query.gif
 
min and max distances.
distpoint (dp) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
point. (Axis/plane origin in case of distance to axis/plane).
edgeDistance (ed) int ../../../_images/create.gif
 
Maximum distance (number of edges) to extend the edge selection for “Contiguous Edges” propagate mode. 0 means to ignore the distance constraint.
geometricarea (ga) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on).
geometricareabound (gab) float, float ../../../_images/create.gif ../../../_images/query.gif
 
min and max areas.
holes (h) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(holed) 2(non holed).
length (l) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on).
lengthbound (lb) float, float ../../../_images/create.gif ../../../_images/query.gif
 
min and max lengths.
max2dAngle (m2a) float ../../../_images/create.gif
 
Maximum angle between two consecutive edges in the 2d tangent plane for “Contiguous Edges” propagate mode.
max3dAngle (m3a) float ../../../_images/create.gif
 
Maximum angle between two consecutive edges in 3d space for “Contiguous Edges” propagate mode.
mode (m) int ../../../_images/create.gif ../../../_images/query.gif
 

0(Off) 1(Next) 2(Current and Next) 3(All and Next).Off : no constraints are used at all.Next : constraints will be used to filter next selections.Current and Next : constraints will be aplied on current selection and then used to filter next selections.All and Next : all items satisfying constraints are selected.

nonmanifold (nm) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on)
oppositeEdges (oe) bool  
   
order (order) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on).
orderbound (orb) int, int ../../../_images/create.gif ../../../_images/query.gif
 
min and max orders. number of owning edges.
orient (o) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(orientation) 2(direction).
orientaxis (oa) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
axis.
orientbound (ob) float, float ../../../_images/create.gif ../../../_images/query.gif
 
min and max angles. The given value should be in the current units that Maya is using. See the examples for how to check the current unit.
planarity (p) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(non planar) 2(planar).
propagate (pp) int ../../../_images/create.gif ../../../_images/query.gif
 

0(Off) 1(More) 2(Less) 3(Border) 4(Contiguous Edges).More : will add current selection border to current selection.Less : will remove current selection border from current selection.Border : will keep only current selection border.Contiguous Edges : Add edges aligned with the current edges selected. The direction and number of edges selected is controlled by the -m2a, -m3a, and -ed flags.

random (r) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on).
randomratio (rr) float ../../../_images/create.gif ../../../_images/query.gif
 
ratio [0,1].Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.
shell (sh) bool ../../../_images/create.gif ../../../_images/query.gif
 
If true, selection will be extended to all connected components so that the whole piece of object is selected.
size (sz) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(triangles) 2(quads) 3(nsided).
smoothness (sm) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(hard) 2(smooth).
stateString (sts) bool ../../../_images/query.gif
 
Query only flag. Returns the MEL command that would restore all the current settings.
textured (tx) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(mapped) 2(unmapped).
texturedarea (ta) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(Area specified is unsigned) 2(Area specified is signed).
texturedareabound (tab) float, float ../../../_images/create.gif ../../../_images/query.gif
 
min and max areas.
textureshared (ts) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on). This option will select any uvs on the currentMap which are shared by more than one vertex
topology (tp) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(non triangulatable) 2(lamina) 3(non triangulatable and lamina)
type (t) int ../../../_images/create.gif ../../../_images/query.gif
 
0x0000(none)0x0001(vertex)0x8000(edge)0x0008(face)0x0010(texture coordinates)
visibility (v) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on).
visibilityangle (va) float ../../../_images/create.gif ../../../_images/query.gif
 
angle [0,360].
visibilitypoint (vp) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
point.
where (w) int ../../../_images/create.gif ../../../_images/query.gif
 
0(off) 1(on border) 2(inside).
wholeSensitive (ws) bool ../../../_images/create.gif ../../../_images/query.gif
 
Tells how to select faces : eitherby picking anywhere inside the face (if true)or by picking on the face center marker (if false).

Derived from mel command maya.cmds.polySelectConstraint

Example:

import pymel.core as pm

import maya.cmds as cmds

pm.selectMode( co=True )

# "b"Propagation"/b"

pm.polyPlane( n='plg', w=5, h=5 )
pm.delete( 'plg.f[20:29]' )
pm.selectType( pf=True )
pm.polySelectConstraint( sh=True ) # next mouse selections will propagate to all shell
pm.polySelectConstraint( sh=False )
pm.polySelectConstraint( bo=True ) # next mouse selections will propagate along border
pm.polySelectConstraint( bo=False )
pm.polySelectConstraint( cr=True ) # next mouse selections will propagate to all connected creased components
pm.polySelectConstraint( cr=False )

pm.select( 'plg.f[54:55]' )
pm.polySelectConstraint( pp=1 )
pm.polySelectConstraint( pp=1 ) # to get more and more
pm.polySelectConstraint( pp=1 )
pm.polySelectConstraint( pp=2 ) # to get less
pm.polySelectConstraint( pp=3 ) # to get selection border
pm.delete( 'plg' )

#"b"Properties"/b"

#location
pm.polyPlane( n='plg', w=5, h=5 )
pm.selectType( pv=True )
pm.polySelectConstraint( m=3, t=1, w=1 ) # to get border vertices
pm.polySelectConstraint( m=3, t=1, w=2 ) # to get inner vertices
pm.polySelectConstraint( w=0 ) # turn off location constraint
pm.delete( 'plg' )

#edge smoothness
pm.polyCylinder( n='plg' )
pm.selectType( pe=True )
pm.polySelectConstraint( m=3, t=0x8000, sm=1 ) # to get hard edges
pm.polySelectConstraint( m=3, t=0x8000, sm=2 ) # to get soft edges
pm.polySelectConstraint( sm=0 ) # turn off edge smoothness constraint
pm.delete( 'plg' )

#face size
pm.polyCylinder( n='plg', sz=1 )
pm.delete( 'plg.f[40:59]' )
pm.polyCloseBorder( 'plg.e[27]' )
pm.selectType( pf=True )
pm.polySelectConstraint( m=3, t=8, sz=1 ) # to get triangles
pm.polySelectConstraint( m=3, t=8, sz=2 ) # to get quads
pm.polySelectConstraint( m=3, t=8, sz=3 ) # to get N-sided
pm.polySelectConstraint( sz=0 ) # turn off face size constraint
pm.delete( 'plg' )

#face planarity
#    polyPlane -n plg -w 5 -h 5; polyMoveVertex -ltz 1 plg.vtx[79] plg.vtx[85];
pm.selectType( pf=True )
pm.polySelectConstraint( m=3, t=8, p=1 ) # to get non-planar faces
pm.polySelectConstraint( m=3, t=8, p=2 ) # to get planar faces
pm.polySelectConstraint( p=0 ) # turn off face planarity constraint
pm.delete( 'plg' )

#face convexity
pm.polyPlane( n='plg', w=5, h=5 )
pm.delete( 'plg.f[51]', 'plg.f[61]', 'plg.f[52:53]' )
pm.polyCloseBorder( 'plg.e[146]' )
pm.selectType( pf=True )
pm.polySelectConstraint( m=3, t=8, c=1 )# to get non-convex faces
pm.polySelectConstraint( m=3, t=8, c=2 )# to get convex faces
pm.polySelectConstraint( c=0 )#  turn off face convexity constraint
pm.delete( 'plg' )

#face holes
pm.polyCreateFacet( n='plg', p=[(-2, 2, 0), (-2, -2, 0), (2, -2, 0), (2, 2, 0)] )
pm.polyAppend( a=[2, (6, -2, 0), (6, 2, 0), (), (3, 1, 0), (3, -1, 0), (5, 0, 0)] )
pm.selectType( pf=True )
pm.polySelectConstraint( m=3, t=8, h=1 )# to get holed faces
pm.polySelectConstraint( m=3, t=8, h=2 )# to get non-holed faces
pm.polySelectConstraint( h=0 )# turn off hole constraint
pm.delete( 'plg' )

#face mapping
pm.polyPlane( n='plg', w=5, h=5 )
pm.polyMapDel( 'plg.f[60:69]' )
pm.selectType( pf=True )
pm.polySelectConstraint( m=3, t=8, tx=1 ) # to get mapped faces
pm.polySelectConstraint( m=3, t=8, tx=2 ) # to get non-mapped faces
pm.polySelectConstraint( tx=0 ) # turn off face mapping constraint
pm.delete( 'plg' )

#face topology
pm.polyCreateFacet( n='plg', p=((-3, 3, 0),(-3, -3, 0),(3, -3, 0),(3, 3, 0)) )
pm.polyAppend( a= [2, (8, -3, 0), (8, 3, 0)] )
pm.polyAppend( a= (4, 6, 5 ) )
pm.polyAppend( a =[0, (-7, 2, 0),(-7, -1, 0),(-8, 2, 0),(-5, 4, 0)] )
pm.selectType( pf=True)
pm.polySelectConstraint( m=3, t=8, tp=1 ) # to get non triangulatable faces
pm.polySelectConstraint( m=3, t=8, tp=2 ) # to get lamina faces
pm.polySelectConstraint( tp=0 ) # turn off the face topology constraint
pm.delete( 'plg' )

#"b"Length"/b"
pm.polyCylinder( n='plg', sz=1, h=3 )
pm.selectType( pe=True )
pm.polySelectConstraint( m=3, t=0x8000, l=True, lb=(2, 4) ) # to get edges of length 2 to 4 units
pm.polySelectConstraint( m=3, t=0x8000, l=True, lb=(1, 2) ) # to get edges of length 1 to 2 units
pm.polySelectConstraint( l=False ) # turn off the length constraint
pm.delete( 'plg' )

#"b"Angle"/b"
pm.polyCube( n='plg', w=5, h=5, d=5 )
pm.polyBevel( 'plg.e[7]', sg=1 )
pm.polyBevel( 'plg.e[9]', sg=3 )
pm.selectType( pe=True )
pm.polySelectConstraint( m=3, t=0x8000, a=True, ab=(0, 89) ) # to get edges with angle between 0-89
pm.polySelectConstraint( m=3, t=0x8000, a=True, ab=(45, 89) ) # to get edges with angle between 45-89
pm.polySelectConstraint( a=False ) # turn off angle constraint
pm.delete( 'plg' )

#"b"3D Area"/b"
pm.polyPlane( n='plg', w=5, h=5 )
pm.polyMoveFacet( 'plg.f[70:79]', ls=(.5, .5, 0) )
pm.selectType( pf=True )
pm.polySelectConstraint( m=3, t=8, ga=True, gab=(0, 0.2) ) # to get faces with area between 0 and 0.2
pm.polySelectConstraint( m=3, t=8, ga=True, gab=(0.2, 0.3) ) # to get faces with area between 0 and 0.2
pm.polySelectConstraint( ga=False ) # turn off 3D area constraint
pm.delete( 'plg' )

#"b"2D area"/b"
pm.polyCylinder( n='plg' )
pm.selectType( pf=True )
pm.polySelectConstraint( m=3, t=8, ta=True, tab=(0, 0.5) ) # to get face with texture area between 0-0.5
pm.polySelectConstraint( ta=True ) # turn off the 2D area constraint
pm.delete( 'plg' )

#"b"Distance"/b"
pm.polyPlane( n='plg', w=5, h=5 )
pm.selectType( pv=True )
pm.polySelectConstraint( m=3, t=1, d=1, db=(0, 5), dp=(5, 0, 0) ) # to get vertices located
# between 0-5 units from a given point
pm.polySelectConstraint( m=3, t=1, d=1, db=(5, 5), dp=(5, 0, 0) ) # to get vertices located
# at exactly 5 units from a given point
pm.polySelectConstraint( m=3, t=1, d=2, db=(5, 6), dp=(5, 0, 0) ) # to get vertices located
# between 5-6 units from a given axis
pm.polySelectConstraint( d=0 )# turn off the distance constraint
pm.delete( 'plg' )

#"b"Orientation"/b"
pm.polySphere( n='plg' )
pm.selectType( pv=True' )
pm.polySelectConstraint( m=3, t=1, o=1, ob=(0, 30), oa=(0, 1, 0) )# to get vertices oriented between
# 0-30 degree to a given axis
pm.polySelectConstraint( m=3, t=1, o=2, ob=(0, 30), oa=(0, 1, 0) )
pm.polySelectConstraint( o=0 )# turn off the orintation constraint
pm.delete( 'plg' )

#"b"Order (Neighbor)"/b"
pm.polyPlane( n='plg', w=5, h=5 )
pm.selectType( pv=True )
pm.polySelectConstraint( m=3, t=1, order=True, orb=(0, 2) ) # to get vertices with 0 to 2 neighbors
pm.polySelectConstraint( order=False ) # turn off the order (neighbor) constraint
pm.delete( 'plg' )

#"b"Visibility"/b"
pm.polySphere( n='plg' )
pm.selectType( pv=True )
pm.polySelectConstraint( m=3, t=1, v=True, va=60, vp=(10, 0, 0) ) # to get vertices in the 60 degree angle from a given point
pm.polySelectConstraint( v=False ) # turn off the visbility constraint
pm.delete( 'plg' )

#"b"Random"/b"
pm.polyPlane( n='plg', w=5, h=5 )
pm.selectType( pv=True )
pm.polySelectConstraint( m=3, t=1, r=True, rr=.5 )
pm.polySelectConstraint( r= False ) # turn off the random constraint
pm.delete( 'plg' )

# NOTE: Make sure you turn off the constraint you have used. Otherwise it may
# affect your next selection (if "i"mode"/i" flag is ON).

Previous topic

pymel.core.modeling.polySelect

Next topic

pymel.core.modeling.polySelectConstraintMonitor

Core

Core Modules

Other Modules

This Page