Find the Right File Node Before the Scene Gets Crowded

When a molecular project contains several files, it can be easy to lose track of which file node you mean. A useful first step is to describe the node you want with SAMSON’s Node Specification Language (NSL), rather than relying on memory or scanning a long list. The file attribute space is designed for this: its expressions match file nodes, and its short name is fi.

Start with the file’s name

If you know a file’s name, use the inherited name attribute. Its short name is n, so the two documented forms look like this:

  • fi.n "A"
  • fi.n "L*"

The quotation marks matter: the attribute expects a string. The second example is useful when a name begins with a recognizable prefix; it illustrates a pattern-style value rather than requiring you to type a complete filename. If you are unsure how a particular pattern is interpreted, test it against the names in your project before depending on it in a larger workflow.

Using fi also makes the intent explicit: you are describing a file node, not every node that happens to share a name. That distinction can help when a scene includes many kinds of objects and you want to keep a query focused.

Check selection state deliberately

File nodes inherit selection-related attributes from the general node attribute space. For the selected attribute, the file-space examples are fi.selected and not fi.selected. These let you express either side of a simple question: is the file node selected, or is it not selected?

There is an easy detail to miss: although selected has the short name s in the node attribute space, the file reference says it has no short name here. When writing a file expression, use the full form fi.selected rather than assuming fi.s is available.

Use selectionFlag when that is what you mean

The separate selectionFlag attribute has the short name sf. The page gives these examples:

  • fi.sf false
  • fi.sf

Because selected and selectionFlag are listed as distinct attributes, it is worth choosing the one that matches your intent instead of treating their names as interchangeable. The file reference establishes the available syntax, but refers readers to the node attribute documentation for inherited attribute details.

A small, repeatable checking routine

  1. Confirm the node type. Begin with fi so the expression targets file nodes.

  2. Identify the file. Use fi.n with a quoted name or the documented name pattern.

  3. State the selection condition. Choose fi.selected, not fi.selected, or the fi.sf form as appropriate.

  4. Keep expressions readable. A clear, narrow expression is easier to review later than a shorthand whose meaning is uncertain.

This approach is especially handy when returning to a project after a break: the expression records what you were looking for, whether that was a file by name or a file with a particular selection state. It also helps prevent a common source of confusion—using a node attribute correctly, but applying it to a broader class of nodes than intended.

For the complete list of file attributes and their examples, see the SAMSON file attributes reference. For inherited behavior, consult the node attributes reference.

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

Comments are closed.