GENERATE/PREV.gifGENERATE/NEXT.gif

Working with Named Selection Sets

The MAX system global variable selectionSets contains an array of all the current node selection sets in the Named Selection Set dropdown on the MAX toolbar.

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 #) interchangably 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 objs named      -- "sphere*"

deleteItem selectionSets "old set"      -- delete the set named "old set"