Find the visual models you need without losing track of the rest

A crowded molecular scene can make a simple task surprisingly difficult: finding the visual models that are visible, identifying hidden ones, or narrowing attention to a particular named model. In SAMSON, the Node Specification Language (NSL) provides a compact way to describe visual models by their attributes. That makes it easier to turn a vague scene-inspection problem into a specific query.

The visual-model attribute space is written visualModel, or vm for short. It matches only visual model nodes. Several of its attributes are inherited from the general node attribute space, so their names and behavior are shared rather than unique to visual models.

Start with the view state

When the immediate question is whether a visual model is marked visible, use vm.v. To look for models that are not marked visible, use not vm.v. The related hidden attribute has the short name h: vm.h and not vm.h let you query that attribute directly.

These are separate attributes in the reference, so choose the one that matches the question you are asking. For example, if you are auditing models based on their visibility state, use the visible attribute; if you specifically need to inspect the hidden attribute, query that instead. Being explicit is more useful than relying on memory when you return to a complex scene later.

Separate selection from selection flags

Selection-related queries are also available. vm.selected matches visual models with the selected attribute, and not vm.selected expresses its opposite. The reference notes that this inherited attribute does not have the short name s in the visual-model space.

There is also selectionFlag, abbreviated sf. The documented examples are vm.sf and vm.sf false. Keeping selected and selectionFlag distinct in your query is helpful: they are separate attributes in the reference, even though both sound selection-related.

Use names when the scene has many models

If you know a model’s name, the name attribute can make a query more targeted. Names are written as strings in quotes; the reference gives vm.n "A" and vm.n "L*" as examples. The long form is name, and its short name is n. For a reusable search, keeping the name expression alongside a visibility or selection expression can help you remember what you were trying to find.

A small, repeatable checking routine

  1. Decide what you need to inspect: visibility, hidden state, selection, a selection flag, or a name.

  2. Use the corresponding documented attribute, such as vm.v, vm.h, vm.selected, vm.sf, or vm.n "A".

  3. When you need the opposite of a Boolean attribute, use the documented not form, such as not vm.v.

  4. Keep the expression close to the task it answers. A short, clear query is easier to revisit than an unexplained collection of criteria.

The visual-model reference also lists hasMaterial (hm), ownsMaterial (om), and visibilityFlag (vf). Each accepts true or false; the documented examples include vm.hm, vm.om, and vm.vf false. These attributes give you additional ways to describe visual models when the view-state and naming checks are not enough.

For the complete attribute list and examples, see the SAMSON visual model attributes reference.

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

Comments are closed.