Sketcher: Fix symmetry of slot redundancy false positive (#26604)

* Sketcher: Fix symmetry of slot redundancy false positive

Perturb symmetric geometries when using the 'create symmetric constraints' option to avoid numerical singularities in the solver (Jacobian Rank).
If geometry is "perfect", the solver cannot distinguish between the derivative of a Symmetry constraint and an Equal constraint, flagging one as redundant.
This commit is contained in:
PaddleStroke
2026-01-13 20:48:41 +01:00
committed by GitHub
parent e2ddf62467
commit 11de6743b0

View File

@@ -4385,6 +4385,21 @@ int SketchObject::addSymmetric(
std::vector<Part::Geometry*> symgeos
= getSymmetric(geoIdList, geoIdMap, isStartEndInverted, refGeoId, refPosId);
// Perturb geometry to avoid numerical singularities in the solver (Jacobian Rank).
// If geometry is "perfect", the solver cannot distinguish between the derivative
// of a Symmetry constraint and an Equal constraint, flagging one as redundant.
// see https://github.com/FreeCAD/FreeCAD/issues/13551
// This does not happen with other arcs types.
if (addSymmetryConstraints) {
for (auto* geo : symgeos) {
if (auto* arc = dynamic_cast<Part::GeomArcOfCircle*>(geo)) {
double start, end;
arc->getRange(start, end, true);
arc->setRange(start + Precision::Angular(), end, true);
}
}
}
{
addGeometry(symgeos);