Overview
MeshInspector’s user interface is fully represented in the Python API as a hierarchical tree.
Through this structure, you can programmatically navigate the Ribbon, find specific tabs, groups, and tools, and execute actions just as if you clicked them manually.
This article explains:
-
How the UI tree is structured
-
How to list available tabs, groups, and tools
-
How to programmatically open a tab and launch a tool
By the end, you’ll know how to reproduce any sequence of clicks through Python commands.
Understanding the UI Tree
The Ribbon interface is modeled as a tree of elements, each accessible by a path — a list of strings describing its position.
Each node of the tree corresponds to a specific UI element (a tab, button, tool, or group).
Hierarchy Structure
| Level | Element Type | Description | How to Access via API | Example Path |
|---|---|---|---|---|
| 1 | Tab | The top-level sections of the Ribbon — for example, Home, View, Mesh Edit, Mesh Repair. Each tab organizes a collection of tools. | Tabs are listed as buttons inside the RibbonTabs group. |
['RibbonTabs', 'Mesh Repair'] |
| 2 | Tool | The functional unit inside a tab. Tools are buttons that open dialogs or panels (e.g., Mesh Healer, Fill Holes, Remesh). Each tool performs a specific operation. | Access tools of the currently active tab with uiListEntries(['Ribbon']). Activate one using uiPressButton(['Ribbon', '<Tool Name>']). |
['Ribbon', 'Mesh Healer'] |
| 3 | Parameter | The controls within a tool’s dialog — sliders, checkboxes, numeric fields, or sub-buttons that adjust tool behavior. | List them using uiListEntries(['<Tool Name>']). Read or modify with uiReadValue…() / uiWriteValue…(). |
['Mesh Healer', 'Repair Resolution'] |
Listing Available Tabs
You can start by listing all available Ribbon tabs in MeshInspector:
from meshlib import mrviewerpy as mv
tabs = mv.uiListEntries(['RibbonTabs'])
print("Available tabs:", [t.name for t in tabs])
Example Output:
Available tabs: ['CT', 'Home', 'Inspect', 'Mesh Edit', 'Mesh Repair', 'Points', 'Select', 'Transform', 'View']
This command gives you all the top-level tabs visible in the UI.
Opening a Tab
To activate a specific tab programmatically, use uiPressButton() with the tab name:
from meshlib import mrviewerpy as mv
mv.uiPressButton(['RibbonTabs', 'Mesh Repair'])
mv.Viewer().skipFrames(1)
print("Opened the 'Mesh Repair' tab.")
The skipFrames() call ensures the viewer updates before you continue to the next command.
Once a tab is active, you can query its contents — the tools inside it — using the path ['Ribbon'].
Listing Tools in the Active Tab
After opening a tab, use uiListEntries(['Ribbon']) to discover all tools under it:
from meshlib import mrviewerpy as mv
# Open the desired tab
mv.uiPressButton(['RibbonTabs', 'Mesh Repair'])
mv.Viewer().skipFrames(1)
# List all tools under that tab
tools = mv.uiListEntries(['Ribbon'])
print("Tools in Mesh Repair:", [t.name for t in tools])
Example Output:
Tools in Mesh Repair: ['##DropDownFill Holes', '##DropDownReduce Noise', '##DropDownSeparate Components', '##DropDownStraighten Boundary', 'Decimate Mesh', 'Fill Holes', 'Fix Tunnels', 'Flip Normals', 'Make Delone', 'Mesh Healer', 'Position Vertices Smoothly', 'Re-mesh', 'Rebuild Mesh', 'Reduce Noise', 'Reorient Mesh', 'Separate Components', 'Stitch two Holes', 'Straighten Boundary', 'Subdivide Mesh', 'Unite Close Vertices', 'Unite Many Meshes']
This gives you a complete inventory of the tools you can interact with.
Finding Where a Tool Lives
Sometimes you may not know which tab a tool belongs to. You can search all tabs programmatically:
from meshlib import mrviewerpy as mv
TARGET_TOOL = 'Mesh Healer'
found = None# List all tabs
tabs = mv.uiListEntries(['RibbonTabs'])
tab_names = [t.name for t in tabs]# Search each tab for the target tool
for tab in tab_names:
mv.uiPressButton(['RibbonTabs', tab])
mv.Viewer().skipFrames(1)
tools = mv.uiListEntries(['Ribbon'])
tool_names = [e.name for e in tools]
if TARGET_TOOL in tool_names:
found = tab
breakif found:
print(f"Tool '{TARGET_TOOL}' is in tab: {found}")
print("Path:", ['RibbonTabs', found], "→", ['Ribbon', TARGET_TOOL])
else:
print(f"Tool '{TARGET_TOOL}' not found.")
Example Output:
Tool 'Mesh Healer' is in tab: Mesh Repair
Path: ['RibbonTabs', 'Mesh Repair'] → ['Ribbon', 'Mesh Healer']
Opening a Tool Programmatically
Once you know the correct tab and tool name, you can activate the tool panel directly:
from meshlib import mrviewerpy as mv
# Step 1: Open the correct tab
mv.uiPressButton(['RibbonTabs', 'Mesh Repair'])
mv.Viewer().skipFrames(1)# Step 2: Launch the tool
mv.uiPressButton(['Ribbon', 'Mesh Healer'])
mv.Viewer().skipFrames(1)print("Tool 'Mesh Healer' launched.")
The tool window now appears on the right side of the UI, just as if you clicked it manually.
Understanding Path Naming
Sometimes internal tool names differ slightly from what appears in the interface.
For example:
-
The tool labeled “Section” in the UI may have the internal name “Object Section.”
-
A grouped dropdown might expose tools with prefixes like “##DropDown…”
Best Practice:
Always call uiListEntries() before trying to access or press a button. This ensures you use the correct internal name.
Practical Tip: Refreshing the Viewer
Whenever a script changes the active tab, tool, or parameter, call:
mv.Viewer().skipFrames(1)
This guarantees that MeshInspector updates its internal state and visuals before continuing to the next command.
Summary
In this article, you learned how to:
-
Explore MeshInspector’s Ribbon tree structure.
-
List all tabs and tools programmatically.
-
Open specific tabs and tools through the Python API.
-
Identify internal tool names to ensure reliable scripting.
These operations form the foundation of UI automation.
In the next guide — Controlling Tools & Parameters — you’ll learn how to inspect, read, and modify the parameters inside a tool once it’s open.