From 5da005403ba7f52bc1c27bc6c4898fb2d60c13c0 Mon Sep 17 00:00:00 2001 From: jgv Date: Mon, 19 Sep 2016 13:35:27 +0300 Subject: [PATCH] 0027822: Exception access violation is raised in BRepOffsetAPI_MakePipeShell during of build New public method IsDone() is added to abstract class BRepFill_SectionLaw. Test case bugs/modlag_6/bug27822 has been added --- src/BRepFill/BRepFill_NSections.cxx | 4 ++++ src/BRepFill/BRepFill_PipeShell.cxx | 2 ++ src/BRepFill/BRepFill_SectionLaw.cxx | 9 +++++++++ src/BRepFill/BRepFill_SectionLaw.hxx | 3 +++ src/BRepFill/BRepFill_ShapeLaw.cxx | 3 +++ tests/bugs/modalg_6/bug27822 | 27 +++++++++++++++++++++++++++ 6 files changed, 48 insertions(+) create mode 100644 tests/bugs/modalg_6/bug27822 diff --git a/src/BRepFill/BRepFill_NSections.cxx b/src/BRepFill/BRepFill_NSections.cxx index 2d637b603a..6696f8a8e1 100644 --- a/src/BRepFill/BRepFill_NSections.cxx +++ b/src/BRepFill/BRepFill_NSections.cxx @@ -360,6 +360,7 @@ BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S, } myParams = par; Init(par,Build); + myDone = Standard_True; } //======================================================================= @@ -399,7 +400,10 @@ BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S, VFirst = VF; VLast = VL; Init(P,Build); + myDone = Standard_True; } + else + myDone = Standard_False; } //======================================================================= diff --git a/src/BRepFill/BRepFill_PipeShell.cxx b/src/BRepFill/BRepFill_PipeShell.cxx index 553664d64d..95ec9e59d8 100644 --- a/src/BRepFill/BRepFill_PipeShell.cxx +++ b/src/BRepFill/BRepFill_PipeShell.cxx @@ -1143,6 +1143,8 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape, } myStatus = myLocation->GetStatus(); + if (!mySection->IsDone()) + myStatus = GeomFill_PipeNotOk; } //======================================================================= diff --git a/src/BRepFill/BRepFill_SectionLaw.cxx b/src/BRepFill/BRepFill_SectionLaw.cxx index 03ea21de07..516cf42ba9 100644 --- a/src/BRepFill/BRepFill_SectionLaw.cxx +++ b/src/BRepFill/BRepFill_SectionLaw.cxx @@ -78,6 +78,15 @@ Standard_Integer BRepFill_SectionLaw::NbLaw() const return vclosed; } +//======================================================================= +//function : IsDone +//purpose : +//======================================================================= + Standard_Boolean BRepFill_SectionLaw::IsDone() const +{ + return myDone; +} + //======================================================================= //function : Init //purpose : Prepare the parsing of a wire diff --git a/src/BRepFill/BRepFill_SectionLaw.hxx b/src/BRepFill/BRepFill_SectionLaw.hxx index c16de9e0cf..ba26ed09e7 100644 --- a/src/BRepFill/BRepFill_SectionLaw.hxx +++ b/src/BRepFill/BRepFill_SectionLaw.hxx @@ -54,6 +54,8 @@ public: Standard_EXPORT Standard_Boolean IsVClosed() const; + Standard_EXPORT Standard_Boolean IsDone() const; + //! Say if the input sahpe is a vertex. Standard_EXPORT virtual Standard_Boolean IsVertex() const = 0; @@ -82,6 +84,7 @@ protected: Handle(GeomFill_HArray1OfSectionLaw) myLaws; Standard_Boolean uclosed; Standard_Boolean vclosed; + Standard_Boolean myDone; private: diff --git a/src/BRepFill/BRepFill_ShapeLaw.cxx b/src/BRepFill/BRepFill_ShapeLaw.cxx index 5bdbf3766b..b95baae150 100644 --- a/src/BRepFill/BRepFill_ShapeLaw.cxx +++ b/src/BRepFill/BRepFill_ShapeLaw.cxx @@ -72,6 +72,7 @@ BRepFill_ShapeLaw::BRepFill_ShapeLaw(const TopoDS_Vertex& V, myLaws->ChangeValue(1) = new (GeomFill_UniformSection)(TC); } + myDone = Standard_True; } //======================================================================= @@ -88,6 +89,7 @@ BRepFill_ShapeLaw::BRepFill_ShapeLaw(const TopoDS_Wire& W, { TheLaw.Nullify(); Init(Build); + myDone = Standard_True; } //======================================================================= @@ -104,6 +106,7 @@ BRepFill_ShapeLaw::BRepFill_ShapeLaw(const TopoDS_Wire& W, { TheLaw = L; Init(Build); + myDone = Standard_True; } //======================================================================= diff --git a/tests/bugs/modalg_6/bug27822 b/tests/bugs/modalg_6/bug27822 new file mode 100644 index 0000000000..bf9ac5e703 --- /dev/null +++ b/tests/bugs/modalg_6/bug27822 @@ -0,0 +1,27 @@ +puts "========" +puts "OCC27822" +puts "========" +puts "" +####################################################################################### +# Exception access violation is raised in BRepOffsetAPI_MakePipeShell during of build +####################################################################################### + +circle c1 0 100 80 30 +circle c2 0 30 130 30 +mkedge e1 c1 +mkedge e2 c2 +vertex v1 0 0 0 +vertex v2 0 1 0 +edge e3 v1 v2 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mksweep w3 +addsweep w1 +addsweep w2 + +if {[catch {buildsweep result}]} { + puts "OCC27822 is fixed." +} else { + puts "ERROR: OCC27822 does not fixed correctly." +} -- 2.20.1