1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0029159: Sewing fail when using a maximum tolerance

Force setting truly computed tolerance of the edge if BRepLib::SameParameter has put too large tolerance.
This commit is contained in:
msv
2017-09-29 10:43:52 +03:00
parent ddafad10ec
commit a7d8971008
2 changed files with 42 additions and 1 deletions

View File

@@ -118,6 +118,7 @@
#include <Geom_OffsetSurface.hxx>
#include <BRep_PointOnCurve.hxx>
#include <BRep_ListOfPointRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TVertex.hxx>
#include <Message_ProgressSentry.hxx>
#include <BRepBuilderAPI_VertexInspector.hxx>
@@ -951,11 +952,22 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
if (dist > dist2)
dist2 = dist;
}
maxTol = Max(sqrt(dist2), Precision::Confusion());
maxTol = Max(sqrt(dist2) * (1. + 1e-7), Precision::Confusion());
}
}
if(maxTol >= 0. && maxTol < tolReached)
{
if (tolReached > MaxTolerance())
{
// Set tolerance directly to overwrite too large tolerance
static_cast<BRep_TEdge*>(edge.TShape().operator->())->Tolerance(maxTol);
}
else
{
// just update tolerance with computed distance
aBuilder.UpdateEdge(edge, maxTol);
}
}
aBuilder.SameParameter(edge,Standard_True);
}
}

View File

@@ -0,0 +1,29 @@
puts "========"
puts "OCC29159"
puts "========"
puts ""
#################################################
# Sewing fail when using a maximum tolerance
#################################################
set MaxTol 5e-4
set ExpLength 97.234
restore [locate_data_file bug29159_F.brep] f
sewing result 5e-4 f +mint 1e-8 +maxt $MaxTol
regexp {EDGE *: MAX=([-0-9.+eE]+)} [tolerance result] full toler
if {$toler > $MaxTol} {
puts "Error: Tolerance after sewing is greater than max allowed tolerance"
}
if {![regexp "seems to be OK" [bopcheck result 2]]} {
puts "Error: result of sewing is self-interfering"
}
checknbshapes result -m "Sewing result" -edge 8 -face 2
smallview +X+Y
don result
fit