From 2a52cc0ff911be06bf7eb4c6589fe78fc65798ac Mon Sep 17 00:00:00 2001 From: aavtamon Date: Mon, 21 Dec 2020 10:25:12 +0300 Subject: [PATCH] Try to modify ShapeBuild_Edge --- src/ShapeBuild/ShapeBuild_Edge.cxx | 45 ++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/ShapeBuild/ShapeBuild_Edge.cxx b/src/ShapeBuild/ShapeBuild_Edge.cxx index 90383dec12..ff7f0440a5 100644 --- a/src/ShapeBuild/ShapeBuild_Edge.cxx +++ b/src/ShapeBuild/ShapeBuild_Edge.cxx @@ -32,9 +32,12 @@ #include #include #include +#include #include #include #include +#include +#include #include #include #include @@ -600,37 +603,55 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const { try { OCC_CATCH_SIGNALS + + //Modified 12.2020 in order to fix bug31840 by aavtamon + //Trying to create a line instead of bspline-curve created in BRepLib::BuildCurve3d(...) + Handle(Geom2d_Curve) anEdgeCurve; + Handle(Geom_Surface) anEdgeSurface; + TopLoc_Location aLocation; + Standard_Real aFirst, aLast; + BRep_Tool::CurveOnSurface(edge, anEdgeCurve, anEdgeSurface, aLocation, aFirst, aLast, 1); + if (anEdgeSurface->IsKind(STANDARD_TYPE(Geom_ConicalSurface)) || + anEdgeSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { + if (anEdgeCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { + + + return Standard_True; + } + } + //End of the new code + //#48 rln 10.12.98 S4054 UKI60107-5 entity 365 //C0 surface (but curve 3d is required as C1) and tolerance is 1e-07 //lets use maximum of tolerance and default parameter 1.e-5 //Another solutions: use quite big Tolerance or require C0 curve on C0 surface - if ( BRepLib::BuildCurve3d (edge, Max (1.e-5, BRep_Tool::Tolerance(edge) ) ) ) { + if (BRepLib::BuildCurve3d(edge, Max(1.e-5, BRep_Tool::Tolerance(edge)))) { //#50 S4054 rln 14.12.98 write cylinder in BRep mode into IGES and read back //with 2DUse_Forced - pcurve and removed 3D curves have different ranges - if (BRep_Tool::SameRange (edge)) { + if (BRep_Tool::SameRange(edge)) { Standard_Real first, last; - BRep_Tool::Range (edge, first, last); - BRep_Builder().Range (edge, first, last);//explicit setting for all reps + BRep_Tool::Range(edge, first, last); + BRep_Builder().Range(edge, first, last);//explicit setting for all reps } Handle(Geom_Curve) c3d; - Standard_Real f,l; - c3d = BRep_Tool::Curve(edge,f,l); + Standard_Real f, l; + c3d = BRep_Tool::Curve(edge, f, l); if (c3d.IsNull()) return Standard_False; // 15.11.2002 PTV OCC966 - if(!IsPeriodic(c3d)) { + if (!IsPeriodic(c3d)) { Standard_Boolean isLess = Standard_False; - if(f < c3d->FirstParameter()) { + if (f < c3d->FirstParameter()) { isLess = Standard_True; f = c3d->FirstParameter(); } - if(l > c3d->LastParameter()) { + if (l > c3d->LastParameter()) { isLess = Standard_True; l = c3d->LastParameter(); } - if(isLess) { - SetRange3d(edge,f,l); - BRep_Builder().SameRange(edge,Standard_False); + if (isLess) { + SetRange3d(edge, f, l); + BRep_Builder().SameRange(edge, Standard_False); } } -- 2.39.5