From 107f794fc9e5115efa57d268a005158d8c8c4733 Mon Sep 17 00:00:00 2001 From: jgv Date: Thu, 20 Apr 2017 14:08:07 +0300 Subject: [PATCH] 0028661: BRepOffsetAPI_MakePipeShell throws an exception Standard_NoSuchObject: NCollection_DataMap::Find 1. Clearance of fields of class has been added to the method BRepFill_PipeShell::Prepare(). 2. Calculation of error on surfaces has been corrected in the method GeomFill_Sweep::BuildKPart(). 3. New Draw command "errorsweep" has been added to check the error reached on the surfaces built by BRepOffsetAPI_MakePipeShell algorithm. --- src/BRepFill/BRepFill_PipeShell.cxx | 3 ++ src/BRepTest/BRepTest_SweepCommands.cxx | 21 +++++++++++++ src/GeomFill/GeomFill_Sweep.cxx | 13 ++------- tests/bugs/modalg_6/bug27769 | 27 ----------------- tests/bugs/modalg_6/bug28661_1 | 36 +++++++++++++++++++++++ tests/bugs/modalg_6/bug28661_2 | 39 +++++++++++++++++++++++++ 6 files changed, 102 insertions(+), 37 deletions(-) delete mode 100644 tests/bugs/modalg_6/bug27769 create mode 100644 tests/bugs/modalg_6/bug28661_1 create mode 100644 tests/bugs/modalg_6/bug28661_2 diff --git a/src/BRepFill/BRepFill_PipeShell.cxx b/src/BRepFill/BRepFill_PipeShell.cxx index 41379ca5bb..bf89576d86 100644 --- a/src/BRepFill/BRepFill_PipeShell.cxx +++ b/src/BRepFill/BRepFill_PipeShell.cxx @@ -937,6 +937,9 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape, //======================================================================= void BRepFill_PipeShell::Prepare() { + WSeq.Clear(); + myEdgeNewEdges.Clear(); + TopoDS_Wire theSect; if (!IsReady()) throw StdFail_NotDone("PipeShell"); if (!myLocation.IsNull() && !mySection.IsNull()) return; // It is ready diff --git a/src/BRepTest/BRepTest_SweepCommands.cxx b/src/BRepTest/BRepTest_SweepCommands.cxx index 2cd7a1c06c..8f3b51f120 100644 --- a/src/BRepTest/BRepTest_SweepCommands.cxx +++ b/src/BRepTest/BRepTest_SweepCommands.cxx @@ -856,6 +856,24 @@ static Standard_Integer gensweep(Draw_Interpretor&, return 0; } +//======================================================================= +//function : errorsweep +//purpose : returns the summary error on resulting surfaces +// reached by Sweep +//======================================================================= +static Standard_Integer errorsweep(Draw_Interpretor& di, + Standard_Integer, const char**) +{ + if (!Sweep->IsDone()) + { + di << "Sweep is not done\n"; + return 1; + } + Standard_Real ErrorOnSurfaces = Sweep->ErrorOnSurface(); + di << "Tolerance on surfaces = " << ErrorOnSurfaces << "\n"; + return 0; +} + //======================================================================= // simulsweep //======================================================================= @@ -998,6 +1016,9 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands) theCommands.Add("gensweep", "gensweep res subshape_of_profile", __FILE__,gensweep,g); + theCommands.Add("errorsweep", "errorsweep: returns the summary error on resulting surfaces reached by Sweep", + __FILE__,errorsweep,g); + theCommands.Add("simulsweep", "simulsweep r [n] [option]" __FILE__,simulsweep,g); theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]" diff --git a/src/GeomFill/GeomFill_Sweep.cxx b/src/GeomFill/GeomFill_Sweep.cxx index 01cf6d5adb..d37105dd82 100644 --- a/src/GeomFill/GeomFill_Sweep.cxx +++ b/src/GeomFill/GeomFill_Sweep.cxx @@ -835,21 +835,14 @@ static Standard_Boolean IsSweepParallelSpine (const Handle(GeomFill_LocationLaw) error *= C.Radius(); if (error <= Tol) { SError = error; - error += Radius + Abs(RotRadius - C.Radius())/2; - if (error <= Tol || Radius <= Tol) { + error += Radius; + if (Radius <= Tol) { // (2.1.a) Sphere Standard_Real f = UFirst , l = ULast, aRadius = 0.0; SError = error; Centre.BaryCenter(1.0, C.Location(), 1.0); gp_Ax3 AxisOfSphere(Centre, DN, DS); - if (Radius <= Tol) - { - aRadius = C.Radius(); - } - else - { - aRadius = (RotRadius + C.Radius()) / 2; - } + aRadius = C.Radius(); gp_Sphere theSphere( AxisOfSphere, aRadius ); S = new Geom_SphericalSurface(theSphere); // Pour les spheres on ne peut pas controler le parametre diff --git a/tests/bugs/modalg_6/bug27769 b/tests/bugs/modalg_6/bug27769 deleted file mode 100644 index ae1b6432ff..0000000000 --- a/tests/bugs/modalg_6/bug27769 +++ /dev/null @@ -1,27 +0,0 @@ -puts "========" -puts "OCC27769" -puts "========" -puts "" -################################################# -# BRepOffsetAPI_MakePipeShell produces a face -# based on degenerated toroidal surfaces -################################################# - -restore [locate_data_file bug27769_W5_slot.brep] w -restore [locate_data_file bug27769_A4_slot.brep] e - -wire p e -mksweep p -addsweep w -buildsweep r -explode r f -mksurface s1 r_1 -set info [dump s1] - -set check [regexp "SphericalSurface" $info] - -if { ${check} == 1 } { - puts "OK: The basic surface is spherical surface." -} else { - puts "Faulty: The basic surface is not spherical surface." -} \ No newline at end of file diff --git a/tests/bugs/modalg_6/bug28661_1 b/tests/bugs/modalg_6/bug28661_1 new file mode 100644 index 0000000000..3a634c0361 --- /dev/null +++ b/tests/bugs/modalg_6/bug28661_1 @@ -0,0 +1,36 @@ +puts "============" +puts "OCC28661" +puts "============" +puts "" +####################################################################### +# BRepOffsetAPI_MakePipeShell throws an exception Standard_NoSuchObject +####################################################################### + +restore [locate_data_file bug27769_W5_slot.brep] pr +restore [locate_data_file bug27769_A4_slot.brep] sp +wire sp sp + +mksweep sp +addsweep pr +buildsweep r + +explode r f +mksurface s1 r_1 +set info [dump s1] + +set check [regexp "SphericalSurface" $info] + +if { ${check} == 1 } { + puts "OK: The basic surface is spherical surface." +} else { + puts "Faulty: The basic surface is not spherical surface." +} + +set info1 [errorsweep] + +set check [regexp {Tolerance on surfaces = ([0-9\-+Ee.]+)} $info1 str error] + +checkreal "Accuracy" $error 0 1.e-10 0 + +setsweep -FR +buildsweep r1 diff --git a/tests/bugs/modalg_6/bug28661_2 b/tests/bugs/modalg_6/bug28661_2 new file mode 100644 index 0000000000..938f0a33f9 --- /dev/null +++ b/tests/bugs/modalg_6/bug28661_2 @@ -0,0 +1,39 @@ +puts "============" +puts "OCC28661" +puts "============" +puts "" +####################################################################### +# BRepOffsetAPI_MakePipeShell throws an exception Standard_NoSuchObject +####################################################################### + +circle sp 0 0 0 6 +mkedge sp sp +wire sp sp +circle pr 0 0 0 0 -1 0 10 +trim pr pr 0 pi +mkedge pr pr +wire pr pr + +mksweep sp +addsweep pr +buildsweep r + +explode r f +mksurface s1 r_1 +set info [dump s1] + +set check [regexp "SphericalSurface" $info] + +if { ${check} == 1 } { + puts "OK: The basic surface is spherical surface." +} else { + puts "Faulty: The basic surface is not spherical surface." +} + +set info1 [errorsweep] + +set check [regexp {Tolerance on surfaces = ([0-9\-+Ee.]+)} $info1 str error] + +if { $error != 0 } { + puts "Faulty: tolerance reached on resulting surfaces is wrong" +}