Quickly Select Your Labels: Filtering with NSL

In many molecular projects, especially those involving large models, labels can multiply quickly. Whether they indicate measurements, annotations, or specific metadata, it’s easy to lose track of what is visible, what is selected, and what is simply clutter. Users often spend significant time trying to show, hide, or re-select the right labels—time that could be better spent refining models or analyzing results.

With the Node Specification Language (NSL) in SAMSON, you can use concise expressions to find and modify label nodes with precision. In this post, we’ll explore how to use label-specific attributes in the label attribute space (short name: la) to filter labels efficiently.

Common Scenarios and Solutions

1. Hide all visible labels

If your workspace is cluttered with visible labels and you want to hide them all at once:

This selects all labels where the visibility attribute (v) is true. You can then hide them with the Node Editor.

2. Find all labels currently not visible

This is helpful for reactivating previously hidden labels.

3. Select labels with names matching a pattern

This matches labels with names starting with “Distance”, such as distance measurements between atoms.

4. Filter based on visibility and name

This expression finds all currently visible labels with names beginning with “Angle”.

5. Find hidden labels with a specific flag

This selects all hidden labels that are still flagged for selection actions. It’s helpful for ensuring no label is unintentionally active.

What’s Inside the Attribute Space?

Label filtering in NSL happens within the la attribute space, designed to work exclusively with label nodes. Here’s a quick overview of the useful attributes:

  • hidden (h): true/false – whether the label node is hidden in the node editor.
  • visible (v): true/false – whether the label is currently shown in the viewport.
  • selectionFlag (sf): true/false – whether the label is flagged for selection actions.
  • visibilityFlag (vf): true/false – whether the label will respond to visibility toggles.
  • selected: true/false – whether the label is part of the current selection.
  • name (n): string query – labels matching exact or wildcard name.

When Names Matter: Wildcards

You can use wildcards like * to match groups of labels efficiently:

This is especially helpful if you follow a naming convention. Combining this with la.v or not la.v can help manage visual information density on screen.

Final Tip

If you’re using label nodes as a communication layer (e.g. for adding comments, marking interactions, or noting structural events), using the NSL-based filters helps you stay organized and focus only on what’s relevant at any given time.

Learn more from the original SAMSON documentation page on label attributes.

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

Comments are closed.