When a Model Looks Wrong: Find the Right Visual Nodes with NSL

A molecular scene can be difficult to inspect when visual models are hidden, not visible, or simply not the nodes you meant to examine. The first useful step is to separate what you are asking about: visibility, selection, naming, or material ownership. SAMSON’s Node Specification Language (NSL) provides attributes for querying each of these properties in its visualModel attribute space.

The space has the short name vm and matches visual model nodes. Its attributes are inherited from the general node attribute space, so you can use them to narrow your attention to visual models without confusing them with other node types.

Check visibility without guessing

Two visibility-related attributes are available: visible (short name v) and hidden (short name h). Their examples let you query either value directly or negate it:

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

This is useful when the immediate question is simply whether a visual model has a particular visibility value. Keep visible and hidden as distinct attributes in your query: the reference lists both, rather than defining one as an alias for the other.

Separate selection from selection flags

Selection has a similar pair of concepts to keep straight. You can query selected with vm.selected or not vm.selected. Unlike several other attributes on this page, selected has no short name in the visual-model attribute space. In particular, do not substitute vm.s based on the node-level short name: the documentation explicitly says that this inherited attribute is provided without the short name s.

There is also selectionFlag, abbreviated sf, with examples vm.sf and vm.sf false. These are separate attributes in the reference. If a query about selection does not answer the question you have, try identifying which of these attributes you actually need rather than treating them as interchangeable.

Use names to target a visual model

When you know a visual model’s name, the name attribute (short name n) accepts strings in quotes. The page gives vm.n "A" and vm.n "L*" as examples. Quoting the value makes the intended string clear and gives you a direct way to express a name-based query.

Ask the material question precisely

The material-related attributes are hasMaterial (hm) and ownsMaterial (om). Both accept true or false; the reference shows vm.hm and vm.om. Because the page lists them separately, choose the attribute that matches the property you want to inspect instead of using one as a stand-in for the other.

A small troubleshooting routine

  1. Start with the type of node: use the vm attribute space for visual models.
  2. State the property you want to check: visibility, selection, name, or material.
  3. Use the documented long name or short name, remembering that selected has no short name here.
  4. For Boolean attributes, test the positive or negative form shown in the reference, such as vm.v or not vm.v.

This approach helps turn a vague scene-inspection problem into a specific query: which visual models have the attribute value I want to examine? For the complete attribute list and examples, see the Visual model attributes reference.

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

Comments are closed.