]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Bos #19827. Prevent creation of self-interfering shapes by Pipe algorithm.
authorjfa <jfa@opencascade.com>
Mon, 1 Mar 2021 11:39:38 +0000 (14:39 +0300)
committerjfa <jfa@opencascade.com>
Mon, 1 Mar 2021 11:39:38 +0000 (14:39 +0300)
src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp

index 819c8d70963bba7aa0da9d4016e3510a580e2c01..c6c3d28ef748a563d7cb8a62f0d76c562642cac5 100644 (file)
@@ -31,6 +31,7 @@
 #include <BRepOffsetAPI_MakePipe.hxx>
 #include <BRepOffsetAPI_MakePipeShell.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
+#include <BOPAlgo_ArgumentAnalyzer.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Line.hxx>
 #include <gp_Lin.hxx>
@@ -113,10 +114,23 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape,
   aPipeBuilder->Build();
 
   // Checking result.
-  if(!aPipeBuilder->IsDone() || aPipeBuilder->Shape().IsNull()) {
+  if (!aPipeBuilder->IsDone() || aPipeBuilder->Shape().IsNull()) {
     delete aPipeBuilder;
     return;
   }
+
+  // Check for self-interfering result
+  BOPAlgo_ArgumentAnalyzer aChecker;
+  aChecker.SetShape1(aPipeBuilder->Shape());
+  aChecker.SelfInterMode() = Standard_True;
+  aChecker.StopOnFirstFaulty() = Standard_True;
+  aChecker.Perform();
+  if (aChecker.HasFaulty()) {
+    myError = "Self-interfering result.";
+    delete aPipeBuilder;
+    return;
+  }
+
   this->initialize(aPipeBuilder);
 
   // Setting naming.