When working with complex molecular models in SAMSON, it’s not uncommon to deal with scenes containing multiple cameras, especially when collaborating with colleagues or loading third-party projects. Locating specific cameras or filtering based on their properties can become tedious, particularly when scenes include various other nodes like molecules, shapes, lights, or annotations.
If you’re spending valuable time hunting through node trees to identify which cameras are active or named, the Node Specification Language (NSL) provides a concise way to quickly retrieve exactly what you need.
Why Focus on Cameras?
Cameras in SAMSON define viewpoints — essential for creating consistent renderings, aligning structures, or preparing visuals for presentations. Not being able to easily filter or organize them can lead to lost work or repeated setups. NSL lets you select cameras based on attributes like:
name– identify or group camerasselected– find only highlighted or currently used camerasselectionFlag– customize tag flags for filtering sets
Filtering Example: Find All Named Cameras
Suppose your SAMSON document contains many cameras. To retrieve all those with a name starting with “L”, use the following NSL expression:
|
1 |
ca.n "L*" |
This will match camera nodes whose names begin with “L”, like “L_front” or “LateralView1”.
Filter by Selection or Flags
You can also combine conditions to extract exactly the right camera nodes. For example, this will find all non-selected cameras with no selection flag:
|
1 |
not ca.selected and ca.sf false |
To target only selected cameras in your scene:
|
1 |
ca.selected |
If you prefer using short names for faster typing, remember that selectionFlag can be written as sf, and name has a short version n. However, selected does not currently support a short name in the camera attribute space.
Time-Saving Scenarios
Here’s how molecular modelers can benefit daily:
- Restore viewpoints: Use
ca.n "TopView"to jump back to a familiar camera angle during a long modeling session. - Batch delete old views:
not ca.sfhelps isolate cameras with outdated flags you want to remove. - Export renders consistently: By selecting specific named cameras, ensure images are always generated from the same angles.
These filters save time and reduce errors in large or collaborative projects, especially when repeatedly resetting camera views or integrating them into automated pipelines.
To explore this functionality in more depth and see all available options, visit the original documentation page on camera attributes in the Node Specification Language.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
