How to Quickly Filter Cameras in Large Molecular Projects

When working with complex molecular scenes in SAMSON, it’s easy to lose track of your camera nodes. Especially in projects where multiple team members are defining views, capturing specific angles, or setting up animations, camera nodes can accumulate—and selecting or filtering the right one gets tedious fast.

This is where the Node Specification Language (NSL) and its camera-specific attributes come into play. With just a few lines of NSL code, you can search, filter, or even script actions involving camera nodes based on name patterns, selection status, and more.

Use Case: Finding Cameras by Name

Let’s say you’re managing a protein-ligand complex with several saved camera views named "ActiveSite", "LigandView", "Overview", and so on. You’re only interested in cameras whose names start with “L” (like LigandView1, LigandView_final, etc.).

You can use the following NSL statement:

This filters all camera nodes (the ca short space for camera) whose name (n) starts with “L”. The wildcard * helps match any character(s) after “L”.

Checking Which Cameras Are Currently Selected

If you want to identify which camera nodes in your document are currently selected—perhaps to save their settings or annotate them—you can use:

This filters camera nodes that are currently marked as selected. Combined with other filters, this is a fast way to isolate nodes you’re actively working with.

Using the selectionFlag for Advanced Filters

The selectionFlag attribute (short name: sf) is a powerful way to tag specific nodes programmatically. For example, during scripting or automation, you can set the selection flag to false for irrelevant cameras, and use the following query to see what remains:

Or, simply:

This hides all cameras that shouldn’t be affected by further operations. Very practical for batch exports or animations based on specific views.

Summary of Camera Attributes

Attribute Short Name Examples
name n ca.n "Main", ca.n "L*"
selected ca.selected, not ca.selected
selectionFlag sf ca.sf false, not ca.sf

The best part? These filters can be combined. For example, find all selected cameras named “MainView*” with a selection flag:

Whether you’re cleaning up your workspace, preparing a publication, or working through a modeling pipeline, NSL gives you precise tools to search within your camera nodes. Once you’ve mastered this, you can scale to other node types as well.

To learn more about the attributes available for camera nodes, visit the original documentation page: 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.