From db2bfd1e834341e4b55e040d38e804ff014c7c38 Mon Sep 17 00:00:00 2001 From: gelin Date: Wed, 9 Feb 2022 13:26:39 +0800 Subject: [PATCH] 0032818: Modeling Algorithms - Result of sweep operation is invalid BRepFill_TrimShellCorner.cxx - setting correct orientation for NewEdge tests/pipe/bugs/bug32818 - new test case added --- src/BRepFill/BRepFill_TrimShellCorner.cxx | 21 +++++++++++++++++++++ tests/pipe/bugs/bug32818 | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/pipe/bugs/bug32818 diff --git a/src/BRepFill/BRepFill_TrimShellCorner.cxx b/src/BRepFill/BRepFill_TrimShellCorner.cxx index 77efa8fbab..ddbf218fd4 100644 --- a/src/BRepFill/BRepFill_TrimShellCorner.cxx +++ b/src/BRepFill/BRepFill_TrimShellCorner.cxx @@ -56,6 +56,7 @@ #include #include #include +#include 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 index 0000000000..46011451ba --- /dev/null +++ b/tests/pipe/bugs/bug32818 @@ -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