Salome HOME
Issue #2271 'Fatal error' during sketching, Issue #2272 Color of a sketch-face highlight
authornds <nds@opencascade.com>
Mon, 9 Oct 2017 07:49:31 +0000 (10:49 +0300)
committernds <nds@opencascade.com>
Mon, 9 Oct 2017 07:49:31 +0000 (10:49 +0300)
src/PartSet/PartSet_CustomPrs.h
src/SketcherPrs/SketcherPrs_LengthDimension.cpp

index fc83596816a6f0fb2331a165b1cc352f92f73c7a..65c3bdf0916fbd86840153a34b4974861e27b991 100755 (executable)
@@ -56,8 +56,8 @@ public:
   /// Returns color lighter than sketch feature entity : pink
   static const std::string OPERATION_REMOVE_FEATURE_COLOR() { return "255, 174, 201"; }
 
-  /// Returns color equal to default color of construction plugin : gray
-  static const std::string OPERATION_SKETCH_PLANE() { return "150,150,180"; }
+  /// Returns color equal to default color of construction plugin : green
+  static const std::string OPERATION_SKETCH_PLANE() { return "170,255,0"; }
 public:
   /// Constructor
   /// \param theWorkshop a reference to workshop
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());