MAXScript Language Reference > 3ds Max Objects > Interfaces > Core Interfaces > Core Interfaces Documentation > N,O >

# Interface: NamedSelectionSetManager

Interfaces > Core Interfaces > NamedSelectionSetManager

| Core Interfaces - Quick Navigation

This Core Interface introduced in 3ds Max 2011 exposes methods to access and manage Named Selection Sets.

See also SelectionSetArray Values for related functionality.

    Interface: NamedSelectionSetManager

Methods:

    <integer>NamedSelectionSetManager.GetNumNamedSelSets()

Returns the number of named selection sets.

    <string>NamedSelectionSetManager.GetNamedSelSetName <integer>setIndex

Returns the name of the indexed, zero-based Named Selection Set.

    <integer>NamedSelectionSetManager.GetNamedSelSetItemCount <integer>setIndex

Returns the number of items (objects) in the indexed, zero-based Named Selection Set.

    <node>NamedSelectionSetManager.GetNamedSelSetItem <integer>setIndex <integer>itemIndex

Returns the indexed, zero-based scene node specified by the second argument from the indexed, zero-based Named Selection Set specified by the first argument.

    <boolean>NamedSelectionSetManager.AddNewNamedSelSet <&node array>nodeSet <&String>setName

    nodeSet is In parameter
    setName is In parameter

Adds a new Selection Set containing the nodes passed as array by the first argument named according to the second argument.

Returns true on success, false on failure.

     <boolean>NamedSelectionSetManager.RemoveNamedSelSetByIndex <integer>setIndex

Removes the zero-based indexed Named Selection Set.

Returns true on success, false on failure (index out of range).

    <boolean>NamedSelectionSetManager.RemoveNamedSelSetByName <&String>setName

    setName is In parameter

Removes the Named Selection Set with the given name.

Returns true on success, false on failure (name not found).

    <boolean>NamedSelectionSetManager.ReplaceNamedSelSetByIndex <&node array>nodeSet <integer>setIndex

    nodeSet is In parameter

Replaces the node array of the zero-based indexed Named Selection Set specified by the second argument with the node array passed by the first argument.

Returns true on success, false on failure (index out of range).

    <boolean>NamedSelectionSetManager.ReplaceNamedSelSetByName <&node array>nodeSet <&String>setName

    nodeSet is In parameter
    setName is In parameter

Replaces the node array of the Selection Set specified by the second argument name string with the node array passed by the first argument.

Returns true on success, false on failure (name not found).

    <boolean>NamedSelectionSetManager.GetNamedSelSetList <&node array>nodeSet <integer>setIndex

    nodeSet is In and Out parameter

Returns the node array of the Selection Set specified by the zero-based index second argument into the array passed by-reference by the first argument.

Returns true on success, false on failure (index out of range).

    <boolean>NamedSelectionSetManager.SetNamedSelSetName <integer>setIndex <&String>setName

    setName is In parameter

Sets the name of the indexed Named Selection Set specified by the first argument to the string specified by the second argument.

Returns true on success, false on failure (index out of range).

EXAMPLES:
    NamedSelectionSetManager.GetNumNamedSelSets() --starting without named selection sets
    --> 0
    s = Sphere() --we create a sphere
    --> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000]
    b = Box() --and a box
    --> $Box:Box001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.AddNewNamedSelSet #(s,b) "TestSelectionSet" --and add them to a sel.set
    --> true
    NamedSelectionSetManager.GetNumNamedSelSets() --checking the count, we have created one
    --> 1
    NamedSelectionSetManager.GetNamedSelSetName 0 --indices are zero-based, so we get the first set
    --> "TestSelectionSet"
    NamedSelectionSetManager.GetNamedSelSetItemCount 0 --which has two items inside
    --> 2
    NamedSelectionSetManager.GetNamedSelSetItem 0 0 --checking the first item returns the sphere,
    --> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.GetNamedSelSetItem 0 1 --checking the second item returns the box
    --> $Box:Box001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.RemoveNamedSelSetByIndex 0 --we can remove the only sel.set
    --> true
    NamedSelectionSetManager.GetNumNamedSelSets() --which makes the number of set equal to zero
    --> 0
    NamedSelectionSetManager.AddNewNamedSelSet #(s,b) "Test2" --let's make another one
    --> true
    NamedSelectionSetManager.GetNumNamedSelSets() --we are back to one selection set
    --> 1
    NamedSelectionSetManager.RemoveNamedSelSetByName "Test1" --we can try to remove it by (wrong) name
    --> false
    NamedSelectionSetManager.RemoveNamedSelSetByName "Test2" --and successfully remove it by name
    --> true
    NamedSelectionSetManager.AddNewNamedSelSet #(s,b) "Test3" --let's re-make it under another name
    --> true
    g = Geosphere() --and create a geosphere primitive to replace the sphere
    --> $GeoSphere:GeoSphere001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.ReplaceNamedSelSetByIndex #(g,b) 0 --we set the items in the sel.set
    --> true
    NamedSelectionSetManager.GetNamedSelSetItem 0 0 --so now the first item is the geosphere
    --> $GeoSphere:GeoSphere001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.GetNamedSelSetItem 0 1 --and the second is the box
    --> $Box:Box001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.ReplaceNamedSelSetByName #(b,s) "Test2" --replacing with wrong name fails
    --> false
    NamedSelectionSetManager.ReplaceNamedSelSetByName #(b,s) "Test3"--but works with the right name
    --> true
    NamedSelectionSetManager.GetNamedSelSetItem 0 0 --now we have the box as first itme
    --> $Box:Box001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.GetNamedSelSetItem 0 1 --and the sphere as the second
    --> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000]
    NamedSelectionSetManager.GetNamedSelSetList &theNodes 0 --we can get the nodes by-reference
    --> true
    theNodes --now the vairable contains an array of the items in the selection set
    --> #($Box:Box001 @ [0.000000,0.000000,0.000000], $Sphere:Sphere001 @ [0.000000,0.000000,0.000000])

    NamedSelectionSetManager.GetNamedSelSetName 0 --the current name is "Test3"
    --> "Test3"
    NamedSelectionSetManager.SetNamedSelSetName 0 "SelSet"--we can rename it to "SelSet"
    --> true
    NamedSelectionSetManager.GetNamedSelSetName 0 --and make sure the renaming worked:
    --> "SelSet"

#### See Also

- SelectionSetArray Values

- SelectionSet Values