Find the Right File Nodes Without Losing Your Place

In a molecular design project, the hard part is not always finding a molecule. It can be finding the right file node among many items in a document—especially when names are similar or you need to isolate files by selection state. SAMSON’s Node Specification Language (NSL) provides a compact way to describe those file nodes using the file attribute space.

This is useful when a broad scene contains several imported or organized files and you want a more deliberate way to specify which file nodes you mean. The key is to keep the scope clear: file attributes match file nodes, and the attribute-space prefix is fi.

Start with the file name

To describe a file node by name, use fi.n followed by a quoted string. For example:

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

Quotes matter: the name value is written as a string. The documentation includes "L*" as an example, which can be useful when you want to express a name pattern rather than write out a single short name. If you are unsure how a particular pattern is interpreted in your workflow, test it against a small, familiar set of file nodes before relying on it in a larger project.

This kind of expression can make a file-selection task easier to communicate, too. Instead of telling a collaborator to “pick the file with the L name,” you can share the exact expression you used and make the intended criterion explicit.

Use selection state as a criterion

File nodes also inherit boolean attributes from the broader node attribute space. You can test whether a file node is selected with fi.selected, or negate that condition with not fi.selected. This gives you a concise way to describe selected versus unselected file nodes without adding a name condition.

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

  • fi.sf
  • fi.sf false

These expressions let you state the boolean value you are interested in. The documentation also notes an important naming detail: although selected is inherited from node.selected, it does not have the short name s in the file attribute space. Use fi.selected for this attribute; use fi.sf when referring to selectionFlag.

Keep the scope in mind

A helpful way to avoid confusing results is to read an expression from left to right: fi sets the attribute space to file nodes, and the part after it specifies the attribute or condition. These are not general-purpose filters for every kind of node in a molecular scene. If your target is not a file node, file-space attributes are not the right criteria to use.

For a practical check, begin with one simple condition—such as a name or selection state—and confirm that it describes the file nodes you expect. Then refine the expression if needed. Keeping the expression small makes it easier to spot a mistaken attribute name or a mismatch between the kind of node you meant to describe and the file-only scope.

For the complete attribute list and syntax examples, see the SAMSON file attributes reference.

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

Comments are closed.