When your molecular scene becomes crowded with visual models, it’s easy to lose focus. Whether you’re preparing images for publication, analyzing a specific interaction site, or debugging a custom SAMSON app, you likely spend time toggling visibility and manually sifting through elements. It can be repetitive — and inefficient.
This is where the visualModel attribute space in SAMSON’s Node Specification Language (NSL) comes in handy. It gives you an elegant way to query and manipulate only visual model nodes, using concise filters. Let’s explore how to use it to hide, reveal, and select what truly matters in your scene.
Understanding the visualModel Attribute Space
In NSL, vm (short for visualModel) refers specifically to visual model nodes in your document. These are the representations of molecular structures — ribbons, surfaces, bonds, and so on — that are rendered in the viewport. If you’re not working directly with geometries or materials, but with their display, vm is where to start your selection.
Work Smarter, Not Harder
Suppose you want to only select visual models that are currently visible. Instead of manually clicking through the document, use:
|
1 |
vm.v |
Want to isolate visual models that are hidden?
|
1 |
not vm.v |
Next, maybe you need models that own their material, meaning they won’t be affected by global material changes (useful when debugging rendering issues):
|
1 |
vm.om |
These filters can be combined, for example:
|
1 |
vm.v and vm.om |
This finds visual models that are visible and own their own material.
Highlight the Right View with visibilityFlag and selectionFlag
Sometimes visibility is controlled by more than just the ‘visible’ property. For finer control, use:
|
1 |
vm.vf</code> - visibility flag<br><code>vm.sf</code> - selection flag |
If you’re preparing a selection for scripting or exporting, vm.selected is especially useful:
|
1 |
vm.selected</code> or <code>not vm.selected |
You can even combine selectors to find selectable but currently unselected visual models:
|
1 |
vm.sf and not vm.selected |
Filter by Name with Wildcards
Imagine you’re working with multiple visual models named A_Surface, L_Surface, etc. Quickly find all visual models starting with “L” using:
|
1 |
vm.n "L*" |
This supports powerful naming conventions to keep complex projects manageable.
Find Hidden Gems in Complex Scenes
Sometimes, visual models exist in the scene but are hidden for clarity. Rediscovering them becomes easier with queries like:
|
1 |
not vm.v and vm.h |
Or if you’re doing cleanup, find all visual models that no longer contribute to rendering:
|
1 |
not vm.v and not vm.selected |
This workflow avoids clutter and can significantly speed up both analysis and rendering performance.
Conclusion
The visualModel attribute space provides simple yet powerful ways to manage visual complexity in SAMSON. Whether you’re preparing professional images or building your next automation script, filtering with vm attributes can save you valuable time.
If you want to explore the full list of attributes for visual models and how to use them, check out the online documentation here.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
