From: azv Date: Thu, 21 Mar 2019 13:00:23 +0000 (+0300) Subject: Fix incorrect treating a constraint Angle type while dumping (issue #2893) X-Git-Tag: V9_3_0b2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7be9fb87d5945e2d9b22af8421e63ec5b404bad1;p=modules%2Fshaper.git Fix incorrect treating a constraint Angle type while dumping (issue #2893) --- diff --git a/src/SketchAPI/SketchAPI_ConstraintAngle.cpp b/src/SketchAPI/SketchAPI_ConstraintAngle.cpp index fa12b8592..50bbbb946 100644 --- a/src/SketchAPI/SketchAPI_ConstraintAngle.cpp +++ b/src/SketchAPI/SketchAPI_ConstraintAngle.cpp @@ -91,15 +91,18 @@ static std::string angleTypeToString(FeaturePtr theFeature) AttributeDoublePtr aValueAttr = theFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); + double aDirectDiff = fabs(aValueAttr->value() - anAngleDirect); + double aComplementaryDiff = fabs(aValueAttr->value() - anAngleComplmentary); + double aBackwardDiff = fabs(aValueAttr->value() - anAngleBackward); + + // find the minimal difference std::string aType; - if (fabs(aValueAttr->value() - anAngleDirect) < TOLERANCE) { - // Nothing to do. - // This case is empty and going the first to check the direct angle before the others. + if (aDirectDiff > TOLERANCE) { + if (aComplementaryDiff < aDirectDiff && aComplementaryDiff < aBackwardDiff) + aType = "Complementary"; + else if (aBackwardDiff < aDirectDiff && aBackwardDiff < aComplementaryDiff) + aType = "Backward"; } - else if (fabs(aValueAttr->value() - anAngleComplmentary) < TOLERANCE) - aType = "Complementary"; - else if (fabs(aValueAttr->value() - anAngleBackward) < TOLERANCE) - aType = "Backward"; return aType; }