When a Molecular View Looks Wrong: Query Presentation State Before You Rebuild

A molecular scene can be confusing for a simple reason: the presentation state you want to inspect is not always the same thing as the molecular identity you are thinking about. A node may be hidden, not visible, selected, or carry a particular selection or visibility flag. When you need to find presentation nodes with one of these properties, SAMSON’s Node Specification Language (NSL) provides a compact way to describe the state you are looking for.

The presentation attribute space uses the prefix pr and matches only presentation nodes. That is a useful boundary to keep in mind: these expressions are for querying presentation nodes, rather than being general-purpose filters for every kind of node in a molecular model.

Start with the state you need to inspect

For a quick check of visibility-related state, the reference lists two attributes: visible, abbreviated v, and visibilityFlag, abbreviated vf. Their example expressions are:

  • pr.v to match presentation nodes whose visible attribute is true.
  • not pr.v to match those whose visible attribute is false.
  • pr.vf false to match nodes with a false visibilityFlag.
  • pr.vf to match nodes whose visibilityFlag is true.

These attributes have related names, but the documentation lists them separately. If you are investigating a visibility issue, query the attribute that corresponds to the property you actually want to inspect rather than assuming the two names are interchangeable.

Check hidden state separately

The hidden attribute is also available in the presentation space, with the short name h. Try pr.h to find presentation nodes with a true hidden value, or not pr.h for the opposite value. The attribute is inherited from the general node attribute space, as are visible and visibilityFlag.

Keeping these checks separate can make troubleshooting more systematic. Instead of guessing from what you see in the viewport, inspect the specific state you are interested in: hidden, visible, or the visibility flag. The expressions describe different attributes; the reference does not say that one is a substitute for another.

Selection has two useful forms

To query whether a presentation node is selected, use pr.selected; use not pr.selected for nodes that are not selected. This attribute is inherited from node.selected, but the presentation attribute space does not provide the short name s for it. In other words, write the full form pr.selected rather than trying to shorten it.

For the selection flag, the short name is sf. The reference gives pr.sf and pr.sf false as examples. This is another case where it helps to be precise: selected and selectionFlag are both available, but they are separately named attributes.

Use names to narrow a presentation query

Presentation nodes also inherit the name attribute, abbreviated n. The examples include pr.n "A" and pr.n "L*". This can help when you are inspecting a particular named presentation node, or want to explore a name pattern alongside the state attributes listed above. Names are written in quotes.

A practical troubleshooting habit is to begin with one attribute at a time: check pr.v or not pr.v, then inspect pr.h, and use pr.selected or pr.sf when selection is the issue. The full attribute names and short forms are summarized in the presentation NSL reference, which also links to the broader NSL guide and examples.

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

Comments are closed.