MAXScript Language Reference > Collections > Collection Types >

# SelectionSetArray Values

Value > Collections > Collection Types > SelectionSetArray Values

| Values and Collections - Quick Navigation

The SelectionSetArray class has only one instance, selectionSets, which is an array of all the named selection sets in the current scene.

The named selection sets correspond to the selection sets in the Named Selection Set drop-down list on the 3ds Max toolbar.

SelectionSet values are mappable.

Also see SelectionSet Values.

Constructors

    selectionSets

Properties

    <selectionsetarray>.count : Integer, read-only

Returns number of named selection sets.

Operators

    <selectionsetarray>[<set_name>]

Accesses member of collection by named selection set name. set_name can be either a String or Name value.

    <selectionsetarray>[<set_index_integer>]

Accesses member of collection by index number. Indexes start at 1.

    <selectionsetarray>[<set_name>] = <node_array>

Create or replace named selection set with name set_name , which can be either a String or Name value. node_array must be an array of nodes.

Methods

    deleteItem <selectionsetarray> [<set_name> | <selectionset>]

Deletes the selection set. The first argument is the selection sets array selectionSets .

The second argument can be the name of the selection set which can be either a String or Name value, or the selection set itself (which is a new option in 3ds Max 9).

The method isDeleted() is valid for named selection sets since 3ds Max 9. See SelectionSet Values for details and examples.

Associated Methods

    getNumNamedSelSets()

Returns the number of named selection sets as an integer.

    getNamedSelSetName <set_index>

Returns the name of the indexed named selection set as a string. <set_index> is 1 based.

    getNamedSelSetItemCount <set_index>

Returns the number of nodes in the indexed named selection set as integer. <set_index > is 1 based.

    getNamedSelSetItem <set_index> <node_index>

Returns the indexed node in the indexed named selection set as a node. <set_index> and <node_index> are 1 based.

You access an individual selection set by indexing the selectionSets array with its name or index,

FOR EXAMPLE
    set1 = selectionSets["my set 1"]

You can then use that set just as you would use any other object set in MAXScript, such as selection, objects, lights, etc.

FOR EXAMPLE
    move set1 [10,0,0]
    --moves all the objects in the set across 10 in x.

You can use strings or MAXScript names (starting with #) interchangeably as indexes for the selectionSets array, or you can use an integer as an index if you want to loop over all the sets,

FOR EXAMPLE
    selectionSets[#set2].wireColor = red
    for i in 1 to selectionSets.count do
    saveNodes selectionSets[i] ("set" + i as string + ".max")

You can change, add and delete new Named Selection Sets by using the standard array methods on the selectionSets array:

FOR EXAMPLE
    selectionSets["new set"] = selection --snap the current selection
    selectionSets["old spheres"] = $sphere* --all the current objects named "sphere*"
    selectionSets[#foo] = #(obj1, obj2, obj3)
    deleteItem selectionSets"old set" --delete the set named "old set"
    nss = selectionSets["another set"] --get the selection set by name
    deleteItem selectionSets nss --possible syntax since 3ds Max 9

#### See Also

- SelectionSet Values

- PathName Values

- Pathname Literals

- Collections