#include <TopExp_Explorer.hxx>
#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
Standard_Boolean IsClosed(const TopoDS_Edge& ,
const TopoDS_Face& );
-
//=======================================================================
//function : AttachExistingPCurve
//purpose :
const TopoDS_Face& aF,
const Handle(IntTools_Context)& aCtx)
{
- Standard_Boolean bIsToReverse, bIsClosed;
+ Standard_Boolean bIsToReverse, bIsClosed, bComp;
Standard_Integer iRet;
Standard_Real aTol, aT11, aT12, aT21, aT22, aTolPPC;
+ Standard_Real aTolSP, aTMax;
Handle(Geom2d_Curve) aC2Dold, aC2DoldC;
Handle(Geom2d_Curve) aC2DT;
BRep_Builder aBB;
//
aC2DT=new Geom2d_TrimmedCurve(aC2DoldC, aT21, aT22);
//
- aTol=BRep_Tool::Tolerance(aE1);
- BRep_Tool::Range (aE1, aT11, aT12);
- aBB.SameRange(aE1, Standard_False);
- aBB.SameParameter(aE1, Standard_False);
-
aTolPPC=Precision::PConfusion();
//
+ Handle(Geom_Curve) aCE1 = BRep_Tool::Curve(aE1, aT11, aT12);
+ //
GeomLib::SameRange(aTolPPC, aC2DT, aT21, aT22, aT11, aT12, aC2DT);
//
if (aC2DT.IsNull()){
return iRet;
}
//
+ // check the curves on same parameter to prevent
+ // big tolerance increasing
+ Handle(Geom_Surface) aSF = BRep_Tool::Surface(aF);
+ //
+ bComp = IntTools_Tools::ComputeTolerance
+ (aCE1, aC2DT, aSF, aT11, aT12, aTolSP, aTMax);
+ if (!bComp) {
+ iRet = 3;
+ return iRet;
+ }
+ //
+ aTol = BRep_Tool::Tolerance(aE1);
+ //
+ if ((aTolSP > 10.*aTol) && aTolSP > 0.1) {
+ iRet = 4;
+ return iRet;
+ }
+ //
+ aBB.SameRange(aE1, Standard_False);
+ aBB.SameParameter(aE1, Standard_False);
+ //
aBB.UpdateEdge(aE1, aC2DT, aF, aTol);
BRepLib::SameParameter(aE1);
BRepLib::SameRange(aE1);
//
- bIsClosed=IsClosed(aE2, aF);
+ bIsClosed = IsClosed(aE2, aF);
if (bIsClosed) {
- iRet=UpdateClosedPCurve(aE2, aE1, aF, aCtx);
+ iRet = UpdateClosedPCurve(aE2, aE1, aF, aCtx);
if(iRet) {
- iRet=3;
+ iRet = 5;
}
}
//
}
return bRet;
}
-
--- /dev/null
+puts "============"
+puts "OCC26718"
+puts "============"
+puts ""
+#############################################################################################
+## Big tolerance value of the edge in the result of Genral Fuse operation
+#############################################################################################
+
+restore [locate_data_file bug26718_w6_b1.brep] b1
+restore [locate_data_file bug26718_w6_b2.brep] b2
+
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+
+bfillds
+bbuild result
+
+set square 2.3834e+06
+
+set nbshapes_expected "
+Number of shapes in shape
+ VERTEX : 7
+ EDGE : 11
+ WIRE : 8
+ FACE : 5
+ SHELL : 2
+ SOLID : 2
+ COMPSOLID : 0
+ COMPOUND : 1
+ SHAPE : 36
+"
+
+checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by General Fuse operation"
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance result] full MaxTolerance
+puts "MaxTolerance=$MaxTolerance"
+
+set expected_MaxTolerance 0.317915740714732
+set tol_abs_MaxTolerance 0.01
+set tol_rel_MaxTolerance 0.01
+checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
+
+set 3dviewer 1