#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
+#include <Geom_Curve.hxx>
+#include <IntTools_Tools.hxx>
// ==================================================================
// function: 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 <E>
- 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);
--- /dev/null
+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
--- /dev/null
+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