When working with detailed molecular models, annotations like labels are key to keeping your scene understandable. But as your system grows, so does the visual clutter. If you’ve ever struggled to selectively show, hide, or search for label nodes in SAMSON, the Label Attributes in the Node Specification Language (NSL) can help streamline your workflow.
Let’s break down what’s available in the label attribute space, known by its short name la. These attributes help you filter, select, and manipulate label nodes directly using simple, expressive queries.
Visibility management at your fingertips
If your viewport feels overcrowded with labels, you’re not alone. Instead of manually toggling visibility for each label node, the visible and visibilityFlag attributes are here to help:
la.v– selects only the visible labels.not la.v– selects only labels that are currently invisible.la.vf false– targets labels with visibility flags set to false, regardless of their current view state.
This means you can isolate specific label categories based on their visual status—a practical way to clean up your working scene or focus on particular interactions.
Searching for labels by name
Sometimes, you’re looking for a specific label, such as one marking an active site or a custom annotation. With the name attribute, it’s easy to filter by character pattern:
la.n "A"– selects labels whose name is exactlyA.la.n "L*"– selects all labels starting withL.
This feature is especially useful if you use naming conventions when adding labels—which we highly recommend for large systems.
What about selection?
When preparing presentations or exporting images, you often want to highlight only selected elements. Two different attributes help here:
la.selected– selects labels that are currently part of the selection.la.sf– allows you to distinguish between labels that are selectable (true) and those that aren’t (false).
This dual control provides flexibility when crafting interaction pipelines—for example, ignoring helper labels in selection-related scripts.
Hidden or just not visible?
There’s a subtle difference between labels that are simply hidden from view and those excluded logically:
la.h– selects labels explicitly marked as hidden.
This is different from visibility in the viewport, and it may affect export, scripting logic, or automation pipelines that rely on object presence.
Using it all together
Consider this query: la.v and la.n "Residue*". It selects only the visible label nodes that begin with Residue in their name—perfect when you want to tweak only specific annotations without disturbing others.
In summary, mastering these label attributes saves time, reduces friction, and declutters your modeling environment. These filters let you command your annotations with precision—making it easier to stay focused on what matters most: the science.
To dive deeper, visit the official NSL Label Attributes documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. Download SAMSON at https://www.samson-connect.net.
