Untangling a Busy Molecular Scene: Find Visual Models with NSL

A crowded molecular scene can make a simple task surprisingly slow: locating a visual model that is hidden, finding one that is currently visible, or narrowing the scene to a model with a particular name. Clicking through objects one at a time is not always the best way to inspect what is present. In SAMSON, the visual-model attributes in Node Specification Language (NSL) let you describe which visual model nodes you want to match.

The key starting point is the vm attribute space. It matches only visual model nodes, so an expression such as vm.h is scoped to visual models rather than being a general search across every kind of node. That scope is useful when the question is specifically about the visual representation in a scene.

Start with the visibility question

Two useful attributes are visible (short name v) and hidden (short name h). The documentation gives these example expressions:

  • vm.v and not vm.v
  • vm.h and not vm.h

These are handy ways to express opposite boolean conditions. For example, if you are trying to focus your inspection on visual models that are not visible, not vm.v states that condition directly. If you are checking the hidden attribute itself, use vm.h or not vm.h.

It is worth keeping the two attributes distinct in your reasoning: the reference lists visible and hidden separately. Rather than assuming one is simply the inverse of the other in every situation, choose the attribute that matches the question you are asking. Likewise, visibilityFlag (vf) is a separate boolean attribute, with examples vm.vf and vm.vf false. When diagnosing a visibility-related result, these separate expressions help you inspect each property independently.

Use names to narrow the search

If the scene contains many visual models, the name attribute can make a query more specific. Names are written as strings in quotes. The reference examples include vm.n "A" and vm.n "L*". These examples show the quoted-string form to use; they can help you build a name-based expression when you know the relevant model name or naming convention.

Combining a name condition with a visibility condition can make your intent easier to read. For instance, vm.n "A" and not vm.v expresses a search for visual models whose name is A and that do not match the visible condition. As with any expression, confirm that the name and conditions fit the nodes you are trying to find.

Keep selection and material checks separate

Visual models also inherit attributes for selection and materials. You can express selection with vm.selected or not vm.selected. The visual-model reference specifically notes that selected has no short name in this attribute space, so use the full form rather than assuming the node short name s applies here. For the selection flag, the documented forms are vm.sf and vm.sf false.

Material-related checks are available as vm.hm for hasMaterial and vm.om for ownsMaterial; both attributes can also be written with true or false values. These are useful when the issue you are investigating concerns a visual model’s material state, rather than its visibility or selection. Keeping those questions separate makes expressions easier to interpret and debug.

A small, repeatable workflow

  1. Begin with the vm scope so the expression targets visual models.
  2. Choose one property to investigate: for example, vm.v, vm.selected, or vm.hm.
  3. Use not when you need the opposite boolean condition.
  4. Add a name condition such as vm.n "A" only when it helps narrow the result.
  5. Check separate flags independently instead of treating them as synonyms for visibility or selection.

This approach turns a vague question—“Why can’t I find the model I need?”—into a set of small, testable conditions. It also makes your expressions clearer when you revisit them later or share them with a collaborator.

Learn more in the Visual model attributes reference.

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

Comments are closed.