bug: Workbench toolbars not appearing when switching workbenches #230

Closed
opened 2026-02-15 00:35:10 +00:00 by forbes · 0 comments
Owner

Summary

When switching to workbenches like Part Design, toolbars for that workbench do not appear. The toolbar area remains populated only with the global toolbars (File, Edit, View, Structure, etc.) and none of the workbench-specific toolbars are shown.

Root Cause

Workbenches like PartDesign, Sketcher, and Assembly mark their toolbars with DefaultVisibility::Unavailable, meaning they are hidden by default and their toggle actions are disabled. These toolbars rely entirely on the EditingContextResolver (a Kindred Create feature in src/Gui/EditingContext.cpp) to call ToolBarManager::setState(toolbars, ForceAvailable) to make them visible.

The EditingContextResolver only matches specific editing states:

Context ID Match Condition Toolbars Shown
sketcher.edit Sketch object in edit mode Edit Mode, Geometries, Constraints, etc.
partdesign.feature Active body with children PD Helper/Modeling/DressUp/Transform
partdesign.body Active body (empty) PD Helper Features, Sketcher
assembly.edit Assembly in edit mode Assembly, Joints, Management
assembly.idle Assembly active, not editing Assembly
empty_document Any active document Structure

Gap: If you switch to the Part Design workbench but don't have a Body activated (or if the context doesn't match any of the registered conditions), the workbench's toolbars remain hidden because no context calls ForceAvailable for them.

Diagnostic Script

Run in FreeCAD's Python console to see toolbar visibility state:

from PySide import QtWidgets

mw = FreeCADGui.getMainWindow()
print(f"{Status:<12} {Toggle:<8} {Toolbar
## Summary When switching to workbenches like Part Design, toolbars for that workbench do not appear. The toolbar area remains populated only with the global toolbars (File, Edit, View, Structure, etc.) and none of the workbench-specific toolbars are shown. ## Root Cause Workbenches like PartDesign, Sketcher, and Assembly mark their toolbars with `DefaultVisibility::Unavailable`, meaning they are hidden by default and their toggle actions are disabled. These toolbars rely entirely on the `EditingContextResolver` (a Kindred Create feature in `src/Gui/EditingContext.cpp`) to call `ToolBarManager::setState(toolbars, ForceAvailable)` to make them visible. The `EditingContextResolver` only matches specific editing states: | Context ID | Match Condition | Toolbars Shown | |---|---|---| | `sketcher.edit` | Sketch object in edit mode | Edit Mode, Geometries, Constraints, etc. | | `partdesign.feature` | Active body with children | PD Helper/Modeling/DressUp/Transform | | `partdesign.body` | Active body (empty) | PD Helper Features, Sketcher | | `assembly.edit` | Assembly in edit mode | Assembly, Joints, Management | | `assembly.idle` | Assembly active, not editing | Assembly | | `empty_document` | Any active document | Structure | **Gap:** If you switch to the Part Design workbench but don't have a Body activated (or if the context doesn't match any of the registered conditions), the workbench's toolbars remain hidden because no context calls `ForceAvailable` for them. ## Diagnostic Script Run in FreeCAD's Python console to see toolbar visibility state: ```python from PySide import QtWidgets mw = FreeCADGui.getMainWindow() print(f"{Status:<12} {Toggle:<8} {Toolbar
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#230