When analyzing complex molecular systems, one common pain point is maintaining clarity while working with multiple visual model nodes. These models—used to represent atoms, bonds, surfaces, labels, and more—can quickly accumulate, making it hard to isolate relevant components for analysis or editing.
Fortunately, SAMSON provides a way to query and filter visual model nodes using the Node Specification Language (NSL)
. In this post, we’ll focus on how to work with two commonly used visual model attributes: visible
and selected
. These attributes are essential for anyone who wants to cleanly manage their workflow, especially when creating high-quality visualizations or modifying specific models.
What are the visible
and selected
attributes?
These attributes are part of the visualModel
attribute space, accessible via the short name vm
. They allow you to specify conditions to find which visual models are currently visible or selected in your SAMSON workspace.
vm.v
: Indicates whether a visual model is visible (true
orfalse
).vm.selected
: Indicates whether a visual model is selected. Note: this has no short name like other attributes.
Filtering visual models using these attributes
Suppose you have a crowded scene and you only want to see which visual models are both visible and selected. You can run an NSL query like:
1 |
vm.v and vm.selected |
This will return all visual models that meet both conditions. You can also exclude models, for instance:
1 |
not vm.v |
This gives you a list of visual models that are currently hidden—helpful when debugging rendering issues or ensuring expected components are visible.
Common use cases
- Cleanup before rendering: Use
not vm.v
to find and remove hidden visual models you no longer need. - Batch operations: Filter with
vm.selected
to target specific models for duplication, deletion, or property changes. - Consistency checks: Run
vm.v and not vm.selected
to find models that are shown but not selected—helpful before exporting scenes or simulations.
Combining with other attributes
You can also combine these properties with other visual model attributes. For example, find visible models with a specific name pattern:
1 |
vm.v and vm.n "Surface*" |
This query selects all visible visual models whose names start with “Surface”. It’s a tidy way to highlight or modify thematic groups of surfaces or labels in complex molecular assemblies.
Filtering visual models with these attributes keeps your working environment streamlined and interactive, allowing you to focus on what matters most—designing and analyzing molecular systems.
To learn more about all the available visual model attributes and how to use the NSL query language in SAMSON, visit the documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.