A molecular scene can be confusing for a simple reason: a node’s own state is not always the state you see in the hierarchy. An atom may have its visibility flag turned on but still be hidden because an ancestor is hidden. The same distinction applies to selection and locking. If a query seems to return a surprising result, the key question is often whether you asked about a node’s own flag or its effective state.
SAMSON’s Node Specification Language (NSL) lets you query both. This is useful when checking a crowded model, finding nodes affected by a parent group, or narrowing a scene to the objects that need attention.
Flags versus effective state
visibilityFlag describes a node’s own visibility setting. The short form is n.vf. By contrast, visible accounts for the node’s ancestors as well: a node is visible only when its own visibility flag and those of its ancestors are true. Its short form is n.v.
node.visibilityFlag false(orn.vf false) finds nodes whose own visibility flag is off.node.visible(orn.v) finds nodes that are visible in the hierarchy.not node.visible(ornot n.v) finds nodes that are not effectively visible.
That last query is especially useful for investigating hidden parts of a structure. A result from not n.v does not necessarily mean each returned node has its own visibility flag set to false. A hidden ancestor can make descendants invisible too. Conversely, n.vf false focuses on the node’s own flag rather than inherited visibility.
The same distinction applies to selection
selectionFlag reports a node’s own selection flag; its short form is n.sf. The selected attribute, n.s, also considers selected ancestors. This means a descendant can match node.selected even when its own selection flag is not set.
node.selectionFlag true(orn.sf true) matches nodes whose own selection flag is true.node.selected(orn.s) matches nodes selected either directly or through an ancestor.not node.selected(ornot n.s) finds nodes that are not selected in the hierarchy.
When you need to distinguish direct selection from inherited selection, query the flag and effective state separately. That small check can prevent you from interpreting a descendant’s match as proof that the descendant itself was selected.
Check inherited locking, too
Locking follows a similar pattern. lockedFlag (n.lf) checks a node’s own flag, while locked (n.l) also matches nodes affected by a locked ancestor. For example, compare node.lockedFlag true with node.locked when you are trying to understand whether a node is locked directly or because of its place in the hierarchy.
A practical troubleshooting sequence
If a part of the model appears hidden, unexpectedly selected, or locked, try this sequence:
- Query the effective state, such as
n.v,n.s, orn.l, to identify nodes experiencing that state. - Query the corresponding flag, such as
n.vf true,n.sf true, orn.lf true, to inspect direct flags. - Compare the results. A difference can indicate that an ancestor contributes to the effective state.
- Use
node.typeto narrow the results when you only want a particular node type. For instance,node.type atommatches atoms.
NSL also provides short names for concise expressions: node.visible is n.v, node.selected is n.s, and node.locked is n.l. Use whichever form is easier to read in your workflow.
For the full node-attribute reference and additional categories and examples, see the SAMSON NSL node attributes documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
