Selection

Below we will consider the selection functionality that allows to highlight and select geometry objects.

Selecting Nodes

Example of command to select nodes with uuids in an array uuids (TypeScript):

view.runCommand({
    name: "SelectCommand",
    uuids: uuids, // items to select
    clean: true, // unselect previous items
    branch: true // select a whole branch
})

Parameters:

  • uuid: a list of selected nodes.

  • clean: a flag for cleaning the previous selected elements.

  • branch: a flag for whole branch selection which contains an uuid.

This command doesn’t return anything as a result.

Unselecting Nodes

Example of command to unselect nodes with uuids in an array uuids (TypeScript):

text

view.runCommand({
    name: "UnselectCommand",
    uuids : uuids, // items to unselect
})

There is only one argument. It’s a list of element UUIDs for unselecting.

This command doesn’t return anything as a result.

Getting List of Selected Nodes

Example (TypeScript)

let res = view.runCommand({
    name:"GetParametersCommand",
    type:"SelectionList"
})

A result (res in an example above) has the same type as other GetParameters command results have:

type GetSelectionCommandResult {
    name: api.ResultTypes.Parameters // "Parameters"
    result: Promise<{
        name: GetParametersTypes.SelectionList // "SelectionList"
        uuids: string[]
        models: (string|null)[]
    }>
}