1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0026718: Big tolerance value of the edge in the result of General Fuse operation

class BOPTools_AlgoTools2D
method
  Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
  (const TopoDS_Edge& aE2, // old
   const TopoDS_Edge& aE1, // new
   const TopoDS_Face& aF,
   const Handle(IntTools_Context)& aCtx)

To prevent huge tolerance increasing check the distances between 2d and 3d
curves (through surface) before attaching 2d curve to the edge.

Test case for issue CR26718

Correction of test cases for issue CR26718
This commit is contained in:
emv 2015-10-01 13:57:53 +03:00 committed by bugmaster
parent 4b1c8733e8
commit 521e1c6191
4 changed files with 76 additions and 14 deletions

View File

@ -37,6 +37,7 @@
#include <TopExp_Explorer.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
@ -55,7 +56,6 @@ static
Standard_Boolean IsClosed(const TopoDS_Edge& ,
const TopoDS_Face& );
//=======================================================================
//function : AttachExistingPCurve
//purpose :
@ -66,9 +66,10 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
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;
@ -97,13 +98,10 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
//
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()){
@ -111,15 +109,36 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
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;
}
}
//
@ -309,4 +328,3 @@ Standard_Boolean IsClosed(const TopoDS_Edge& aE,
}
return bRet;
}

View File

@ -1,3 +1,2 @@
puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sopac-dn500.asm.1.gdml.tcl]

View File

@ -1,2 +1,2 @@
puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sopac-dn500_piquage.prt.1.gdml.tcl]

45
tests/bugs/modalg_6/bug26718 Executable file
View File

@ -0,0 +1,45 @@
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