## SetAndToggleSelection

### Introduced

v1.0

### Description

Sets the selection by toggling the selection of elements.
Note: If the SelectionList argument contains an error, the command fails.

### Scripting Syntax

    SetAndToggleSelection( SelectionList, [HierarchyLevel], [CheckObjectSelectability] );

### Parameters

Parameter | Type | Description
--- | --- | ---
SelectionList | String | List of elements. Unselected elements in this list are selected, and selected elements are deselected.
HierarchyLevel | String | Specifies how to select objects in a hierarchy. Default Value: "ASITIS"
Possible Values: | Description:
ASITIS | Select the object as it is.
NODE | Select the object.
BRANCH | Select the object and its children.
TREE | Select the entire hierarchy of objects.
MODEL | Select the model and the hierarchy of objects.
CheckObjectSelectability | Boolean | Specifies whether to select objects that marked as unselectable. Default Value: False
Possible Values: | Description:
False | Select objects even if they are marked as unselectable.
True | Do not select objects if they are marked as unselectable.

### Examples

#### VBScript Example

    ' The following uses SetAndToggleSelection to toggle

    ' the selection state of the objects

    NewScene

    CreatePrim "Cone", "MeshSurface"

    CreatePrim "Cube", "MeshSurface"

    Translate , 0.315084726066844, 7.40693410939845, -0.740693410939845, _

    		siRelative, siView, siObj, siXYZ

    CreatePrim "Sphere", "MeshSurface"

    Translate , 9.76762650807222, 1.64598535764408, -0.164598535764408, _

    		siRelative, siView, siObj, siXYZ

    SelectObj "cone", , True

    AddToSelection "cube", , True

    SetAndToggleSelection "cone, cube, sphere"

    logMessage "Cone and Cube were selected"

    logMessage "Only sphere should be selected now"

### See Also

ToggleSelection