Find the Right Presentation Nodes Without Losing Your Place

When a molecular scene contains many presentation nodes, a small search can save time: instead of scanning names or checking visibility one item at a time, describe the nodes you want with a Node Specification Language (NSL) expression. The challenge is choosing the right attribute. Presentation nodes inherit several attributes from the node attribute space, and some related names—such as visible, hidden, and visibilityFlag—are easy to mix up.

This guide focuses on reading and building presentation-attribute expressions. It is useful when you need to narrow a selection or search to presentation nodes based on a name, visibility-related value, or selection-related value. The expressions below describe matching criteria; they do not, by themselves, explain or imply a change to the scene.

Start by limiting the search to presentations

The presentation attribute space has the short name pr and matches only presentation nodes. That prefix is the simplest way to make an expression’s intended scope clear. For example, pr.v checks the visible attribute in the presentation space, while pr.n "A" checks a presentation node’s name.

Being explicit is especially helpful when you are assembling a longer expression or revisiting it later. The prefix tells you which attribute space you are querying, and the attribute name tells you what property is being tested. Where a short name is available, it can make expressions quicker to type; the full attribute name can be easier to read when you are still learning the vocabulary.

Use names to make a search more specific

The name attribute accepts strings in quotes. The documentation gives pr.n "A" and pr.n "L*" as examples. Quotation marks make the string boundary clear, particularly when the name includes punctuation such as an asterisk. If you are trying to locate one named presentation, start with its name condition and then add another condition only if you need to narrow the match further.

Read visibility and selection attributes precisely

Presentation nodes inherit hidden, visible, visibilityFlag, selected, and selectionFlag from the node attribute space. These are separate attributes, not interchangeable spellings. For example, pr.v refers to visible, while pr.vf refers to visibilityFlag. Likewise, pr.selected and pr.sf refer to different attributes: selected and selectionFlag.

When you need to test a Boolean value, the examples show both positive and negated forms. Use pr.v or not pr.v for the visible attribute; use pr.h or not pr.h for hidden. The examples also show explicit values, such as pr.vf false and pr.sf false. Keeping the attribute name visible in your expression helps prevent an easy mistake: assuming that a visibility flag is the same thing as visibility, or that a selection flag is the same thing as selection.

A practical way to build an expression

  1. Choose the presentation scope by using pr.

  2. Select one attribute to test, such as n, v, or sf.

  3. Use a quoted string for a name, or a Boolean value or negation for a Boolean attribute.

  4. Check that the expression refers to the property you actually mean. In particular, distinguish selected from selectionFlag, and visible from visibilityFlag.

A few documented patterns to keep handy are pr.n "A", pr.v, not pr.v, pr.sf false, and pr.vf false. These compact expressions provide a starting point for more targeted searches without confusing the attribute space or the property being tested.

For the complete attribute list and additional context, see the SAMSON presentation attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.