Quickly Show or Hide Visual Models in SAMSON with the NSL

An essential part of working with complex molecular models is managing what you see — and what you don’t. Whether you’re building a model step-by-step, preparing visuals for a publication, or trying to debug a rendering issue, you’ve likely found yourself toggling visibility settings again and again. But did you know that SAMSON’s Node Specification Language (NSL) offers a quick, flexible way to filter and control visibility of visual models directly?

Let’s take a closer look at how the visibility-related attributes of visual models in NSL can help you streamline this process.

Understanding visibility attributes

In SAMSON, visual elements (like molecular representations and graphical models) are referred to as visual model nodes. These nodes belong to the visualModel attribute space, abbreviated as vm in NSL.

Visibility control is powered by a few key attributes in this space:

  • visible (v): Indicates if a visual model is shown on screen.
  • hidden (h): A legacy flag that also indicates visibility state, generally managed by the system.
  • visibilityFlag (vf): Used internally to calculate visibility; can be managed by users for fine-grained control.

Practical examples to get you started

If you want to list all visible visual models, open the NSL console in SAMSON and simply type:

To do the reverse and find all visual models that are currently not visible:

If you’d like to toggle visibility programmatically or through bulk selection, you can combine NSL queries with actions. For instance, to select and then show all visual models whose names start with “Ligand”:

(Then use the GUI or an action script to toggle visibility.)

You can also inspect models with conflicting visibility flags. For example, if visibility is off but vf is on, that could indicate a deeper issue in representation settings:

Why this helps

Manually managing visibility for multiple visual models can quickly become tedious in complex projects. When models number in the dozens or hundreds, NSL lets you rapidly filter, select, and debug representations based on visibility attributes. It’s a time-saver — and sometimes a sanity-saver — especially when preparing scenes or debugging why a structure isn’t displaying properly.

Related attributes

While pf.v manages visibility, other attributes can be nested into workflows for better control:

  • vm.selected: Combine visibility queries with selection states.
  • vm.name: Filter visual models based on semantic names to isolate representations.

If you want to dive deeper into NSL and visual models, the full documentation has all the specifics: Visual model attributes in NSL.

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

Comments are closed.