]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchPlugin/SketchPlugin_Validators.cpp
Salome HOME
1. Projection Sketch feature: regression correction that objects are not selected...
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Validators.cpp
index 73321550bff7b40a0f034d5f058ca717320961f6..5cb16e6b0b6bd737b5dc2a4b2bd82917e2f02d82 100755 (executable)
@@ -931,8 +931,11 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute,
     std::shared_ptr<GeomAPI_Pnt> aLineLoc = aLine->location();
     double aDot = aNormal->dot(aLineDir);
     double aDist = aLineLoc->xyz()->decreased(anOrigin->xyz())->dot(aNormal->xyz());
-    return (fabs(aDot) >= tolerance && fabs(aDot) < 1.0 - tolerance) ||
+    bool aValid = (fabs(aDot) >= tolerance && fabs(aDot) < 1.0 - tolerance) ||
            (fabs(aDot) < tolerance && fabs(aDist) > tolerance);
+    if (!aValid)
+      theError = "Error: Edge is already in the sketch plane.";
+    return aValid;
   }
   else if (anEdge->isCircle() || anEdge->isArc()) {
     std::shared_ptr<GeomAPI_Circ> aCircle = anEdge->circle();
@@ -940,8 +943,13 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute,
     std::shared_ptr<GeomAPI_Pnt> aCircCenter = aCircle->center();
     double aDot = fabs(aNormal->dot(aCircNormal));
     double aDist = aCircCenter->xyz()->decreased(anOrigin->xyz())->dot(aNormal->xyz());
-    return fabs(aDot - 1.0) < tolerance * tolerance && fabs(aDist) > tolerance;
+    bool aValid = fabs(aDot - 1.0) < tolerance * tolerance && fabs(aDist) > tolerance;
+    if (!aValid)
+      theError.arg(anEdge->isCircle() ? "Error: Cirlce is already in the sketch plane."
+                                      : "Error: Arc is already in the sketch plane.");
+    return aValid;
   }
 
+  theError = "Error: Selected object is not line, circle or arc.";
   return false;
 }