From 982ffeac08ff4c3127c8a6ef186e80b25e27c510 Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Thu, 24 Oct 2024 11:33:28 +0200 Subject: [PATCH] Sketcher: DrawSketchHandlerRotate : Fix unwanted copy of DistanceX/Y constraints --- .../Sketcher/Gui/DrawSketchHandlerRotate.h | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h index 68ec59f6a1..353a34c0f1 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h @@ -397,9 +397,32 @@ private: newConstr->Second = secondIndexi; geoIdsWhoAlreadyHasEqual.push_back(secondIndexi); } - else { + else if (cstr->Type == Distance) { newConstr->Second = secondIndexi; } + else { + // We should be able to handle cases where rotation is 90 or 180, but + // this is segfaulting. The same is reported in + // SketchObject::addSymmetric. There's apparantly a problem with + // creation of DistanceX/Y. On top of the segfault the DistanceX/Y flips + // the new geometry. + /*if (cstr->Type == DistanceX || cstr->Type == DistanceY) { + //DistanceX/Y can be applied only if the rotation if 90 or 180. + if (fabs(fmod(individualAngle, M_PI)) < Precision::Confusion()) { + // ok and nothing to do actually + } + else if (fabs(fmod(individualAngle, M_PI * 0.5)) < + Precision::Confusion()) { cstr->Type = cstr->Type == DistanceX ? + DistanceY : DistanceX; + } + else { + // cannot apply for random angles + continue; + } + }*/ + // So for now we just ignore all DistanceX/Y + continue; + } } else if ((cstr->Type == Block) && firstIndex >= 0) { newConstr->First = firstIndexi;