From 305116b958ad7eb39d044ba14f5103c9d138853e Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 5 Dec 2016 13:16:43 +0300 Subject: [PATCH] Fix because of Angle unit test failed --- src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp index 9743e6511..108818439 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp @@ -149,10 +149,16 @@ void SketchPlugin_ConstraintAngle::attributeChanged(const std::string& theID) myFlyoutUpdate = false; } else if (theID == SketchPlugin_ConstraintAngle::TYPE_ID()) { - double anAngle = calculateAngle(); std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_ConstraintAngle::VALUE())); - aValueAttr->setValue(anAngle); + ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); + double anAngle = calculateAngle(); + if (aValueAttr->text().empty()) + aValueAttr->setValue(anAngle); + else { + aValueAttr = std::dynamic_pointer_cast< + ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_ConstraintAngle::VALUE())); + aValueAttr->setValue(anAngle); + } } else if (theID == SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()) { updateConstraintValueByAngleValue(); -- 2.39.2