Find the right presentation nodes without losing track of visibility

When a molecular scene becomes busy, the challenge is often not creating another model—it is finding the presentation nodes that match the state you want to inspect. You may need to query what is visible, what is hidden, or what is selected, while avoiding expressions that accidentally target a different kind of node.

SAMSON’s Node Specification Language (NSL) provides a focused set of presentation attributes for this purpose. The key first step is to use the right attribute space: pr matches presentation nodes. The attributes described here are inherited from the general node attribute space, so their names and behavior are shared there; the presentation reference lists the forms available for presentation-node queries.

Start with the state you want to inspect

For a quick visibility check, use pr.v to match presentation nodes whose visible attribute is true, or not pr.v to match those for which it is false. The short name for visible is v. These compact expressions are useful when you want to make the intent of a query easy to scan later.

For the hidden attribute, use pr.h or its full name, pr.hidden. The reference gives pr.h and not pr.h as examples. Since hidden and visible are listed as separate attributes, it is safer to query the specific property you care about rather than assume one expression is interchangeable with the other.

Keep selection and flags distinct

Selection-related queries have two forms in this attribute space. pr.selected checks the selected attribute, and not pr.selected expresses its opposite. Unlike the node attribute space, the presentation form does not use the short name s; use the full word selected.

The related selectionFlag attribute has the short name sf. Its examples include pr.sf and pr.sf false. These are separate attributes in the reference, so don’t replace a query for selected with one for selectionFlag unless the flag itself is what you intend to inspect.

There is a similar pair for visibility: visible uses v, while visibilityFlag uses vf. For example, pr.v queries the visible attribute, whereas pr.vf false queries the visibility flag with a false value. Keeping these names separate makes expressions more precise and easier to review.

Add a name condition when needed

You can also query a presentation node’s name. The short form is n, and names are written as quoted strings: the reference shows pr.n "A" and pr.n "L*". A name condition can help you focus on a particular named presentation node instead of checking every presentation node in the scene. The documentation lists these expressions as examples; consult the NSL examples page for broader expression usage.

A practical way to build a query is to begin with one clear condition—such as pr.v—and add other conditions only when you need them. This makes it easier to spot whether you are asking about visibility, selection, a flag, or a name. It also reduces a common source of confusion: using a familiar-looking shorthand without checking which attribute it represents.

For the complete attribute list and inheritance details, see the SAMSON presentation attributes reference.

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

Comments are closed.