0001216: Unable to Loft Sketches with Radiused Corners

This commit is contained in:
wmayer 2013-08-16 12:59:00 +02:00
parent e3a9355148
commit 89a5d06926
2 changed files with 25 additions and 2 deletions

View File

@ -26,6 +26,8 @@
# include <BRepAlgoAPI_Section.hxx> # include <BRepAlgoAPI_Section.hxx>
# include <BRepBuilderAPI_MakeWire.hxx> # include <BRepBuilderAPI_MakeWire.hxx>
# include <gp_Pln.hxx> # include <gp_Pln.hxx>
# include <Precision.hxx>
# include <ShapeFix_Wire.hxx>
# include <TopExp_Explorer.hxx> # include <TopExp_Explorer.hxx>
# include <TopoDS.hxx> # include <TopoDS.hxx>
# include <TopoDS_Edge.hxx> # include <TopoDS_Edge.hxx>
@ -59,6 +61,7 @@ std::list<TopoDS_Wire> CrossSection::section(double d) const
void CrossSection::connectEdges (const std::list<TopoDS_Edge>& edges, std::list<TopoDS_Wire>& wires) const void CrossSection::connectEdges (const std::list<TopoDS_Edge>& edges, std::list<TopoDS_Wire>& wires) const
{ {
// FIXME: Use ShapeAnalysis_FreeBounds::ConnectEdgesToWires() as an alternative
std::list<TopoDS_Edge> edge_list = edges; std::list<TopoDS_Edge> edge_list = edges;
while (edge_list.size() > 0) { while (edge_list.size() > 0) {
BRepBuilderAPI_MakeWire mkWire; BRepBuilderAPI_MakeWire mkWire;
@ -84,6 +87,14 @@ void CrossSection::connectEdges (const std::list<TopoDS_Edge>& edges, std::list<
} }
} }
while (found); while (found);
wires.push_back(new_wire);
// Fix any topological issues of the wire
ShapeFix_Wire aFix;
aFix.SetPrecision(Precision::Confusion());
aFix.Load(new_wire);
aFix.FixReorder();
aFix.FixConnected();
aFix.FixClosed();
wires.push_back(aFix.Wire());
} }
} }

View File

@ -24,6 +24,8 @@
#include "PreCompiled.h" #include "PreCompiled.h"
#ifndef _PreComp_ #ifndef _PreComp_
# include <BRep_Builder.hxx> # include <BRep_Builder.hxx>
# include <Precision.hxx>
# include <ShapeFix_Wire.hxx>
# include <TopoDS_Compound.hxx> # include <TopoDS_Compound.hxx>
#endif #endif
@ -1922,6 +1924,8 @@ TopoShape Sketch::toShape(void) const
} }
} }
// FIXME: Use ShapeAnalysis_FreeBounds::ConnectEdgesToWires() as an alternative
//
// sort them together to wires // sort them together to wires
while (edge_list.size() > 0) { while (edge_list.size() > 0) {
BRepBuilderAPI_MakeWire mkWire; BRepBuilderAPI_MakeWire mkWire;
@ -1947,7 +1951,15 @@ TopoShape Sketch::toShape(void) const
} }
} }
while (found); while (found);
wires.push_back(new_wire);
// Fix any topological issues of the wire
ShapeFix_Wire aFix;
aFix.SetPrecision(Precision::Confusion());
aFix.Load(new_wire);
aFix.FixReorder();
aFix.FixConnected();
aFix.FixClosed();
wires.push_back(aFix.Wire());
} }
if (wires.size() == 1) if (wires.size() == 1)
result = *wires.begin(); result = *wires.begin();