fix(assembly): classify datum plane references in Distance joints
Some checks failed
Build and Test / build (pull_request) Has been cancelled

When a Distance joint references a datum plane (XY_Plane, XZ_Plane,
YZ_Plane), getDistanceType() failed to recognize it because datum
plane sub-names yield an empty element type. This caused the fallback
to DistanceType::Other → BaseJointKind::Planar, which adds spurious
parallel-normal residuals that overconstrain the system.

For example, three vertex-to-datum-plane Distance joints produced
10 residuals (3×Planar) with 6 mutually contradictory orientation
constraints, causing the solver to find garbage least-squares
solutions.

Add early detection of App::Plane datum objects before the main
geometry classification chain. Datum planes are now correctly mapped:
- Vertex + DatumPlane → PointPlane → PointInPlane (1 residual)
- Edge + DatumPlane → LinePlane → LineInPlane
- Face/DatumPlane + DatumPlane → PlanePlane → Planar
This commit is contained in:
forbes
2026-02-21 22:04:18 -06:00
parent cf2fc82eac
commit b4835e1b05
4 changed files with 156 additions and 9 deletions

View File

@@ -1115,10 +1115,19 @@ KCSolve::SolveContext AssemblyObject::buildSolveContext(
break;
default:
FC_WARN("Assembly : Distance joint '" << joint->getFullName()
<< "' — unhandled DistanceType "
<< distanceTypeName(distType)
<< ", falling back to Planar");
kind = KCSolve::BaseJointKind::Planar;
params.push_back(distance);
break;
}
FC_LOG("Assembly : Distance joint '" << joint->getFullName()
<< "' — DistanceType=" << distanceTypeName(distType)
<< ", kind=" << static_cast<int>(kind)
<< ", distance=" << distance);
break;
}
default: