Salome HOME
Make SHAPER STUDY fields exported in SMESH into MED file
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Validators.cpp
index 0ee6f65f3aa4a5b76ab718740ec7b342d18f2bb0..454a476ee2a6498ceaad57ed083b46071744b8c5 100644 (file)
@@ -606,7 +606,7 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut
   }
 
   if(!aConstraintCoincidence.get()) {
-    theError = "Error: one of the selected point does not have coicidence.";
+    theError = "Error: one of the selected point does not have coincidence.";
     return false;
   }
 
@@ -771,7 +771,8 @@ bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttri
       if (aFeature->getKind() == SketchPlugin_Point::ID())
         ++aNbPoints;
       else if (aFeature->getKind() == SketchPlugin_Line::ID() ||
-               aFeature->getKind() == SketchPlugin_Arc::ID())
+               aFeature->getKind() == SketchPlugin_Arc::ID() ||
+               aFeature->getKind() == SketchPlugin_EllipticArc::ID())
         ++aNbLines;
     }
   }
@@ -870,7 +871,7 @@ bool SketchPlugin_ArcTransversalPointValidator::isValid(
     }
   }
   else {
-    theError = "Unable to build transversal arc on %1";
+    theError = "Unable to build perpendicular arc on %1";
     theError.arg(anAttrFeature->getKind());
     return false;
   }
@@ -965,6 +966,8 @@ bool SketchPlugin_SplitValidator::isValid(const AttributePtr& theAttribute,
   GeomShapePtr anAttrShape = (*anEdgeShapes.begin())->shape();
   std::shared_ptr<SketchPlugin_Feature> aSFeature =
                                 std::dynamic_pointer_cast<SketchPlugin_Feature>(anAttrFeature);
+  if (!aSFeature)
+    return false;
   SketchPlugin_Sketch* aSketch = aSFeature->sketch();
 
   std::shared_ptr<ModelAPI_Data> aData = aSketch->data();
@@ -1135,10 +1138,10 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute,
     std::shared_ptr<GeomAPI_Ellipse> anEllipse = anEdge->ellipse();
     std::shared_ptr<GeomAPI_Dir> anEllipseNormal = anEllipse->normal();
     double aDot = fabs(aNormal->dot(anEllipseNormal));
-    bool aValid = aDot >= tolerance * tolerance;
+    bool aValid = fabs(aDot - 1.0) <= tolerance * tolerance;
     if (!aValid)
-      theError.arg(anEdge->isEllipse() ? "Error: Ellipse is orthogonal to the sketch plane."
-                                       : "Error: Elliptic Arc is orthogonal to the sketch plane.");
+      theError.arg(anEdge->isClosed() ? "Error: Ellipse is orthogonal to the sketch plane."
+                                      : "Error: Elliptic Arc is orthogonal to the sketch plane.");
     return aValid;
   }