fix(assembly): handle non-standard datum element types in Distance joint classification #319

Merged
forbes merged 1 commits from fix/datum-plane-classification-all-hierarchies into main 2026-02-23 03:20:06 +00:00
Owner

Problem

Follow-up to #318. The previous fix broadened datum detection to check isDatumPlane() instead of just isDerivedFrom<App::Plane>(), but still gated the check on type.empty(). This missed PartDesign datum planes referenced through a body, where the sub-name looks like:

_2IN_SQUARE_TUBE_42IN_LG.ZPlane_Offset_004.Plane

splitSubName extracts "Plane" as the element type — not empty, but also not a standard geometry type (Face/Edge/Vertex). Part::Datum::getSubObject() ignores this trailing element entirely, but getElementTypeFromProp() still sees it.

Since "Plane" is not empty, the datum detection was skipped, and since it's not Face/Edge/Vertex, the main geometry chain couldn't classify it either → DistanceType::Other → wrong fallback.

Symptoms

Fix

Replace type.empty() gate with isNonGeomElement(type) — a lambda that checks type != "Face" && type != "Edge" && type != "Vertex". This catches:

  • Empty strings (bare datum references ending with .)
  • "Plane" (PartDesign datums referenced through body)
  • Any other non-standard element type a datum object might produce
## Problem Follow-up to #318. The previous fix broadened datum detection to check `isDatumPlane()` instead of just `isDerivedFrom<App::Plane>()`, but still gated the check on `type.empty()`. This missed PartDesign datum planes referenced through a body, where the sub-name looks like: ``` _2IN_SQUARE_TUBE_42IN_LG.ZPlane_Offset_004.Plane ``` `splitSubName` extracts `"Plane"` as the element type — not empty, but also not a standard geometry type (Face/Edge/Vertex). `Part::Datum::getSubObject()` ignores this trailing element entirely, but `getElementTypeFromProp()` still sees it. Since `"Plane"` is not empty, the datum detection was skipped, and since it's not Face/Edge/Vertex, the main geometry chain couldn't classify it either → `DistanceType::Other` → wrong fallback. ### Symptoms - Joints 003, 004, 007, 008 still logged `unhandled DistanceType Other` after #318 - Same joints now correctly detected with this fix ## Fix Replace `type.empty()` gate with `isNonGeomElement(type)` — a lambda that checks `type != "Face" && type != "Edge" && type != "Vertex"`. This catches: - Empty strings (bare datum references ending with `.`) - `"Plane"` (PartDesign datums referenced through body) - Any other non-standard element type a datum object might produce
forbes added 1 commit 2026-02-23 03:07:12 +00:00
fix(assembly): classify datum planes from all class hierarchies in Distance joints
Some checks failed
Build and Test / build (pull_request) Has been cancelled
4f658b13f9
The datum plane detection in getDistanceType() only checked for
App::Plane (origin planes). This missed two other class hierarchies:

  - PartDesign::Plane (inherits Part::Datum, NOT App::Plane)
  - Part::Plane primitive referenced bare (no Face element)

Both produce empty element types (sub-name ends with ".") but failed
the isDerivedFrom<App::Plane>() check, falling through to
DistanceType::Other and the Planar fallback. This caused incorrect
constraint geometry, leading to conflicting/unsatisfiable constraints
and solver failures.

Add shape-based isDatumPlane/Line/Point helpers that cover all three
hierarchies by inspecting the actual OCCT geometry rather than relying
on class identity alone. Extend getDistanceType() to use these helpers
for all datum-vs-datum and datum-vs-element combinations.

Adds TestDatumClassification.py with tests for PartDesign::Plane,
Part::Plane (bare ref), and cross-hierarchy datum combinations.
forbes force-pushed fix/datum-plane-classification-all-hierarchies from 4f658b13f9 to 14ee8c673f 2026-02-23 03:18:41 +00:00 Compare
forbes merged commit f652d6ccf8 into main 2026-02-23 03:20:06 +00:00
forbes deleted branch fix/datum-plane-classification-all-hierarchies 2026-02-23 03:20:06 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#319