]> OCCT Git - occt.git/commitdiff
0032818: Modeling Algorithms - Result of sweep operation is invalid
authorgelin <gelin@qunhemail.com>
Wed, 9 Feb 2022 05:26:39 +0000 (13:26 +0800)
committerVadim Glukhikh <vadim.glukhikh@opencascade.com>
Mon, 21 Nov 2022 17:13:47 +0000 (20:13 +0300)
BRepFill_TrimShellCorner.cxx - setting correct orientation for NewEdge
tests/pipe/bugs/bug32818 - new test case added

src/BRepFill/BRepFill_TrimShellCorner.cxx
tests/pipe/bugs/bug32818 [new file with mode: 0644]

index 77efa8fbabe25c7b33c4bb6d8ae5c9a754b89fe5..ddbf218fd452a66c96a3c4b79da465350f7a158e 100644 (file)
@@ -56,6 +56,7 @@
 #include <TopTools_MapOfShape.hxx>
 #include <TopTools_SequenceOfShape.hxx>
 #include <BRepExtrema_ExtCC.hxx>
+#include <ShapeFix_Edge.hxx>
 
 static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
                                                 TopoDS_Compound&     theComp,
@@ -534,6 +535,26 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
 
     if(bHasNewEdge) {
       aNewEdge.Orientation(TopAbs_FORWARD);
+
+      // Refer to BrepFill_Sweep.cxx BuildEdge Construct an edge via an iso
+      gp_Pnt P1, P2;
+      Standard_Real p11, p12, p21, p22;
+      P1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aNewEdge)));
+      P2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aNewEdge)));
+
+      TopoDS_Edge aERef = TopoDS::Edge(fit == 1 ? aE1 : aE2);
+      p11 = P1.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
+      p22 = P2.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
+      p12 = P1.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
+      p21 = P2.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
+
+      if (p11 > p12 && p22 > p21) {
+        aNewEdge.Reverse();
+      }
+
+      // for nonPlane surface, we should add pCurve
+      Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge();
+      sfe->FixAddPCurve(aNewEdge, TopoDS::Face(aFace), Standard_False);
     }
 
     TopTools_ListOfShape aOrderedList;
diff --git a/tests/pipe/bugs/bug32818 b/tests/pipe/bugs/bug32818
new file mode 100644 (file)
index 0000000..4601145
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "0032818: Modeling Algorithms - Result of sweep operation is invalid"
+puts "========"
+puts ""
+
+restore [locate_data_file bug32818.brep] 
+explode bug32818
+renamevar bug32818_1 p
+renamevar bug32818_2 pr
+
+mksweep p
+setsweep -CF
+addsweep pr
+
+buildsweep result -R -S
+
+checkshape result
+checknbshapes result -vertex 80 -edge 160 -wire 80 -face 80 -shell 1 -solid 1
\ No newline at end of file