Making Sense of Camera Selection in SAMSON’s Node Specification Language

When working with complex molecular models in SAMSON, many users take advantage of various node types such as atoms, bonds, groups, and cameras. Cameras play a key role in setting up and reproducing specific viewpoints or visual styles, which is especially important for presentations, publications, or collaborative projects.

But how do you efficiently find or filter camera nodes in a scene that may contain thousands of other elements? The Node Specification Language (NSL) in SAMSON provides a structured way to query and manipulate these elements. In this article, we’ll focus on how to identify and filter camera nodes using their selected and selectionFlag attributes.

Why it matters

Imagine you’ve set up multiple camera angles for a molecular animation or simulation result, and you want to reset or export only the ones you’ve marked for rendering. Or maybe you’re revisiting a project and trying to locate the viewpoint from a specific camera. Searching for cameras manually or modifying each one by hand can be time-consuming.

With NSL, there’s a more efficient way.

Working with the “camera” attribute space

In SAMSON’s NSL, camera attributes are included in their own attribute space: the camera attribute space, abbreviated ca. This structure ensures that the commands you run only affect camera nodes.

Filtering by selection

Use the selected attribute to check whether a camera node is currently selected:

  • ca.selected: matches all selected camera nodes
  • not ca.selected: matches all camera nodes that are not selected

This is particularly useful if you want to isolate cameras you’ve previously highlighted in the interface and perform batch operations on them.

Using the selectionFlag

The selectionFlag attribute, accessible using the shorthand sf, is another powerful filter. It allows you to include or exclude nodes based on a custom selection tag you can set elsewhere in your workflow.

  • ca.sf: matches all camera nodes with the selection flag enabled
  • ca.sf false: matches all camera nodes without the selection flag

For example, you could flag all cameras intended for export with the selection flag and retrieve them later using a simple query.

Example use cases

1. Selecting all unflagged cameras for review:
ca.sf false

2. Verifying which cameras are currently active in a selection:
ca.selected

3. Combining conditions with other filters (e.g., name):
ca.sf ca.n "TopView" – selects flagged cameras named “TopView”

Conclusion

Understanding and making use of the selected and selectionFlag attributes when working with camera nodes in SAMSON can save a lot of time and streamline project organization. Whether you’re preparing a polished animation or just trying to reorient yourself in a past project, mastering these NSL filters makes your workflow smoother and more predictable.

To explore all available attributes and see more examples, visit the official documentation page here: Camera Attributes in SAMSON 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.