Salome HOME
Issue #2271 'Fatal error' during sketching, Issue #2272 Color of a sketch-face highlight
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_LengthDimension.cpp
index 7472d956b1a723cc55d3ee5563be78d8ada2cfd3..cee80b8b9b29ca6ad1c5abf0738c51feaf654e7d 100644 (file)
@@ -261,6 +261,15 @@ bool SketcherPrs_LengthDimension::readyToDisplay(ModelAPI_Feature* theConstraint
     if (!aPnt_A || !aPnt_B) // Objects not found
       return false;
 
+    if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID()) {
+      if (fabs(aPnt_A->x() - aPnt_B->x()) < Precision::Confusion())
+        return false;
+    }
+    else if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) {
+      if (fabs(aPnt_A->y() - aPnt_B->y()) < Precision::Confusion())
+        return false;
+    }
+
     // Get points from these object
     std::shared_ptr<GeomAPI_Pnt> aPoint1 = thePlane->to3D(aPnt_A->x(), aPnt_A->y());
     std::shared_ptr<GeomAPI_Pnt> aPoint2 = thePlane->to3D(aPnt_B->x(), aPnt_B->y());