]> OCCT Git - occt-copy.git/commitdiff
0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts CR30794
authoremv <emv@opencascade.com>
Mon, 24 Jun 2019 08:41:30 +0000 (11:41 +0300)
committeremv <emv@opencascade.com>
Mon, 24 Jun 2019 09:16:12 +0000 (12:16 +0300)
BRepFill_TrimShellCorner::MakeFacesSec() - When replacing a bound edge with a section wire make sure that edges in a wire are oriented correctly.
Test cases for the issue.

src/BRepFill/BRepFill_TrimShellCorner.cxx
src/BRepFill/BRepFill_TrimShellCorner.hxx
tests/bugs/modalg_7/bug30794_1 [new file with mode: 0644]
tests/bugs/modalg_7/bug30794_2 [new file with mode: 0644]
tests/bugs/modalg_7/bug30794_3 [new file with mode: 0644]
tests/bugs/modalg_7/bug30794_4 [new file with mode: 0644]
tests/bugs/modalg_7/bug30794_5 [new file with mode: 0644]

index eca12168138cc16554efb29b5f1743c5706602da..799c7adbb45443cc55e9f1a61530f60fbe1c7ae4 100644 (file)
@@ -17,6 +17,7 @@
 #include <BOPAlgo_BOP.hxx>
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPDS_DS.hxx>
+#include <BOPTools_AlgoTools.hxx>
 #include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepAlgoAPI_Section.hxx>
@@ -175,6 +176,7 @@ static void RemoveEdges(const TopoDS_Compound&      theSourceComp,
 static Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve&       theBCurves,
                                            const TopoDS_Face&               theSecPlane,
                                            const BOPDS_PDS&                 theDS,
+                                           const Handle (IntTools_Context)& theContext,
                                            TopoDS_Compound&                 theResult);
 
 static Standard_Boolean GetUEdges(const Standard_Integer                     theIndex,
@@ -345,7 +347,7 @@ void BRepFill_TrimShellCorner::Perform()
           }
         }
         else {
-          if(!MakeFacesSec(ii, theDS, anIndex1, anIndex2, i)) {
+          if(!MakeFacesSec(ii, theDS, aPF.Context(), anIndex1, anIndex2, i)) {
             myHistMap.Clear();
             return;
           }
@@ -658,6 +660,7 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
 Standard_Boolean
 BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer                     theIndex,
                                        const BOPDS_PDS&                           theDS,
+                                       const Handle (IntTools_Context)&           theContext,
                                        const Standard_Integer                     theFaceIndex1, 
                                        const Standard_Integer                     theFaceIndex2, 
                                        const Standard_Integer                     theSSInterfIndex)
@@ -669,7 +672,7 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer
   TopoDS_Compound aSecEdges;
   TopoDS_Face aSecPlane;
 
-  if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, aSecEdges))
+  if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, theContext, aSecEdges))
     return Standard_False;
 
   //Extract vertices on the intersection of correspondent U-edges
@@ -787,11 +790,18 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer
       aBB.MakeWire(aW);
       TopTools_ListIteratorOfListOfShape aEIt(aListOfWireEdges);
 
-      for(; aEIt.More(); aEIt.Next()) {
-        if(!aBoundEdge.IsSame(aEIt.Value()))
-          aBB.Add(aW, aEIt.Value());
+      TopoDS_Edge aFBE = TopoDS::Edge (aBoundEdge.Oriented (TopAbs_FORWARD));
+      for (; aEIt.More(); aEIt.Next())
+      {
+        if (!aBoundEdge.IsSame(aEIt.Value()))
+        {
+          TopoDS_Edge aSplit = TopoDS::Edge (aEIt.Value());
+          if (BOPTools_AlgoTools::IsSplitToReverse (aSplit, aFBE, theContext))
+            aSplit.Reverse();
+          aBB.Add (aW, aSplit);
+        }
       }
-      aSubstitutor->Replace(aBoundEdge.Oriented(TopAbs_FORWARD), aW);
+      aSubstitutor->Replace (aFBE, aW);
     }
 
     aSubstitutor->Apply(aFace);
@@ -2154,6 +2164,7 @@ void RemoveEdges(const TopoDS_Compound&      theSourceComp,
 Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve&       theBCurves,
                                     const TopoDS_Face&               theSecPlane,
                                     const BOPDS_PDS&                 theDS,
+                                    const Handle (IntTools_Context)& theContext,
                                     TopoDS_Compound&                 theResult) {
 
   theResult.Nullify();
@@ -2181,10 +2192,7 @@ Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve&       theBCurves,
         Standard_Real f = 0., l = 0.;
         BRep_Tool::Range(anEdge, f, l);
         anIntersector.SetBeanParameters(f, l);
-        //
-        Handle(IntTools_Context) aContext = new IntTools_Context;
-        anIntersector.SetContext(aContext);
-        //
+        anIntersector.SetContext(theContext);
         anIntersector.Perform();
 
         if(anIntersector.IsDone()) {
index df78dfef0bce41076697cebb632c0f9f284d8ee4..e13438f2d8eb66789213c137d0df7386737c4a87 100644 (file)
@@ -35,7 +35,7 @@ class gp_Ax2;
 class TopoDS_Face;
 class TopoDS_Wire;
 class TopoDS_Shape;
-
+class IntTools_Context;
 
 //! Trims sets of faces in the corner to make proper parts of pipe
 class BRepFill_TrimShellCorner 
@@ -80,6 +80,7 @@ private:
 
   Standard_Boolean MakeFacesSec(const Standard_Integer                     theIndex,
                                 const BOPDS_PDS&                           theDS,
+                                const Handle (IntTools_Context)&           theContext,
                                 const Standard_Integer                     theFaceIndex1, 
                                 const Standard_Integer                     theFaceIndex2, 
                                 const Standard_Integer                     theSSInterfIndex);
diff --git a/tests/bugs/modalg_7/bug30794_1 b/tests/bugs/modalg_7/bug30794_1
new file mode 100644 (file)
index 0000000..b252470
--- /dev/null
@@ -0,0 +1,19 @@
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes1.brep] c
+explode c
+
+unifysamedom spine c_1
+mksweep spine
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 1.24302e+06 -v 5.64101e+06
+checknbshapes result -wire 14 -face 14 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30794_2 b/tests/bugs/modalg_7/bug30794_2
new file mode 100644 (file)
index 0000000..149483e
--- /dev/null
@@ -0,0 +1,23 @@
+puts "TODO OCC30794 ALL: Faulty shapes in variables"
+puts "TODO OCC30794 ALL: Error : The area of result shape is"
+puts "TODO OCC30794 ALL: Error : The volume of result shape is"
+puts "TODO OCC30794 ALL: Error :  is WRONG because number of"
+
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes1.brep] c
+explode c
+
+mksweep c_1
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 1.24302e+06 -v 5.64101e+06
+checknbshapes result -wire 14 -face 14 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30794_3 b/tests/bugs/modalg_7/bug30794_3
new file mode 100644 (file)
index 0000000..b5993de
--- /dev/null
@@ -0,0 +1,19 @@
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes2.brep] c
+explode c
+
+unifysamedom spine c_1
+mksweep spine
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 883273 -v 1.09918e+07
+checknbshapes result -wire 6 -face 6 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30794_4 b/tests/bugs/modalg_7/bug30794_4
new file mode 100644 (file)
index 0000000..ffadcfb
--- /dev/null
@@ -0,0 +1,22 @@
+puts "TODO OCC30794 ALL: Faulty shapes in variables"
+puts "TODO OCC30794 ALL: Error : The volume of result shape is"
+puts "TODO OCC30794 ALL: Error :  is WRONG because number of"
+
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes2.brep] c
+explode c
+
+mksweep c_1
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 883273 -v 1.09918e+07
+checknbshapes result -wire 6 -face 6 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30794_5 b/tests/bugs/modalg_7/bug30794_5
new file mode 100644 (file)
index 0000000..8af9139
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+binrestore [locate_data_file bug30794_shapes.bin] c
+explode c
+
+mksweep c_1
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 1.44508e+06 -v 1.78664e+07
+checknbshapes result -wire 7 -face 7 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png