When working with complex molecular models in SAMSON, it’s common to toggle the visibility of different parts of your system to focus on specific regions, reduce clutter, or prepare better visuals. But navigating and selecting these nodes manually—especially across large molecular systems—can be time-consuming and frustrating. Luckily, the Node Specification Language (NSL) in SAMSON includes a simple and powerful way to select nodes based on visibility.
Visibility Control: The Shortcuts
With NSL, you can select only the nodes that are visible or hidden using just one line of text. This is particularly useful for refining selections, applying materials, or performing targeted operations on your model.
Selecting Visible Nodes
To select all visible nodes, use:
|
1 |
n.v |
This will match all nodes whose visibilityFlag is true and whose ancestors are also visible. It’s equivalent to saying: “Give me everything I can currently see in the viewport.”
Selecting Hidden Nodes
To select all hidden nodes, you just need:
|
1 |
n.h |
This includes nodes that are hidden either directly or indirectly (e.g., because a parent node is hidden).
What About the Flags?
Behind the scenes, visibility in SAMSON is governed by the visibilityFlag attribute. You can match nodes just based on this flag by using:
|
1 |
n.vf true |
This lets you, for example, find nodes that have visibilityFlag=true but might still be invisible due to a hidden ancestor.
Why This Helps
This capability is especially useful in workflows where you’re:
- Cleaning up scenes before export or rendering
- Applying or removing materials only from visible parts
- Managing large assemblies with nested visibility states
- Debugging visibility issues in complex systems
Combining With Other Filters
Want to select only visible atoms? Combine the NSL conditions:
|
1 |
n.v and n.t a |
Or, to find hidden meshes:
|
1 |
n.h and n.t me |
This makes it easy to execute very specific selections without clicking through nested trees in the interface.
Next Steps
If you’re regularly managing visibility of molecular components, learning how to use n.v, n.h, and n.vf will significantly improve your workflow.
To learn more about node attributes and powerful queries in SAMSON, visit the full NSL node documentation at:
https://documentation.samson-connect.net/users/latest/nsl/node/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
