## ToggleSelection

### Introduced

v1.0

### Description

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

### Scripting Syntax

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

### Parameters

Parameter | Type | Description
--- | --- | ---
SelectionList | String | List of elements to toggle.
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 example uses ToggleSelection to
    ' toggle the selection state of the objects
    NewScene
    CreatePrim "Cone", "MeshSurface"
    CreatePrim "Sphere", "MeshSurface"
    Translate , 6.53800806588703, 4.58524492486573, -0.458524492486574, _
                    siRelative, siView, siObj, siXYZ
    CreatePrim "Cube", "MeshSurface"
    Translate , 9.25561382821357, -5.05552645562117, 0.505552645562117, _
                    siRelative, siView, siObj, siXYZ
    AddToSelection "cone", , True
    ToggleSelection "cube, sphere"
    logMessage "Cone remains selected, cube is no longer selected"
    logMessage "and Sphere becomes selected"

### See Also

SetAndToggleSelection