## SelectObj

### Introduced

v1.0

### Description

Selects objects, property sets, and other elements using the selection mode specified in the HierarchyLevel parameter.
Note: This command resets the Selection to only those items specified in the SelectionList parameter. If you want to modify the selection, use AddToSelection or RemoveFromSelection.

### Scripting Syntax

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

### Parameters

Parameter | Type | Description
--- | --- | ---
SelectionList | String | List of elements to select. Default Value: Current selection
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

    ' Create objects for demonstration
    NewScene , false
    set cube = CreatePrim("Cube", "MeshSurface")
    SelectObj "cube.poly[4]", , True
    CreateCluster
    ApplyShader
    BlendInPresetsInsp , , , True, True
    set cube1 = CreatePrim( "Cube", "MeshSurface",,cube )
    Translate cube1, -2, 0.000, 0.000, siAbsolute, siParent, siObj, siXYZ
    set cube2 = CreatePrim("Cube", "MeshSurface",,cube1 )
    Translate cube2, -2, 0.000, 0.000, siAbsolute, siParent, siObj, siXYZ
    set cube3 = CreatePrim( "Cube", "MeshSurface",,cube2 )
    Translate cube3, -2, 0.000, 0.000, siAbsolute, siParent, siObj, siXYZ
    CreateGroup
    ' Select the objects named "cube" and "cube1"
    SelectObj "cube,cube1"
    Application.LogMessage "select objects by name: " & Selection.GetAsText
    ' Select all models in the scene.
    SelectObj "#model"
    Application.LogMessage "select all models: " & Selection.GetAsText
    ' Select all 3D objects in the scene.
    SelectObj "*#3dobject"
    Application.LogMessage "select all objects: " & Selection.GetAsText
    ' Select all passes in the scene.
    SelectObj "*.#pass"
    Application.LogMessage "select all passes: " & Selection.GetAsText
    ' Select all groups in the scene.
    SelectObj "#group"
    Application.LogMessage  "select all groups: " & Selection.GetAsText
    ' Select all materials
    SelectObj "*.material"
    Application.LogMessage "select all materials: " & Selection.GetAsText
    ' Select all polygon cluster material
    SelectObj "*.polymsh.cls.Polygon.Material"
    Application.LogMessage "select all  polygon cluster materials: " & Selection.GetAsText
    '***************************************************************************
    ' To process the selection list, use the Selection object
    SelectObj "*.material"
    Application.LogMessage "select all local object materials: " & Selection.GetAsText
    '***************************************************************************
    ' When you branch, tree, or model select, only one object
    ' appears in the SelectionList. For example, given this
    ' hierarchy:
    '       cube > cube1 > cube2 > cube3
    '
    ' Selecting in branch gives these results:
    '       - cube1 is selected (white highlight)
    '       - cube2 and cube3 have light grey highlight
    '       - cube1 is the only item in the selection list
    SelectObj "cube1", "BRANCH"
    Application.LogMessage "select cube1 in branch: " & Selection.GetAsText
    'INFO : "select objects by name: cube,cube1"
    'INFO : "select all models: Scene_Root"
    'INFO : "select all objects: Camera,Camera_Interest,Camera_Root,cube,cube1,cube2,cube3,light"
    'INFO : "select all passes: Passes.Default_Pass"
    'INFO : "select all groups: Group"
    'INFO : "select all materials: Camera.Scene_Material"
    'INFO : "select all  polygon cluster materials: cube.polymsh.cls.Polygon.Material"
    'INFO : "select all local object materials: Camera.Scene_Material"
    'INFO : "select cube1 in branch: cube1"

### See Also

Selection AddToSelection RemoveFromSelection SelectBranch SelectTree SelectModel Dealing with Hierarchy