Molecular modelers often deal with complex scenes involving hundreds or thousands of molecular entities. Managing which components are visible in a project is key to staying organized and productive. However, sometimes toggling visibility feels chaotic, especially when visual models behave unexpectedly. If you’ve ever thought, “Wait, I unchecked ‘visible’—why is it still displaying?”, you’re not alone.
This article introduces the concepts of visible and visibilityFlag in SAMSON’s Node Specification Language (NSL). These attributes provide precise control over whether a visual model should be shown, helping you better manage large molecular systems and avoid confusion. These features are part of the visualModel attribute space, abbreviated as vm.
Visibility vs. Visibility Flag
In SAMSON, visual models can be filtered using the attributes vm.v (for visible) and vm.vf (for visibilityFlag). Although they sound similar, they serve distinct functions.
vm.v: This indicates whether a visual model is currently visible or not. Settingnot vm.vretrieves all models that are invisible.vm.vf: This determines whether the visibility of a model can actually be controlled or not. It’s a flag that tells SAMSON whether the node should respond to visibility toggles.
Why is this useful? Because in rare cases, especially when scripting or using third-party extensions, some models might have vm.vf false, meaning even if you request to hide them, they won’t respond. This attribute helps diagnose why certain models seem to “ignore” visibility settings.
Practical Use Cases
Let’s say you want to clean up a scene by hiding all models that are currently visible:
|
1 |
not vm.v |
Or, to find which models might not respond to visibility toggles and may require additional permissions or logic to hide:
|
1 |
vm.vf false |
Combine queries to focus on target subsets:
|
1 |
not vm.v and vm.vf |
This selects nodes that are hidden but have the visibility flag set to true—meaning you can re-enable them if needed.
Debugging Display Issues
If you’re unsure why a model is still visible after unchecking it in the UI or setting visible = false from a script, check both attributes. While visible deals with the current state, visibilityFlag determines whether that state can even be changed.
Bonus Tip: Combine with Selection Attributes
You can combine visibility flags with the vm.sf (selectionFlag) and vm.selected attributes to filter based on both visibility and selection. For example:
|
1 |
vm.selected and not vm.v |
This gives you selected models that are currently hidden. Useful when preparing visual presentations where only selected parts of the system should appear.
Conclusion
Understanding how visible and visibilityFlag work in the Node Specification Language can prevent confusion and help you gain finer control over what you see—and what you don’t—in your molecular scenes. Applying these filters allows you to handle large projects more efficiently and spot inconsistencies early on.
To learn more, visit the original documentation page: https://documentation.samson-connect.net/users/latest/nsl/visualModel/.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
