Labels can make a molecular scene easier to read—until they overlap, become hard to find, or distract from the structure you are trying to inspect. A useful first step is to narrow the scene to label nodes with a Node Specification Language (NSL) expression. The label attribute space, abbreviated la, matches only label nodes, so it gives you a focused way to describe which labels you mean.
This distinction matters: a label query is not the same as a query for atoms or other molecular nodes. If your immediate problem is “which labels am I dealing with?”, begin with la expressions rather than a broader node search.
Start with a simple label check
The inherited hidden and visible attributes let you express basic display-related checks:
la.hmatches labels whosehiddenattribute is true;not la.hexpresses the opposite.la.vmatches labels whosevisibleattribute is true;not la.vexpresses the opposite.
These are useful when you want to inspect one of those states without mixing label nodes into a query for other node types. Keep the attribute names in mind: hidden and visible are separate attributes in the reference. Use the one that corresponds to the question you are asking, rather than treating the terms as interchangeable.
Use names to narrow the search
If you know a label’s name, query the name attribute. The documented examples include la.n "A" and la.n "L*". The short form is la.n, where n is the short name for name. Put the value in quotes, as in the examples.
A practical approach is to start with a name-based expression when you know what a label is called, then add another condition only if you need to narrow the result further. The reference page lists the available attributes and sample expressions; it does not define the matching behavior of every possible name pattern. If a pattern such as "L*" is important to your workflow, check the broader NSL documentation before relying on assumptions about how it matches.
Don’t confuse selection with selection flags
Labels also inherit selected and selectionFlag. You can express selection with la.selected or its negation, not la.selected. One easy-to-miss detail: the label attribute space does not provide the short name s for selected. Write the full form, la.selected.
selectionFlag has the short name sf, so the documented forms include la.sf and la.sf false. The names are similar, but they are separate attributes in the reference. Choose the one that matches the condition you intend to express; don’t substitute one for the other just because both relate to selection.
A small, reliable workflow
- Begin with
lato keep the query scoped to labels. - Choose one attribute that matches your question: name, visibility, hidden state, or selection state.
- Use the documented short names where available:
n,h,v,sf, andvf. - For
selected, use the full attribute name because there is no label-specificsshort form. - Check the expression against the reference when combining conditions or depending on name-pattern behavior.
This keeps troubleshooting concrete: first identify the label nodes your expression describes, then refine the query with the relevant attribute. It also helps avoid a common source of confusion—assuming an expression for labels will match other kinds of scene nodes.
For the complete attribute list and examples, see the SAMSON label attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
