Quickly Find and Filter Your Cameras in SAMSON with NSL

If you’ve ever worked with complex molecular scenes in SAMSON, you know how handy it is to be able to switch between different camera perspectives. But as projects grow, many molecular modelers find themselves managing a large number of camera nodes—sometimes with little idea how to quickly locate or organize them. If that sounds familiar, this post is for you.

SAMSON’s Node Specification Language (NSL) offers a concise, readable way to filter through nodes, including all cameras defined in your workspace. Whether you’re scripting an animation, refining a presentation, or just trying to re-orient yourself in a visually dense project, learning how to specify camera nodes using NSL can save time and reduce confusion.

What is the camera attribute space?

All cameras in SAMSON can be accessed via the camera attribute space, abbreviated as ca. Every camera node supports a set of common attributes—many of them inherited from general node properties. You can use these attributes in queries to select and filter cameras precisely.

Filtering cameras by name

If you give your cameras meaningful names (like “Front View” or “Binding Site 1”), you can then retrieve them using the name attribute. This is extremely useful when scripting or automating camera behavior.

Here are two examples:

  • ca.n "A" — matches any camera named exactly “A”
  • ca.n "L*" — matches any camera with a name starting with “L”

These queries are especially powerful when you adhere to consistent naming conventions (e.g., using prefixes like “Lateral_” for side views).

Working with selection states

Let’s say you just selected a camera in the interface and want to operate on it via a script. You can access it using the selected attribute:

  • ca.selected — matches cameras that are currently selected
  • not ca.selected — matches cameras that are not selected

This is practical when toggling visibility, exporting camera properties, or running batch operations only on a visible subset.

Use selectionFlag to tag cameras temporarily

The selectionFlag attribute (abbreviated sf) is a utility flag that you can toggle programmatically. It’s useful for temporarily tagging camera nodes without altering their actual selection state in the interface.

Examples include:

  • ca.sf false — finds all cameras with selectionFlag set to false
  • ca.sf — finds all cameras with selectionFlag set to true

Some users use this approach to differentiate between cameras that should be included in an animation script and those that shouldn’t.

Why this matters

In large molecular modeling projects, navigation becomes time-consuming. You might only want certain camera views for rendering, or you may want to batch export images from specific angles. By leveraging these attributes in NSL, you can locate, organize, and process your camera nodes without hunting through the node browser.

To learn more about how to use camera attributes in NSL, check the documentation here: https://documentation.samson-connect.net/users/latest/nsl/camera/

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

Comments are closed.