From fd9315665d8b110d39866496112ebb314de02ac3 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 1 Mar 2021 14:39:38 +0300 Subject: [PATCH] Bos #19827. Prevent creation of self-interfering shapes by Pipe algorithm. --- src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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. -- 2.39.2