From 14ced6b20277bc099dacc08dec5fc13f60720760 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 3 Jul 2013 07:56:36 +0200 Subject: [PATCH] 0001133: crash at padding a sketch with 42 holes --- src/Mod/PartDesign/App/FeatureFace.cpp | 18 +++++++++------- src/Mod/PartDesign/App/FeatureFace.h | 3 +++ src/Mod/PartDesign/App/FeatureSketchBased.cpp | 21 +++++++++++-------- src/Mod/PartDesign/App/FeatureSketchBased.h | 2 ++ 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureFace.cpp b/src/Mod/PartDesign/App/FeatureFace.cpp index 55030f6c9..fb4b81dcf 100644 --- a/src/Mod/PartDesign/App/FeatureFace.cpp +++ b/src/Mod/PartDesign/App/FeatureFace.cpp @@ -105,23 +105,25 @@ App::DocumentObjectExecReturn *Face::execute(void) return App::DocumentObject::StdReturn; } -namespace PartDesign { - // sort bounding boxes according to diagonal length -struct Wire_Compare { +class Face::Wire_Compare { +public: bool operator() (const TopoDS_Wire& w1, const TopoDS_Wire& w2) { Bnd_Box box1, box2; - BRepBndLib::Add(w1, box1); - box1.SetGap(0.0); + if (!w1.IsNull()) { + BRepBndLib::Add(w1, box1); + box1.SetGap(0.0); + } - BRepBndLib::Add(w2, box2); - box2.SetGap(0.0); + if (!w2.IsNull()) { + BRepBndLib::Add(w2, box2); + box2.SetGap(0.0); + } return box1.SquareExtent() < box2.SquareExtent(); } }; -} TopoDS_Shape Face::makeFace(std::list& wires) const { diff --git a/src/Mod/PartDesign/App/FeatureFace.h b/src/Mod/PartDesign/App/FeatureFace.h index b30ec92ef..2cb69bd91 100644 --- a/src/Mod/PartDesign/App/FeatureFace.h +++ b/src/Mod/PartDesign/App/FeatureFace.h @@ -48,6 +48,9 @@ public: protected: TopoDS_Shape makeFace(const std::vector&) const; TopoDS_Shape makeFace(std::list&) const; // for internal use only + +private: + class Wire_Compare; }; } //namespace PartDesign diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index c5c856761..0e2027160 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -69,18 +69,21 @@ using namespace PartDesign; -namespace PartDesign { - // sort bounding boxes according to diagonal length -struct Wire_Compare { +class SketchBased::Wire_Compare { +public: bool operator() (const TopoDS_Wire& w1, const TopoDS_Wire& w2) { Bnd_Box box1, box2; - BRepBndLib::Add(w1, box1); - box1.SetGap(0.0); + if (!w1.IsNull()) { + BRepBndLib::Add(w1, box1); + box1.SetGap(0.0); + } - BRepBndLib::Add(w2, box2); - box2.SetGap(0.0); + if (!w2.IsNull()) { + BRepBndLib::Add(w2, box2); + box2.SetGap(0.0); + } return box1.SquareExtent() < box2.SquareExtent(); } @@ -799,6 +802,7 @@ void SketchBased::remapSupportShape(const TopoDS_Shape& newShape) } } +namespace PartDesign { struct gp_Pnt_Less : public std::binary_function { @@ -814,6 +818,7 @@ struct gp_Pnt_Less : public std::binary_function