When working with complex molecular systems, controlling what’s displayed—and what isn’t—can drastically improve your modeling workflow. Especially when your scene contains hundreds or thousands of visual representations, the ability to filter and display only the relevant models becomes essential.
The Visual model attributes in SAMSON’s Node Specification Language (NSL) provide a flexible way to efficiently manage what you see in the viewport. Rather than manually selecting and hiding elements, you can use vm (short for visualModel) expressions to programmatically control visibility and selection of visual models. This can save hours of repetitive clicking and help prevent errors that often arise from manual operations.
Why Visibility Matters
Let’s say you’re running a simulation that includes multiple protein chains and various representations—ribbons, backbone traces, surfaces, and more. Maybe you’ve just finished analyzing the active site, and now you’d like to isolate ligand interactions, hiding everything else without altering your actual data. That’s where attributes like vm.visible and vm.vf come into play.
Controlling What’s Displayed
You can use the visible attribute (vm.v) to query or toggle whether a visual model is currently being rendered. For instance:
|
1 |
vm.v |
This filters all visual models that are currently visible. Want to hide everything but a specific representation type or name?
|
1 |
not vm.v |
Or, target by name patterns:
|
1 |
vm.n "Ligand*" and vm.v |
This will highlight all visual models whose names start with Ligand and are currently visible—ideal when you name different ligand representations for clarity.
Flag vs. Boolean?
There are both vm.v (visible) and vm.vf (visibilityFlag) attributes. What’s the difference?
vm.v: Indicates whether the model is currently visible; directly reflects what you see.vm.vf: The internal flag used to control visibility. Useful for scripting or querying settings that might override default behaviors.
Example to hide all elements that were previously made visible by default but kept invisible intentionally:
|
1 |
vm.vf false |
Putting It All Together
Combine multiple criteria to fine-tune your filtering:
|
1 |
vm.n "Surface*" and vm.v |
You’ll be able to select just the visible surface representations, for further actions like deletion, hiding, or styling.
Tired of trying to find where that one stubborn representation is hiding in your model? Use:
|
1 |
not vm.v and vm.n "Backbone" |
This helps track down invisible elements that match your search pattern—no more guesswork.
To learn more about how visual model attributes work and how you can use them to streamline your molecular modeling workflow, explore the full documentation here: 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.
