Advanced Usage

Part Tagging and Selection

EnSight supports the concept of part tagging. A tag defines a collection of parts, which can be useful for large numbers of parts. One part can be a member of more than one tag. The current selection can be used to create a tag and a tag can be used to set the current selection. This allows the user to quickly store and recall selections of arbitrary complexity. EnSight pre-defines a set of ten tags. These correspond to the number keys: 0-9. By default, no parts are members of any tags and any part can have multiple tags (for example, a part can be a member of tags 0, 4 and 5). Part tags are saved in context, session and archive files. They are not stored in command language files, although command language does exist to specify membership in a tag.

Defining a Tag from the Current Part Selection

EnSight uses Alt and the number keys (0-9) to define a tag from the current selection. To tag a collection of parts (marking that selection for easy recall later) do the following:

  1. Select any part(s)

  2. Press Alt+# where # is a number key from 0-9

First, the tag is cleared for all parts and then the selected parts are tagged with that key. On Windows and Linux, the details of the new tag are displayed in the status bar.

Using a tag to recall a stored part selection

EnSight uses Ctrl (Window/Linux) or   (OSX) and the number keys (0-9) to reset the current selection to the set of parts with the matching tag. To recall a tag and set the current part selection to the parts with that tag:

Press Ctrl+# or  +#, where # is a number key from 0-9.

The previous part selection is cleared and the all of the parts tagged with the matching key are selected. This allows one to very rapidly recall a previously tagged selection.

EnSight Python Implementation Details

Tagging is stored on each part through the Python METADATA attribute on the part objects. The pre-defined METADATA keys are 'ENS_PLIST_KEY_SEL_#', where # is a digit from the set '0-9'. Check on the membership in the tag using code as follows:

test = ensight.objs.core.PARTS[0].METADATA.get('ENS_PLIST_KEY_SEL_1',0)

The above will return whether the first part in the partlist is a member of tag '1'. Likewise, one can set/unset membership in the tag using the following:

ensight.objs.core.PARTS[0].setmetatag('ENS_PLIST_KEY_SEL_1',1)

and the following to unset:

ensight.objs.core.PARTS[0].setmetatag('ENS_PLIST_KEY_SEL_1',0)

(see EnSight Python Interpreter).


Note:  These last two examples are also valid command language and can be placed in command (.enc) files as well.


Finally, since the tagging system is based on the part metadata infrastructure, one can also set the tag membership directly from a reader using the metadata schema (see https://sites.google.com/a/ensight.com/ensight-python-api/metadata for more details).