Working with multiple cameras inside a complex molecular system can feel overwhelming. In integrative modeling platforms like SAMSON, cameras help visualize the system from different perspectives—especially useful during animation, scene capturing, or scientific reporting. However, selecting and managing these cameras can be tedious if you’re not aware of scripting tools like the Node Specification Language (NSL).
This guide explains how to use NSL efficiently to filter and select camera nodes in your molecular scene. Specifically, we’ll dive into the camera attribute space and three simple attributes you can use to gain control over your cameras: name, selected, and selectionFlag.
Why Molecular Modelers Run Into Trouble
Imagine you have ten cameras in a scene, each focusing on a particular region of a large molecular system—a protein complex, a nanodevice, or a supramolecular assembly. You want to render from a specific viewpoint or script an animation using just a subset. Clicking through the interface or guessing each camera’s role becomes a frustrating task. That’s where NSL becomes your friend.
The Camera Attribute Space in NSL
In NSL, cameras belong to a specific attribute space called camera (short name: ca). This allows you to write expressions like:
|
1 |
ca.n "Overview" |
This selects any camera whose name is exactly Overview.
Want to select all cameras whose name starts with L? Use wildcards:
|
1 |
ca.n "L*" |
The wildcard * works like it does in most pattern matching languages, so it saves a lot of time.
Working With Selections
You can check which cameras are currently selected using:
|
1 |
ca.selected |
If you’re trying to find cameras NOT selected (maybe to identify unused ones):
|
1 |
not ca.selected |
This is particularly valuable before batch-deleting or editing cameras in large projects. It can prevent costly mistakes.
Using selectionFlags For Flexible Tagging
NSL also supports a more manual and customizable attribute: selectionFlag, shortened as sf.
|
1 |
ca.sf |
This filters cameras with the selection flag set to true. This mechanism is helpful for programmatically tagging cameras based on rendering steps, external scripts, or internal checklists.
Want to find every camera that isn’t tagged?
|
1 |
ca.sf false |
This small flag enables a basic tagging system that complements your selection system. For advanced projects with custom workflows or automated processing steps, this can be a dependable tool.
Is There a Short Name for Everything?
Not quite. For example, while name has a short version (n) and selectionFlag can be shortened to sf, the selected attribute must be typed out fully.
So if you’re trying:
|
1 |
ca.s |
You’ll get nothing. Use:
|
1 |
ca.selected |
Documentation notes that this is inherited from node.selected but without its short name.
Conclusion
Using NSL to manage cameras gives you much more control than manual selection. Whether you’re preparing publication images or building dynamic scripts that traverse camera nodes, these attributes—name, selected, and selectionFlag—form a powerful trio to efficiently identify and filter your viewpoints.
To learn more about NSL camera attributes, visit the official documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
