Working with visibility and selection flags in SAMSON label nodes

When working on complex molecular models in SAMSON, it’s common to use annotations or graphical labels to highlight specific regions, monitor simulation data, or organize your workspace. These label nodes are versatile, but as your models grow in size and complexity, controlling the visibility and selection characteristics of these labels becomes essential.

In this post, we’ll take a closer look at some less obvious — yet extremely helpful — attributes you can use to manage label nodes efficiently through the Node Specification Language (NSL). These include visibilityFlag, selectionFlag, visible, and selected. Understanding the difference between these attributes can make daily modeling work much more manageable, particularly when you’re dealing with large scenes or scripting automation.

Label Visibility: visible vs. visibilityFlag

You might think toggling a label’s visibility is binary: it’s either visible or not. However, there are actually two attributes that affect whether a label is displayed:

  • la.v or visible: Tells you if the node is currently visible on screen.
  • la.vf or visibilityFlag: Lets you manage whether a node can be visible in response to your commands or the visibility flags of parent nodes.

For example, the following query returns all labels that are intentionally hidden by users via the visibility flag:

Whereas this query returns labels that are not currently visible — potentially due to parent nodes or other constraints:

This distinction can be useful when automating visibility tasks or filtering specific visual components programmatically.

Selection States: selected vs. selectionFlag

Similarly, selection behavior differs between the actual state and the permission state:

  • la.selected: Indicates whether the label is currently selected.
  • la.sf or selectionFlag: Controls whether the label node can be selected.

For example, if you want to find label nodes that cannot be selected (either due to workflow management or intentional locking), use:

On the other hand, to retrieve currently selected labels:

This is helpful when scripting clean selection toggles, building UI filters, or running simulations where only user-labeled regions are relevant.

Combining attributes for advanced control

By combining these attributes, you can very precisely determine which labels are shown, hidden, selectable or locked in terms of interaction. For example:

This expression would match all the label nodes that are both hidden intentionally and cannot be selected — a clean way to find auxiliary labels you might want to delete or archive when cleaning your model.

These options are particularly powerful when used in combination with scripting or automation pipelines in SAMSON. They allow you to filter label nodes with precision, whether you’re building custom workflows or improving scene clarity.

To learn more about label node attributes and other label node-specific controls, visit the official documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.

Comments are closed.