]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix because of Angle unit test failed
authorazv <azv@opencascade.com>
Mon, 5 Dec 2016 10:16:43 +0000 (13:16 +0300)
committerazv <azv@opencascade.com>
Mon, 5 Dec 2016 10:16:43 +0000 (13:16 +0300)
src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp

index 9743e651172399894cb791471910b701f8211752..108818439d2952726b478afaacf2aedcf69afc61 100644 (file)
@@ -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<ModelAPI_AttributeDouble> 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();