When working on large molecular systems in SAMSON, things can quickly become overwhelming: multiple representations, custom annotations, and layers of data might clutter your workspace. Labels—although critical for highlighting key data points—can add to this visual noise if not carefully managed. That’s where the Node Specification Language (NSL) comes into play, especially the visible and visibilityFlag attributes for labels. This blog post focuses on simplifying your 3D workspace using label visibility tools in NSL.
Why control visibility?
As molecular models grow more complex, clear visualization becomes essential. Being able to programmatically hide or show labels based on criteria makes it easier to focus on relevant parts of the system. For example, you might want to:
- Display only labels that match a naming pattern (e.g. “L*”)
- Quickly toggle all labels off for cleaner screenshots
- Check the visibility status of specific annotation groups
Label visibility attributes you can use in NSL
To act on label nodes specifically, NSL uses the label attribute space, abbreviated as la. Two attributes can help you manage label visibility:
-
la.v(visible) — Indicates whether a label node is currently visible.
Examples:la.v,not la.v -
la.vf(visibilityFlag) — Offers finer control by specifying the intended visibility flag, independent of external conditions.
Examples:la.vf,la.vf false
These attributes are inherited from the general node space but are scoped only to label nodes via the la prefix. This makes it easy to apply visibility filters without affecting other types of nodes (like molecules or bonds).
Example: hiding all labels beginning with “L”
If you’ve named your labels systematically (e.g., L1, L2, etc.), you can quickly hide them all using:
|
1 |
la.n "L*" and la.vf false |
This selects all labels starting with “L” and disables their visibilityFlag.
Combining visibility and hidden status
Sometimes, you might want to distinguish between labels that are explicitly hidden and those that are visible but obstructed. NSL also allows you to check for la.h (hidden status):
|
1 |
la.v and not la.h |
This query lists label nodes that are marked as visible and not hidden due to hierarchy or parent node settings.
Useful workflow tips
- Use shortcuts like
la.vf falseto prepare your scene for exports or tutorials. - If temporarily hiding labels, remember to keep
la.vf truebut usela.hfor more transient states. - Filter by
la.nto target specific annotations without affecting others.
Understanding these simple visibility controls can make a big difference in the clarity of your visualizations and simulations. For large or collaborative projects, it also helps streamline your work and prevents your screen from becoming too busy.
To learn more about other useful attributes and examples, visit the official documentation page:
https://documentation.samson-connect.net/users/latest/nsl/label/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
