A Simple Way to Show or Hide Molecular Visual Models in SAMSON

When working on large molecular systems or complex scenes in SAMSON, keeping a tidy viewport is essential. Whether you’re publishing visuals, exploring specific subsystems, or simply reducing visual noise to concentrate on a specific interaction, the ability to quickly manage the visibility of nodes is a vital skill.

Luckily, SAMSON offers a precise mechanism to filter and control the visibility of objects using its powerful Node Specification Language (NSL). In this blog post, we’ll explore how to use visual model attributes—especially the visible and hidden flags—to select and manage objects more effectively in your projects.

Why visibility management matters

Imagine you’re analyzing a large protein-ligand system with multiple annotations, surfaces, and environments. Some of these are irrelevant for your current focus, but clutter your workspace. Manually clicking through the Document view to toggle visibility can be time-consuming and error-prone, especially in complex scenes with dozens of visual models.

Instead, with NSL, you can query and manipulate visual models directly based on their visibility state using a few simple keywords.

The vm.v attribute: Control what you see

The visible attribute (short name: v) allows you to filter visual models in your scene based on whether they are currently visible or not. For example:

  • vm.v: selects all visible visual model nodes.
  • not vm.v: selects all visual model nodes that are currently hidden.

This can be used in the Find window, or when writing NSL expressions to drive automated selection and control.

vm.h: An alternate way to manage visibility

In SAMSON, both visible (v) and hidden (h) can be used to refer to a node’s visibility, but from opposite perspectives. The h attribute simply returns true if the node is hidden. Therefore, these two expressions are equivalent:

  • not vm.h (nodes that are not hidden)
  • vm.v (nodes that are visible)

This flexibility caters to different user preferences: whether you like to think in terms of what’s visible or what’s hidden.

Applying these in real situations

Suppose you’re loading a scene that includes multiple visual styles—volumetric clouds, surfaces, labels—and want to remove visual clutter to focus only on the ribbon representation. If all ribbons are named with an “R” prefix, you could select them with:

Then, you could hide all other visual models via:

This would isolate your ribbons for better inspection or rendering.

Bonus: Find hidden but selected elements

If you ever wondered why nothing seems to respond despite selection, use:

This lets you find anything that is selected but not visible—handy when troubleshooting invisible selections.

Learn more about these attributes in the official NSL documentation: Visual Model Attributes Overview.

NSL Visual Model attributes table

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON from https://www.samson-connect.net.

Comments are closed.