SelectionSetArray Values

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. Also see SelectionSet Values. SelectionSet values are mappable.




<selectionsetarray>.count : Integer, read-only

Returns number of named selection sets.



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


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.


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

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

new.gif NEW in 3ds Max 9: 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


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:

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