0001133: crash at padding a sketch with 42 holes

This commit is contained in:
wmayer 2013-07-03 07:56:36 +02:00
parent 902ce7871f
commit 14ced6b202
4 changed files with 27 additions and 17 deletions

View File

@ -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<TopoDS_Wire>& wires) const
{

View File

@ -48,6 +48,9 @@ public:
protected:
TopoDS_Shape makeFace(const std::vector<TopoDS_Wire>&) const;
TopoDS_Shape makeFace(std::list<TopoDS_Wire>&) const; // for internal use only
private:
class Wire_Compare;
};
} //namespace PartDesign

View File

@ -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<const gp_Pnt&,
const gp_Pnt&, bool>
{
@ -814,6 +818,7 @@ struct gp_Pnt_Less : public std::binary_function<const gp_Pnt&,
return false; // points are considered to be equal
}
};
}
bool SketchBased::isQuasiEqual(const TopoDS_Shape& s1, const TopoDS_Shape& s2) const
{
@ -895,5 +900,3 @@ bool SketchBased::isParallelPlane(const TopoDS_Shape& s1, const TopoDS_Shape& s2
return false;
}
}

View File

@ -119,6 +119,8 @@ protected:
/// Check whether the line crosses the face (line and face must be on the same plane)
static const bool checkLineCrossesFace(const gp_Lin& line, const TopoDS_Face& face);
private:
class Wire_Compare;
};
} //namespace PartDesign