ctx::selection

Controls the selections of the active context.

Syntax

ctx::selection method ?selection_name? ?option value option value...?

Type

HyperWorks Context

Description

Controls the selections of the active context and sets the attributes of the specified selection. This command is only valid for the HyperMesh client.

Methods

active
Returns the name of the active selection.
add selection_name option
Adds entities to the specified selection. For the list of available selection options, please refer to the *createmark documentation page.
clear ?selection_name?
Clears the selection. If selection name is not provided, the active selection is used by default.
copyfrom ?selection_name?
Copies the content of a mark to the selection. If selection name is not provided, the active selection is used by default.
copyto ?selection_name? option value
Copies the content of the selection to a mark. Currently, the only supported option is -mark. The value is the ID of mark to copy the selection to. If selection name is not provided, the active selection is used by default.
count ?selection_name?
Returns the number of entities in the selection. If selection name is not provided, the active selection is used by default.
get ?selection_name? option
Returns the current value of the given option. If selection name is not provided, the active selection is used by default. The available options are:
  • -type
  • -types
  • -ordered
  • -single
  • -highlight
ids ?selection_name?
Returns the list of IDs of the entities in the selection. If selection name is not provided, the active selection is used by default.
names
Returns list of selection names available in the active context.
remove selection_name option
Removes entities to the specified selection. For the list of available selection options, please refer to the *createmark documentation page.
set ?selection_name? option1 value1 option2 value2 ... optionN valueN
Updates the value of the specified option to the provided value. Multiple option-value pairs can be defined. If selection name is not provided, the active selection is used by default. The available options are:
  • -type
  • -types
  • -ordered
  • -single
  • -highlight

Examples

To add all entities to the active selection:
set active_sel [ ctx::selection active ]
ctx::selection add $active_sel all
To get the current entity type of the active selection:
ctx::selection get -type
To set the entity types available in the active selection to elements and components and enable single entity selection:
ctx::selection set -types {elements components} -single 1

Errors

Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
   # Handle error
}

Version History

2022.1