MAXScript Language Reference > Collections > Collection Types >

# FaceSelection Values

Value > Collections > Collection Types > FaceSelection Values

| Values and Collections - Quick Navigation

A FaceSelection represents a set of faces for a scene mesh node as a virtual array.

As such, you can access a face by index, iterate over the faces, and apply mapped functions to the faces.

See also Editable Mesh.

The FaceSelection array is dynamic, i.e., its contents will change as the faces or selected faces of the mesh node change.

FaceSelection values are mappable.

Constructors

    <mesh>.selectedFaces

The currently selected faces of the mesh object

    <mesh>.Faces

All of the faces of the mesh object, read-only

Properties

    <faceselection>.count : Integer, read-only

Returns the number of faces in the FaceSelection array.

    <faceselection>.selSetNames : Array of names, read-only

Returns an array of names of the current face-level named selection sets for the object the FaceSelection is associated with.

The following property is present for singleton selections (of the form $foo.faces[n]):

    <faceselection>.index : Integer, read-only

Returns the index of the selected element in the mesh,

FOR EXAMPLE
    $foo.selectedFaces[2].index
    -- returns the face index of the 2nd face in the current selection.

Iterating over a selection yields singleton selections in the loop body:

FOR EXAMPLE
    sf = for i in $foo.selectedFaces collect i.index
    --sf contains selected faces as array

Operators

    <mesh>.selectedFaces = (<array> | <bitarray>)

Selects the specified faces.

    <faceselection>[<integer>]

Retrieves the indexed face as a singleton FaceSelection. Index starts at 1.

    <faceselection>[<integer>] = <point3>

Sets the vertices of the indexed face to the vertex indices specified in the point3 value.

    <faceselection>[(<integer_array> | <bitarray>)]

Retrieves the indexed faces as a FaceSelection. Index starts at 1.

    <faceselection>[(<#name> | <string>)]

Retrieves the face-level named selection set, where the name of the named selection set can be specified as a name or string value.

    <faceselection>[(<#name> | <string>)] = (<faceselection> | <integer_array> | <bitarray>)

Sets the face-level named selection set to the specified faces.

The name of the named selection set can be specified as a name or string value, and the faces can be specified as an array, bitArray, or a FaceSelection from the same object.

Methods

    move <faceselection> <point3>

Moves the faces in the FaceSelection.

    select <faceselection>

Selects the faces in the FaceSelection.

    deselect <faceselection>

Deselects the faces in the FaceSelection.

    delete <faceselection>

Deletes the faces in the FaceSelection.

    append <faceselection> (<faceselection> | <integer>)

Appends the face(s) to the FaceSelection.

    findItem <faceselection> (<faceselection[<integer>] | <integer>)

Returns the selection index of the matching item or 0 if not found. The item is selection index or singleton FaceSelection.

EXAMPLES
    -- move faces in 'mouth' named selection set
    move $foo.faces[#mouth] [0,0,10]
    -- select faces in 'front faces' set
    select $baz.faces["front faces"]
    -- set 'baz' named selection set to given faces
    $foo.faces[#baz] = #(1,3,4,5,10)
    -- set 'cursel' set to current selection
    $baz.faces[#cursel] = $baz.selectedFaces
    -- all the names of the face-level named selection sets for object $foo
    $foo.faces.selSetNames
    -- print out all face-level named selection sets
    for n in $.faces.selSetNames do print $.faces[n]