The Small NSL Distinctions That Make Visual-Model Filtering Easier

When a molecular scene gets busy, finding the right visual model can become a task of its own. You may want to identify models that are hidden, check which ones are visible, or narrow the search by name. In SAMSON, the visual-model NSL attribute space gives you a focused way to express those checks: its vm prefix matches visual model nodes, and its attributes let you query properties such as visibility, selection, and material.

A useful first step is to be precise about which property you mean. The visual-model reference lists hidden and visible as separate attributes, with examples vm.h and vm.v. To look for the opposite value of either attribute, the page shows the not form: not vm.h or not vm.v. This gives you direct queries for each state without relying on assumptions about how one attribute relates to the other.

That distinction is handy when you are troubleshooting a crowded view. Rather than asking generally, “Why can’t I see this model?”, check the two properties separately:

  • vm.h — test the hidden attribute.
  • not vm.h — test for models whose hidden attribute is false.
  • vm.v — test the visible attribute.
  • not vm.v — test for models whose visible attribute is false.

Visibility-related flags are available too, but they are distinct attributes in the reference. For example, vm.vf false checks visibilityFlag for the value false, while vm.vf is the example for testing the attribute without specifying a value. Similarly, vm.sf false and vm.sf refer to selectionFlag. If your question is about the visible state, use vm.v; if it is about the flag, use vm.vf. Keeping the names distinct makes a query easier to read and its intent easier to verify.

Selection has one easy-to-miss detail: visual models support selected, but this attribute has no short name in this attribute space. Use vm.selected or not vm.selected. In particular, do not shorten it to vm.s based on a shorthand you may have seen elsewhere; the visual-model reference explicitly says that selected is inherited without the short name s.

You can also use names to narrow down what you are looking for. The full attribute is name, and its short name is n. The documented examples are vm.n "A" and vm.n "L*". Keep the name value in quotes, as shown. If you are building a query for a particular model, starting with a name expression can make the intent clear; you can then check its other listed properties with the relevant attribute.

Material-related checks follow the same readable pattern. Use vm.hm for hasMaterial and vm.om for ownsMaterial. The page lists both as Boolean attributes, so explicit forms such as vm.hm and vm.om are available, along with true or false values where needed—for example, vm.sf false and vm.vf false illustrate the explicit-false style.

A simple way to avoid confusion is to write the property name out before using its abbreviation: “visible” maps to v; “visibilityFlag” maps to vf; “selected” stays selected; and “selectionFlag” maps to sf. The short names save typing, but the full names can be clearer while you are composing or reviewing an expression. Since the vm space matches visual model nodes and these attributes are inherited from the node space, the reference also helps you see which properties are available without treating them as unique to visual models.

For the complete attribute list and its documented 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.