From: azv Date: Thu, 17 Oct 2019 12:04:30 +0000 (+0300) Subject: Issue #3055: Fatal error when setting angle X-Git-Tag: V9_5_0a1~167^2~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5f5a1098eed821bbac1cd9e2e461d48055f54d3d;p=modules%2Fshaper.git Issue #3055: Fatal error when setting angle Improve calculation of flyout point position to avoid the crash. --- diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp index e769c019c..137acd0cd 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp @@ -310,9 +310,19 @@ bool SketchPlugin_ConstraintAngle::compute(const std::string& theAttributeId) if (aStartA->distance(aEndA) < tolerance) return false; + std::shared_ptr aPointB1 = std::dynamic_pointer_cast( + aLineB->attribute(SketchPlugin_Line::START_ID())); + std::shared_ptr aPointB2 = std::dynamic_pointer_cast( + aLineB->attribute(SketchPlugin_Line::END_ID())); + + std::shared_ptr aStartB = aPointB1->pnt(); + std::shared_ptr aEndB = aPointB2->pnt(); + if (aStartB->distance(aEndB) < tolerance) + return false; + myFlyoutUpdate = true; - double aX = (aStartA->x() + aEndA->x()) / 2.; - double aY = (aStartA->y() + aEndA->y()) / 2.; + double aX = (aStartA->x() + aEndA->x() + aStartB->x() + aEndB->x()) / 4.; + double aY = (aStartA->y() + aEndA->y() + aStartB->y() + aEndB->y()) / 4.; aFlyOutAttr->setValue(aX, aY); myFlyoutUpdate = false;