From: jfa Date: Mon, 1 Mar 2021 11:39:38 +0000 (+0300) Subject: Bos #19827. Prevent creation of self-interfering shapes by Pipe algorithm. X-Git-Tag: V9_7_0a1~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fd9315665d8b110d39866496112ebb314de02ac3;p=modules%2Fshaper.git Bos #19827. Prevent creation of self-interfering shapes by Pipe algorithm. --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp index 819c8d709..c6c3d28ef 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -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.