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.

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>

Delete the named selection set with name set_name, which can be either a String or Name value.

Associated Methods

getNumNamedSelSets()

Returns number of named selection sets as an integer.

getNamedSelSetName <set_index_integer>

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

getNamedSelSetItemCount <set_index_integer>

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

getNamedSelSetItem <set_index_integer> <node_index_integer>

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

Examples

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

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 Name 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"