mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0029732: Sewing produces result with high tolerance
Added rebuilding pcurves for case when tolerance of the result edge more than working precision specified for sewing.
This commit is contained in:
@@ -123,6 +123,10 @@
|
|||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#include <TopTools_MapOfShape.hxx>
|
#include <TopTools_MapOfShape.hxx>
|
||||||
#include <TopTools_SequenceOfShape.hxx>
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
|
#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
|
#include <ShapeBuild_Edge.hxx>
|
||||||
|
#include <ShapeFix_ShapeTolerance.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(BRepBuilderAPI_Sewing, Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(BRepBuilderAPI_Sewing, Standard_Transient)
|
||||||
|
|
||||||
@@ -755,6 +759,7 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
else itf2.Initialize(listFacesFirst);
|
else itf2.Initialize(listFacesFirst);
|
||||||
Standard_Boolean isResEdge = Standard_False;
|
Standard_Boolean isResEdge = Standard_False;
|
||||||
TopoDS_Face fac2;
|
TopoDS_Face fac2;
|
||||||
|
|
||||||
for (; itf2.More(); itf2.Next()) {
|
for (; itf2.More(); itf2.Next()) {
|
||||||
Handle(Geom2d_Curve) c2d2, c2d21;
|
Handle(Geom2d_Curve) c2d2, c2d21;
|
||||||
Standard_Real firstOld, lastOld;
|
Standard_Real firstOld, lastOld;
|
||||||
@@ -919,7 +924,7 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
{
|
{
|
||||||
Standard_Real tolReached_2 = BRep_Tool::Tolerance(s_edge);
|
Standard_Real tolReached_2 = BRep_Tool::Tolerance(s_edge);
|
||||||
second_ok = (BRep_Tool::SameParameter(s_edge) && tolReached_2 < tolReached);
|
second_ok = (BRep_Tool::SameParameter(s_edge) && tolReached_2 < tolReached);
|
||||||
if( second_ok)
|
if (second_ok && tolReached_2 < myTolerance)
|
||||||
{
|
{
|
||||||
edge = s_edge;
|
edge = s_edge;
|
||||||
whichSec = whichSecn;
|
whichSec = whichSecn;
|
||||||
@@ -938,6 +943,8 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
for (i = 1; i <= nbp; i++)
|
for (i = 1; i <= nbp; i++)
|
||||||
c3dpnt(i) = c3dAdapt.Value(first3d + (i - 1)*deltaT);
|
c3dpnt(i) = c3dAdapt.Value(first3d + (i - 1)*deltaT);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Real dist = 0., maxTol = -1.0;
|
Standard_Real dist = 0., maxTol = -1.0;
|
||||||
Standard_Boolean more = Standard_True;
|
Standard_Boolean more = Standard_True;
|
||||||
|
|
||||||
@@ -963,6 +970,25 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
dist2 = dist;
|
dist2 = dist;
|
||||||
}
|
}
|
||||||
maxTol = Max(sqrt(dist2) * (1. + 1e-7), Precision::Confusion());
|
maxTol = Max(sqrt(dist2) * (1. + 1e-7), Precision::Confusion());
|
||||||
|
if (maxTol > myTolerance)
|
||||||
|
{
|
||||||
|
ShapeBuild_Edge aSbe;
|
||||||
|
TopoDS_Edge edgeNew = aSbe.Copy(edge);
|
||||||
|
ShapeFix_Edge sfe;
|
||||||
|
ShapeBuild_Edge().RemovePCurve(edgeNew, surf2, loc2);
|
||||||
|
ShapeFix_ShapeTolerance aSft;
|
||||||
|
aSft.SetTolerance(edgeNew, Precision::Confusion());
|
||||||
|
sfe.FixAddPCurve(edgeNew, surf2, loc2, Standard_False, myTolerance);
|
||||||
|
aBuilder.SameParameter(edgeNew, Standard_False);
|
||||||
|
aBuilder.SameRange(edgeNew, Standard_False);
|
||||||
|
sfe.FixSameParameter(edgeNew, myTolerance);
|
||||||
|
Standard_Real aTolProj = BRep_Tool::Tolerance(edgeNew);
|
||||||
|
if (aTolProj < maxTol)
|
||||||
|
{
|
||||||
|
edge = edgeNew;
|
||||||
|
maxTol = aTolProj;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxTol >= 0. && maxTol < tolReached)
|
if (maxTol >= 0. && maxTol < tolReached)
|
||||||
@@ -980,8 +1006,8 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
}
|
}
|
||||||
aBuilder.SameParameter(edge, Standard_True);
|
aBuilder.SameParameter(edge, Standard_True);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
Standard_Real tolEdge1 = BRep_Tool::Tolerance(edge);
|
Standard_Real tolEdge1 = BRep_Tool::Tolerance(edge);
|
||||||
if (tolEdge1 > MaxTolerance()) edge.Nullify();
|
if (tolEdge1 > MaxTolerance()) edge.Nullify();
|
||||||
return edge;
|
return edge;
|
||||||
|
Reference in New Issue
Block a user