Salome HOME
Issue #567: Fixing of a vertical line
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintRigid.cpp
index 735412dde8706158efc1cfe6ca2dfdfdb9def8cb..6082f2fd41cb57e3d3ee3e517612888cf725ca56 100644 (file)
@@ -203,6 +203,13 @@ void SketchSolver_ConstraintRigid::fixLine(const Slvs_Entity& theLine)
         !myStorage->isPointFixed(theLine.point[1], aFixed, true))
       fixPoint(theLine.point[0]);
     if (!isUsedInEqual(theLine, anEqual)) {
+      // Check the distance is not set yet
+      std::list<Slvs_Constraint> aDistConstr = myStorage->getConstraintsByType(SLVS_C_PT_PT_DISTANCE);
+      std::list<Slvs_Constraint>::const_iterator aDIt = aDistConstr.begin();
+      for (; aDIt != aDistConstr.end(); aDIt++)
+        if ((aDIt->ptA == theLine.point[0] && aDIt->ptB == theLine.point[1]) ||
+            (aDIt->ptA == theLine.point[1] && aDIt->ptB == theLine.point[0]))
+          return;
       // Calculate distance between points on the line
       double aCoords[4];
       for (int i = 0; i < 2; i++) {