Easily Find Specific Cameras in SAMSON Using NSL

When working with complex molecular systems in SAMSON, managing multiple camera views can become cumbersome. Molecular modelers often create, duplicate, and adjust numerous cameras to analyze structures from different perspectives or for rendering. Over time, identifying the specific camera you need can become challenging, especially when dealing with large scenes. This is where the Node Specification Language (NSL) helps—offering a straightforward way to query and filter nodes, including cameras, using attributes.

This post focuses on how to efficiently find and filter cameras in SAMSON using camera-related attributes through NSL.

The Pain: Lost in a Sea of Cameras

Let’s say you’ve created several cameras in your scene for presentation, publication, or animation setup. While moving between them, tracking the right camera by just its position or image can be slow and error-prone. What if you’re looking for:

  • A camera with a specific name?
  • Cameras that are currently selected?
  • Those that have a certain selection flag set?

NSL makes such queries precise and fast.

Understanding the camera Attribute Space

In NSL, every type of node has a specific attribute space. Cameras use the camera attribute space, abbreviated as ca. You can use this short name in your queries to quickly specify you’re filtering camera nodes.

You can use the following attributes to filter cameras:

  • ca.n: camera name
  • ca.selected: whether the camera is selected
  • ca.sf: the camera’s selection flag

Filter by Name

Use quotes to search by exact name or use wildcards. Here are two examples:

The first retrieves the camera named TopView. The second retrieves all cameras whose name starts with “Cam”.

Filter by Selection State

If you’re working on selected cameras (e.g., recently adjusted viewports), use this simple query:

To find cameras that are not selected:

Filter by Selection Flag

Sometimes, cameras are marked for special processing using the selection flag. You can query these with:

or filter those without the flag:

Practical Tip: Combine Conditions

All of the above attributes can be combined with logical conditions. For instance, to find all unlocked cameras with names starting with “L” that are also selected:

Summary

By using NSL to filter camera nodes, SAMSON users can gain better control of scene management, streamline rendering workflows, and enhance reproducibility. Whether you are navigating between different angles or scripting complex visualization sequences, mastering camera filters saves time and reduces errors.

To learn more about working with cameras using the Node Specification Language, visit the official documentation page.

SAMSON and all SAMSON Extensions are free for non-commercial use. To get SAMSON, visit https://www.samson-connect.net.

Comments are closed.