diff --git a/src/Mod/Part/App/TopoShapeCompoundPy.xml b/src/Mod/Part/App/TopoShapeCompoundPy.xml
index 54036576d..eebec76d5 100644
--- a/src/Mod/Part/App/TopoShapeCompoundPy.xml
+++ b/src/Mod/Part/App/TopoShapeCompoundPy.xml
@@ -19,5 +19,10 @@
Add a shape to the compound.
+
+
+ Build a compound of wires out of the edges of this compound.
+
+
diff --git a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp
index 489abda5e..3b84d7b97 100644
--- a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp
+++ b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp
@@ -27,6 +27,10 @@
#include
#include
#include
+#include
+#include
+#include
+#include
// inclusion of the generated files (generated out of TopoShapeCompoundPy.xml)
#include "TopoShapeCompoundPy.h"
@@ -103,6 +107,42 @@ PyObject* TopoShapeCompoundPy::add(PyObject *args)
Py_Return;
}
+PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args)
+{
+ PyObject *shared=Py_True;
+ double tol = Precision::Confusion();
+ if (!PyArg_ParseTuple(args, "|O!d",&PyBool_Type,&shared,&tol))
+ return 0;
+
+ try {
+ const TopoDS_Shape& s = getTopoShapePtr()->_Shape;
+
+ Handle(TopTools_HSequenceOfShape) hEdges = new TopTools_HSequenceOfShape();
+ Handle(TopTools_HSequenceOfShape) hWires = new TopTools_HSequenceOfShape();
+ for (TopExp_Explorer xp(s, TopAbs_EDGE); xp.More(); xp.Next())
+ hEdges->Append(xp.Current());
+
+ ShapeAnalysis_FreeBounds::ConnectEdgesToWires(hEdges, tol, (shared==Py_True), hWires);
+
+ TopoDS_Compound comp;
+ BRep_Builder builder;
+ builder.MakeCompound(comp);
+
+ int len = hWires->Length();
+ for(int i=1;i<=len;i++) {
+ builder.Add(comp, hWires->Value(i));
+ }
+
+ getTopoShapePtr()->_Shape = comp;
+ return new TopoShapeCompoundPy(new TopoShape(comp));
+ }
+ catch (Standard_Failure) {
+ Handle_Standard_Failure e = Standard_Failure::Caught();
+ PyErr_SetString(PyExc_Exception, e->GetMessageString());
+ return 0;
+ }
+}
+
PyObject *TopoShapeCompoundPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
diff --git a/src/Mod/Part/App/TopoShapeWirePy.xml b/src/Mod/Part/App/TopoShapeWirePy.xml
index 21f6419d2..d1558e9a3 100644
--- a/src/Mod/Part/App/TopoShapeWirePy.xml
+++ b/src/Mod/Part/App/TopoShapeWirePy.xml
@@ -24,6 +24,11 @@
Add an edge to the wire
+
+
+ Fix wire
+
+
Make this and the given wire homogenous to have the same number of edges
diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp
index 839c75172..895b17dff 100644
--- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp
+++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp
@@ -28,6 +28,8 @@
# include
# include
# include
+# include
+# include
# include
# include
# include
@@ -42,6 +44,7 @@
#include "BSplineCurvePy.h"
#include "TopoShape.h"
#include "TopoShapeShellPy.h"
+#include "TopoShapeFacePy.h"
#include "TopoShapeEdgePy.h"
#include "TopoShapeWirePy.h"
#include "TopoShapeWirePy.cpp"
@@ -169,6 +172,40 @@ PyObject* TopoShapeWirePy::add(PyObject *args)
}
}
+PyObject* TopoShapeWirePy::fixWire(PyObject *args)
+{
+ PyObject* face=0;
+ double tol = Precision::Confusion();
+ if (!PyArg_ParseTuple(args, "|O!d",&(TopoShapeFacePy::Type), &face, &tol))
+ return 0;
+
+ try {
+ ShapeFix_Wire aFix;
+ const TopoDS_Wire& w = TopoDS::Wire(getTopoShapePtr()->_Shape);
+
+ if (face) {
+ const TopoDS_Face& f = TopoDS::Face(static_cast(face)->getTopoShapePtr()->_Shape);
+ aFix.Init(w, f, tol);
+ }
+ else {
+ aFix.SetPrecision(tol);
+ aFix.Load(w);
+ }
+
+ aFix.FixReorder();
+ aFix.FixConnected();
+ aFix.FixClosed();
+ getTopoShapePtr()->_Shape = aFix.Wire();
+
+ Py_Return;
+ }
+ catch (Standard_Failure) {
+ Handle_Standard_Failure e = Standard_Failure::Caught();
+ PyErr_SetString(PyExc_Exception, e->GetMessageString());
+ return 0;
+ }
+}
+
PyObject* TopoShapeWirePy::makeOffset(PyObject *args)
{
float dist;