For molecular modelers working with detailed structural representations, managing and filtering light nodes effectively can be a crucial task. SAMSON’s Node Specification Language (NSL) provides a powerful way to specify, query, and manipulate light attributes associated with molecular models. This blog post delves into how you can leverage light attributes efficiently in SAMSON’s ecosystem.
What Are Light Attributes?
Light attributes belong to the light attribute space in NSL, meaning they are intended specifically for nodes that represent light. They help you control and query the properties of light nodes, enhancing your ability to assess and visualize your molecular models. The short name for the light attribute space is li, which provides a concise way to write NSL expressions.
For instance, you can check whether light nodes are visible, hidden, selected, or carry specific flags. This becomes essential when handling complex visualizations or need to script scenarios for presentations, modeling, or simulations. Let’s explore some key attributes within the light space and how they can be used.
Key Attributes in the Light Space
| Attribute Name | Short Name | Possible Values | Example Expressions |
|---|---|---|---|
hidden |
h |
true, false |
li.h, not li.h |
visible |
v |
true, false |
li.v, not li.v |
name |
n |
Strings in quotes | li.n "MainLight", li.n "Light*" |
selected |
— | true, false |
li.selected, not li.selected |
selectionFlag |
sf |
true, false |
li.sf true, li.sf |
visibilityFlag |
vf |
true, false |
li.vf true, li.vf |
Common Use Cases
One of the most common needs for molecular modelers is to ensure light nodes are properly configured for visualization. For example:
- Highlighting specific lights: By using
li.n, you can filter lights by their name. For instance,li.n "KeyLight"will select nodes with the name “KeyLight”. - Toggling visibility: Use
li.vorli.hto show or hide lights. This is especially useful when working with layered lighting setups for different molecular views. - Selection-related scripting: The
li.selectedandli.sfattributes allow for finer control over which lights are included in specific operations or presented to certain audiences. - Applying filters: Combine these attributes to narrow down complex data. For example,
li.v and not li.hwill return all visible light nodes that are not hidden.
Using Example Expressions
The NSL examples provided in the table above simplify interactions with the software. For instance, suppose you wish to query all light nodes with visibilityFlag (i.e., li.vf) set to true and not hidden. You could write:
|
1 |
li.vf and not li.h |
This single-line expression can immediately pinpoint lights following specific criteria, saving you time in navigating complex molecular models.
Conclusion
Understanding and using light attributes effectively can streamline your work and make your molecular models both easier to understand and more visually appealing. By mastering the light attribute space in NSL, you enhance your control over visualizations, customize your workflows, and optimize presentations.
To explore the full range of light attributes in depth, visit the official documentation page at https://documentation.samson-connect.net/users/latest/nsl/light/.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
