From 21b7d8be4c6f15726d91a8257fa8e93ba5466e1d Mon Sep 17 00:00:00 2001 From: msv Date: Thu, 11 Dec 2014 15:40:05 +0300 Subject: [PATCH] 0025453: SIGSEGV in BRepFill_Sweep::BuildShell Fixed the bug causing exception when the first edge in generated sweep occurs to be degenerated. Comments have been added. Test-case for issue #25453 --- src/BRepFill/BRepFill_Sweep.cxx | 30 ++++++++++++++++++++++++------ tests/bugs/modalg_5/bug25453 | 22 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 tests/bugs/modalg_5/bug25453 diff --git a/src/BRepFill/BRepFill_Sweep.cxx b/src/BRepFill/BRepFill_Sweep.cxx index 99e7a04f55..ed78845b3e 100644 --- a/src/BRepFill/BRepFill_Sweep.cxx +++ b/src/BRepFill/BRepFill_Sweep.cxx @@ -2465,9 +2465,18 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section, } if (uclose && (isec==NbLaw)) { - UpdateEdge(TopoDS::Edge(UEdge(1, ipath)), - S, !exuv, ULast); - UEdge(isec+1, ipath) = UEdge(1, ipath); + if (UEdge(1, ipath).IsNull()) //degenerated case + { + UEdge(isec+1, ipath) = BuildEdge(S, !exuv, ULast, + Vertex(isec+1, ipath), + Vertex(isec+1, ipath+1), + myTol3d); + } + else { + UpdateEdge(TopoDS::Edge(UEdge(1, ipath)), + S, !exuv, ULast); + UEdge(isec+1, ipath) = UEdge(1, ipath); + } } else { if (UEdge(isec+1, ipath).IsNull()) @@ -2502,9 +2511,18 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section, S, exuv, VFirst); if (vclose && (ipath == NbPath)) { - UpdateEdge(TopoDS::Edge(VEdge(isec, 1)), - S, exuv, VLast); - VEdge(isec, ipath+1) = VEdge(isec, 1); + if (VEdge(isec, 1).IsNull()) //degenerated case + { + VEdge(isec, ipath+1) = BuildEdge(S, exuv, VLast, + Vertex(isec , ipath+1), + Vertex(isec+1, ipath+1), + myTol3d); + } + else { + UpdateEdge(TopoDS::Edge(VEdge(isec, 1)), + S, exuv, VLast); + VEdge(isec, ipath+1) = VEdge(isec, 1); + } } else if (VEdge(isec, ipath+1).IsNull()) VEdge(isec, ipath+1) = BuildEdge(S, exuv, VLast, diff --git a/tests/bugs/modalg_5/bug25453 b/tests/bugs/modalg_5/bug25453 new file mode 100644 index 0000000000..49f7d154b1 --- /dev/null +++ b/tests/bugs/modalg_5/bug25453 @@ -0,0 +1,22 @@ +puts "========" +puts "OCC25453" +puts "========" +puts "" +######################################### +# SIGSEGV in BRepFill_Sweep::BuildShell +######################################### + +smallview + +restore [locate_data_file OCC25453_sweep9-draw-Sketch001.brep] Sketch001 +explode Sketch001 E +wire Sweep-0-spine Sketch001_1 +mksweep Sweep-0-spine +setsweep -CF +restore [locate_data_file OCC25453_sweep9-draw-Sketch.brep] Sketch +trotate Sketch 0 0 0 1 0 0 90 +addsweep Sketch +buildsweep Sweep -C + +fit +set only_screen_axo 1