diff --git a/src/BOP/BOP_ShellFaceClassifier.cxx b/src/BOP/BOP_ShellFaceClassifier.cxx index 9a84a70e03..a9130c3178 100755 --- a/src/BOP/BOP_ShellFaceClassifier.cxx +++ b/src/BOP/BOP_ShellFaceClassifier.cxx @@ -24,6 +24,8 @@ #include #include #include +#include +#include // ================================================================== // function: BOP_ShellFaceClassifier::BOP_ShellFaceClassifier @@ -89,14 +91,36 @@ BOP_ShellFaceClassifier::BOP_ShellFaceClassifier // function: ResetElement // purpose: // =============================================================================================== - void BOP_ShellFaceClassifier::ResetElement(const TopoDS_Shape& theElement) +void BOP_ShellFaceClassifier::ResetElement(const TopoDS_Shape& theElement) { - const TopAbs_ShapeEnum aShapeType= theElement.ShapeType(); - + Standard_Boolean bFound; + TopAbs_ShapeEnum aShapeType; + TopExp_Explorer anExp; + // + myFirstCompare=Standard_True; + aShapeType=theElement.ShapeType(); + // + bFound=Standard_False; + anExp.Init(theElement, TopAbs_EDGE); + for(; anExp.More(); anExp.Next()) { + const TopoDS_Edge& aE=*((TopoDS_Edge*)&anExp.Current()); + if (!BRep_Tool::Degenerated(aE)) { + Standard_Real aT, aT1, aT2; + Handle(Geom_Curve) aC; + // + aC=BRep_Tool::Curve(aE, aT1, aT2); + aT=IntTools_Tools::IntermediatePoint(aT1, aT2); + aC->D0(aT, myPoint); + bFound=Standard_True; + break; + } + } + if (bFound) { + return; + } + // // initialize myPoint with first vertex of face - myFirstCompare = Standard_True; - TopExp_Explorer anExp(theElement, TopAbs_VERTEX); - + anExp.Init(theElement, TopAbs_VERTEX); if(anExp.More()) { const TopoDS_Vertex& aVertex = TopoDS::Vertex(anExp.Current()); myPoint = BRep_Tool::Pnt(aVertex); diff --git a/tests/boolean/boptuc_complex/B5 b/tests/boolean/boptuc_complex/B5 old mode 100644 new mode 100755 index 5cca2fcabf..0a95864e03 --- a/tests/boolean/boptuc_complex/B5 +++ b/tests/boolean/boptuc_complex/B5 @@ -4,4 +4,4 @@ restore [locate_data_file b60] b bop a b boptuc result -set square 12500 +set square 15000 diff --git a/tests/bugs/modalg/CR23137_1 b/tests/bugs/modalg/CR23137_1 new file mode 100755 index 0000000000..b7384a9ce6 --- /dev/null +++ b/tests/bugs/modalg/CR23137_1 @@ -0,0 +1,21 @@ +puts "============" +puts "CR23137" +puts "============" +puts "" +########################################################################################################## +# Class BRepAlgoAPI_Cut does not made correct result on attached shapes. +########################################################################################################## + +restore [locate_data_file CR23137-bspl_cut.brep] b +explode b +copy b_1 b1 +copy b_2 b2 +#to provide positive volume of b2 +invert b2 + +bop b1 b2 +bopcut result + +set square 44460.7 + +set 3dviewer 1 diff --git a/tests/bugs/modalg/CR23137_2 b/tests/bugs/modalg/CR23137_2 new file mode 100755 index 0000000000..9f5934fca6 --- /dev/null +++ b/tests/bugs/modalg/CR23137_2 @@ -0,0 +1,21 @@ +puts "============" +puts "CR23137" +puts "============" +puts "" +########################################################################################################## +# Class BRepAlgoAPI_Cut does not made correct result on attached shapes. +########################################################################################################## + +restore [locate_data_file CR23137-rev_cut.brep] b +explode b +copy b_1 b1 +copy b_2 b2 +#to provide positive volume of b1 +invert b1 + +bop b1 b2 +bopcut result + +set square 3452.78 + +set 3dviewer 1