When working with complex molecular systems, researchers often use visual presentations to better understand structure, behavior, and interactions. However, as the number of presentation nodes grows, selectively isolating visible or hidden parts of your molecular scene can become tedious. If you’ve ever found yourself clicking endlessly through nodes just to track down what’s currently visible—or not—then this post is for you.
The Node Specification Language (NSL) in SAMSON can help you solve this efficiently. SAMSON allows you to query molecular structures using NSL, and when it comes to visual presentations, the presentation attribute space (short name: pr) lets you filter precisely what you need. Let’s take a look at some core attributes that target the visibility status of your presentation nodes.
Cut Through the Clutter: Use pr.v to Filter Visible Presentations
Presentation nodes visually represent molecular elements such as atoms, bonds, surfaces, or fields. With the NSL, you can isolate only the visible nodes using:
|
1 |
pr.v |
This will return all presentation nodes whose visible attribute is set to true. If you want to do the opposite and list hidden presentation nodes, simply use:
|
1 |
not pr.v |
This kind of filtering is especially helpful after performing multiple visibility toggles or importing external files. Instead of wondering what’s actually shown in the viewport, you can programmatically retrieve it.
Understand the Differences: visible vs. visibilityFlag
Confused between visible and visibilityFlag? You’re not alone. Here’s the distinction:
pr.v: Whether the node is visible in the current scene.pr.vf: A flag intended to control visibility; this can be used in scripts or logic-based toggles.
To check nodes where visibility was manually disabled or enabled but not yet reflected in the rendering (e.g. due to pending updates), pr.vf may be useful:
|
1 |
pr.vf false |
Track Down Hidden Elements with pr.h
If you prefer to filter based on the hidden status (an inherited node attribute), use:
|
1 |
pr.h |
And if you want nodes that are explicitly not hidden:
|
1 |
not pr.h |
Bonus: Check for Selected Nodes
When working with visual manipulations, you may want to isolate what has been selected vs. unselected to apply models or rendering. Use:
|
1 |
pr.selected |
Or to exclude selected visual elements:
|
1 |
not pr.selected |
Summary Table for Quick Reference
| Attribute | Code | Purpose |
|---|---|---|
| Visible | pr.v |
Presentation is rendered |
| Hidden | pr.h |
Presentation is marked as hidden |
| Visibility Flag | pr.vf |
User-definable flag |
| Selected | pr.selected |
Currently selected in UI |
Filtering based on presentation attributes significantly cuts down time when navigating complex scenes. Whether for analysis, debugging, or building custom tools, these small steps save hours over the course of an advanced modeling project.
Learn more by visiting the full documentation page on SAMSON NSL Presentation Attributes.
SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON at https://www.samson-connect.net.
