Skip to content

Sketcher: preserve local overlay depth for dimensions and grid#29280

Merged
hyarion merged 2 commits intoFreeCAD:mainfrom
tritao:fix/sketcher-dimension-depth-local-z
Apr 11, 2026
Merged

Sketcher: preserve local overlay depth for dimensions and grid#29280
hyarion merged 2 commits intoFreeCAD:mainfrom
tritao:fix/sketcher-dimension-depth-local-z

Conversation

@tritao
Copy link
Copy Markdown
Contributor

@tritao tritao commented Apr 11, 2026

This fixes depth layering for face-attached sketches in edit mode.

The branch does two things:

  1. Preserve the local Sketcher overlay Z for dimension/helper lines.
  2. Lift the Sketcher grid slightly off the support face so it remains visible.

Problem

When editing a sketch attached to a face, dimension/helper lines could disappear behind the model geometry.

The underlying issue was that some SoDatumLabel drawing paths used glVertex2f(...), which discards the incoming Z coordinate. That flattened those lines onto the sketch plane instead of using the local Sketcher overlay depth that had already been assigned upstream.

With depth testing enabled, those lines could then lose against the support face.

After correcting that, the grid exposed the same problem from the opposite direction: it was still generated directly on the support plane, so it rendered behind the face while dimensions were correctly using their local overlay depth.

Fix

Preserve local Z for dimension lines

In src/Gui/SoDatumLabel.cpp, the affected dimension/helper line paths now use the full 3D input points instead of dropping Z.

This makes those lines render at the same local Sketcher overlay depth they already receive from the constraint code, including the correct front/back behavior.

Lift the grid off the support face

In src/Mod/Part/Gui/ViewProviderGridExtension.cpp, the grid is now emitted with a small local Z offset toward the active viewing side instead of being placed directly on the support plane.

This keeps the grid visible while still leaving it below the rest of the sketch overlay.

Result

  • dimension lines no longer disappear behind the support geometry
  • the Sketcher grid remains visible
  • both now follow the existing local Sketcher depth layering instead of using conflicting plane-level depth

Fixes #27924

@github-actions github-actions bot added Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Mod: Part Related to the Part Workbench labels Apr 11, 2026
@maxwxyz maxwxyz added the Approved: Tested The PR was manually tested and approved label Apr 11, 2026
Copy link
Copy Markdown
Collaborator

@maxwxyz maxwxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested

@maxwxyz maxwxyz added the backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 label Apr 11, 2026
@maxwxyz maxwxyz moved this from Queue to Approved in Merge Queue Apr 11, 2026
@maxwxyz maxwxyz requested a review from FEA-eng April 11, 2026 12:30
@maxwxyz maxwxyz added this to the 1.2 milestone Apr 11, 2026
@hyarion hyarion merged commit f1c551f into FreeCAD:main Apr 11, 2026
27 of 28 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Merge Queue Apr 11, 2026
@freecad-ci-runner
Copy link
Copy Markdown
Collaborator

Successfully created backport PR for releases/FreeCAD-1-1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved: Tested The PR was manually tested and approved backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Mod: Part Related to the Part Workbench

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Sketcher: Dimension extension lines hidden behind the model

4 participants