From 69295115ab139a3e7b6196ae9f7c05ddb450120e Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Fri, 9 Oct 2020 23:25:05 +0300 Subject: [PATCH] Issue #20167: checkPythonDump() errors 1. Make a copy of prism base shape instead of using additional transformation. 2. Extend the tool of ExtrusionCut (Through All mode) to get stable result. --- src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp | 10 +++++----- src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index 50b2ef2b1..3cee6ce0e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -299,7 +299,7 @@ void GeomAlgoAPI_Prism::buildBySizes(const GeomShapePtr theBaseShape // Making prism. BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * (theFromSize + theToSize)); + new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * (theFromSize + theToSize), true); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } @@ -407,7 +407,7 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Making prism. BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); + new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength, true); if(!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } @@ -457,7 +457,7 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Solid based on "To" bounding plane gp_Vec aNormal = aToDir->impl(); BRepPrimAPI_MakePrism* aToPrismBuilder = - new BRepPrimAPI_MakePrism(aToShape, aNormal * (-2.0 * aBndBoxSize)); + new BRepPrimAPI_MakePrism(aToShape, aNormal * (-2.0 * aBndBoxSize), true); if (!aToPrismBuilder || !aToPrismBuilder->IsDone()) { return; } @@ -494,7 +494,7 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Solid based on "From" bounding plane aNormal = aFromDir->impl(); BRepPrimAPI_MakePrism* aFromPrismBuilder = - new BRepPrimAPI_MakePrism(aFromShape, aNormal * (-2.0 * aBndBoxSize)); + new BRepPrimAPI_MakePrism(aFromShape, aNormal * (-2.0 * aBndBoxSize), true); if (!aFromPrismBuilder || !aFromPrismBuilder->IsDone()) { return; } @@ -595,7 +595,7 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape // Making prism. BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); + new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength, true); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 5b04d9f06..9a51a5ae7 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -1196,6 +1196,10 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, return; } + // the value to enlarge the bounding box of each object to make the extruded shape + // a little bit larger than overall objects to get the correct result of Boolean CUT operation + double anEnlargement = 0.1 * aBndObjs.front()->distance(aBndObjs.back()); + // Prism direction if (theDir.get()) { // One direction for all prisms @@ -1235,7 +1239,7 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, // Bounding box of the base std::list > aBndBases = - GeomAlgoAPI_ShapeTools::getBoundingBox(aBaseShapes_i); + GeomAlgoAPI_ShapeTools::getBoundingBox(aBaseShapes_i, anEnlargement); if (aBndBases.size() != 8) { return; } -- 2.39.2