X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_ConstraintAngle.cpp;h=108818439d2952726b478afaacf2aedcf69afc61;hb=b5893b0a30fac08134c24de4565cb513a43affa6;hp=e363ba32b14ee046fc487c36a42ee4f92b30dbf1;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp index e363ba32b..108818439 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp @@ -152,7 +152,13 @@ void SketchPlugin_ConstraintAngle::attributeChanged(const std::string& theID) std::shared_ptr aValueAttr = std::dynamic_pointer_cast< ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); double anAngle = calculateAngle(); - aValueAttr->setValue(anAngle); + 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(); @@ -190,11 +196,14 @@ double SketchPlugin_ConstraintAngle::calculateAngle() } double anAngle = anAng->angleDegree(); std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_ConstraintAngle::VALUE())); + ModelAPI_AttributeDouble>(data()->attribute(VALUE())); + std::shared_ptr anAngleValueAttr = std::dynamic_pointer_cast< + ModelAPI_AttributeDouble>(data()->attribute(ANGLE_VALUE_ID())); if (!aValueAttr->isInitialized()) aValueAttr->setValue(anAngle); /// an angle value should be corrected by the current angle type - anAngle = getAngleForType(anAngle); + anAngle = getAngleForType(anAngleValueAttr->text().empty() ? + anAngle : anAngleValueAttr->value()); boolean(ANGLE_REVERSED_FIRST_LINE_ID())->setValue(anAng->isReversed(0)); boolean(ANGLE_REVERSED_SECOND_LINE_ID())->setValue(anAng->isReversed(1)); return anAngle;