From 9a1701fbcb2f58d55a3e1893bede9744a9047662 Mon Sep 17 00:00:00 2001 From: jgv Date: Wed, 18 Dec 2019 18:24:16 +0300 Subject: [PATCH] 0030597: Result of BRepOffsetAPI_MakePipeShell doesn't match the given profiles Modify the local function EdgeToBSpline of BRepFill_NSections to build a BSpline curve of general type for each curve of profile. --- src/BRepFill/BRepFill_NSections.cxx | 17 +++++--------- tests/bugs/modalg_7/bug30597 | 36 +++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/BRepFill/BRepFill_NSections.cxx b/src/BRepFill/BRepFill_NSections.cxx index e291a26dde..c2a827123d 100644 --- a/src/BRepFill/BRepFill_NSections.cxx +++ b/src/BRepFill/BRepFill_NSections.cxx @@ -105,20 +105,15 @@ static Handle(Geom_BSplineCurve) EdgeToBSpline (const TopoDS_Edge& theEdge) Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aLoc, aFirst, aLast); // convert its part used by edge to bspline; note that if edge curve is bspline, - // conversion made via trimmed curve is still needed -- it will copy it, segment - // as appropriate, and remove periodicity if it is periodic (deadly for approximator) + // approximation or conversion made via trimmed curve is still needed -- it will copy it, + // segment as appropriate, and remove periodicity if it is periodic (deadly for approximator) Handle(Geom_TrimmedCurve) aTrimCurve = new Geom_TrimmedCurve (aCurve, aFirst, aLast); - // special treatment of conic curve - if (aTrimCurve->BasisCurve()->IsKind(STANDARD_TYPE(Geom_Conic))) - { - const Handle(Geom_Curve)& aCurveTemp = aTrimCurve; // to avoid ambiguity - GeomConvert_ApproxCurve anAppr (aCurveTemp, Precision::Confusion(), GeomAbs_C1, 16, 14); - if (anAppr.HasResult()) - aBSCurve = anAppr.Curve(); - } + const Handle(Geom_Curve)& aCurveTemp = aTrimCurve; // to avoid ambiguity + GeomConvert_ApproxCurve anAppr (aCurveTemp, Precision::Confusion(), GeomAbs_C1, 16, 14); + if (anAppr.HasResult()) + aBSCurve = anAppr.Curve(); - // general case if (aBSCurve.IsNull()) aBSCurve = GeomConvert::CurveToBSplineCurve (aTrimCurve); diff --git a/tests/bugs/modalg_7/bug30597 b/tests/bugs/modalg_7/bug30597 index 6f09f09b25..b99025d057 100644 --- a/tests/bugs/modalg_7/bug30597 +++ b/tests/bugs/modalg_7/bug30597 @@ -1,6 +1,6 @@ -puts "================================================================" -puts "OCC30597: BRepOffsetAPI_MakePipeShell raises Standard_RangeError" -puts "================================================================" +puts "================================================================================" +puts "OCC30597: Result of BRepOffsetAPI_MakePipeShell doesn't match the given profiles" +puts "================================================================================" puts "" restore [locate_data_file bug30597_compound.brep] a @@ -16,4 +16,32 @@ addsweep a_3_1 a_1_2 buildsweep result -checkprops result -s 0.95884 +checkprops result -s 0.880677 + +explode result e + +explode a_2_1 +mkcurve c2 a_2_1_1 +cvalue c2 pi x2 y2 z2 +vertex v2 x2 y2 z2 +distmini d2 v2 result_2 + +if {[dval d2_val] > 1.e-7} { + puts "Error: result is far from first profile" +} + +explode a_3_1 +mkcurve c3 a_3_1_1 +cvalue c3 pi x3 y3 z3 +vertex v3 x3 y3 z3 +distmini d3 v3 result_3 + +if {[dval d3_val] > 1.e-7} { + puts "Error: result is far from second profile" +} + +smallview +donly result a_2_1 a_3_1 +fit + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png