From 89a5d069261cf4ab233089571888e2cb4f8624fb Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 16 Aug 2013 12:59:00 +0200 Subject: [PATCH] 0001216: Unable to Loft Sketches with Radiused Corners --- src/Mod/Part/App/CrossSection.cpp | 13 ++++++++++++- src/Mod/Sketcher/App/Sketch.cpp | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/App/CrossSection.cpp b/src/Mod/Part/App/CrossSection.cpp index c58cb370c..ba9f30220 100644 --- a/src/Mod/Part/App/CrossSection.cpp +++ b/src/Mod/Part/App/CrossSection.cpp @@ -26,6 +26,8 @@ # include # include # include +# include +# include # include # include # include @@ -59,6 +61,7 @@ std::list CrossSection::section(double d) const void CrossSection::connectEdges (const std::list& edges, std::list& wires) const { + // FIXME: Use ShapeAnalysis_FreeBounds::ConnectEdgesToWires() as an alternative std::list edge_list = edges; while (edge_list.size() > 0) { BRepBuilderAPI_MakeWire mkWire; @@ -84,6 +87,14 @@ void CrossSection::connectEdges (const std::list& edges, std::list< } } 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()); } } diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 7ed811a76..1429d08ef 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -24,6 +24,8 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include +# include # include #endif @@ -1922,6 +1924,8 @@ TopoShape Sketch::toShape(void) const } } + // FIXME: Use ShapeAnalysis_FreeBounds::ConnectEdgesToWires() as an alternative + // // sort them together to wires while (edge_list.size() > 0) { BRepBuilderAPI_MakeWire mkWire; @@ -1947,7 +1951,15 @@ TopoShape Sketch::toShape(void) const } } 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) result = *wires.begin();