Quickly Find What’s Visible in Your Molecular Scene with NSL

In large-scale molecular simulations, visual clutter is a common issue. Whether you’re analyzing protein-ligand interactions or building complex assemblies, identifying visible elements in your scene is crucial. Fortunately, SAMSON’s Node Specification Language (NSL) includes presentation attributes that make it much easier to filter nodes based on visibility and selection state.

This post focuses on a common bottleneck: finding which parts of your model are currently visible or hidden in your graphical window. More specifically, we’ll dive into the presentation attribute space (pr), which targets only presentation nodes.

Why search by visibility?

Imagine you’re working on a large molecular system and you suspect that certain molecules are hidden or accidentally turned off. Or maybe you’re preparing an image or video and you only want to focus on visible elements. Visibility-based filtering lets you:

  • Quickly inspect and double-check the visible parts of your system
  • Select only visible nodes for further actions (e.g., transformation, deletion)
  • Create cleaner scenes by identifying and removing hidden parts

Using pr.v to filter visible nodes

The visible attribute (pr.v) is one of the most useful tools here. Here are a few common use cases:

  • pr.v returns nodes that are currently visible
  • not pr.v returns nodes that are currently hidden

Both of these expressions let you zero in on whether a node is actually rendered in the current view—helping you avoid confusion in crowded scenes.

Visibility vs visibilityFlag

NSL also distinguishes between actual visibility (pr.v) and the visibilityFlag attribute (pr.vf). While pr.v reflects the current visible state, pr.vf reflects whether the node could be visible based on user flags. For example:

  • pr.vf – return nodes with visibility enabled (so they’ll be visible when context allows)
  • not pr.vf – return nodes with visibility explicitly turned off

This distinction becomes useful when nodes are part of a hierarchy, where parent node visibility may override child visibility.

Other related attributes

Selection-based filtering is also just as useful. The selected and selectionFlag attributes allow you to filter what the user has actively selected or marked, with expressions like:

  • pr.selected – returns nodes selected in the GUI
  • pr.sf false – returns nodes not marked in the selection flag

Wrap-up

The presentation attribute space in NSL provides a simple but effective language to manage visibility and selection in complex scenes. These small expressions can help reduce errors, streamline workflows, and provide clarity in large models.

To learn more about how you can filter and manipulate presentation attributes in SAMSON, visit the documentation page on presentation attributes.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.

Comments are closed.