]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #20167: checkPythonDump() errors
authorArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Fri, 9 Oct 2020 20:25:05 +0000 (23:25 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Sun, 11 Oct 2020 19:29:08 +0000 (22:29 +0300)
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
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp

index 50b2ef2b16cc004b3d1c5d3b197f87962958cd21..3cee6ce0e8fee250aacaa7c1697433414b170f10 100644 (file)
@@ -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<gp_Dir>();
   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<gp_Dir>();
   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;
   }
index 5b04d9f066dbc3a0ebde05a8a57c39915c32caab..9a51a5ae766a8e156268bb38071eff22344bb365 100644 (file)
@@ -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<std::shared_ptr<GeomAPI_Pnt> > aBndBases =
-          GeomAlgoAPI_ShapeTools::getBoundingBox(aBaseShapes_i);
+          GeomAlgoAPI_ShapeTools::getBoundingBox(aBaseShapes_i, anEnlargement);
       if (aBndBases.size() != 8) {
         return;
       }