From b3cbf2b3da6fb7aa98f043aa6e62908a24ff17ba Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 10 Apr 2015 18:25:31 +0200 Subject: [PATCH] + fix Part.__sortEdges__, check for object type in Part.Wire --- src/Mod/Part/App/AppPartPy.cpp | 4 ++++ src/Mod/Part/App/TopoShapeWirePyImp.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 7d0f9944c..b6bc68ac8 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -1524,24 +1524,28 @@ static std::list sort_Edges(double tol3d, const std::vectorv2; sorted.push_back(pEI->edge); edge_points.erase(pEI); + pEI = edge_points.begin(); break; } else if (pEI->v2.SquareDistance(first) <= tol3d) { first = pEI->v1; sorted.push_front(pEI->edge); edge_points.erase(pEI); + pEI = edge_points.begin(); break; } else if (pEI->v2.SquareDistance(last) <= tol3d) { last = pEI->v1; sorted.push_back(pEI->edge); edge_points.erase(pEI); + pEI = edge_points.begin(); break; } else if (pEI->v1.SquareDistance(first) <= tol3d) { first = pEI->v2; sorted.push_front(pEI->edge); edge_points.erase(pEI); + pEI = edge_points.begin(); break; } } diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp index 0f173e684..527401d38 100644 --- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp @@ -107,6 +107,11 @@ int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/) PyErr_Clear(); if (PyArg_ParseTuple(args, "O", &pcObj)) { + if(!Py::Object(pcObj).isList() && !Py::Object(pcObj).isTuple()) { + PyErr_SetString(PyExc_TypeError, "object is neither a list nor a tuple"); + return -1; + } + BRepBuilderAPI_MakeWire mkWire; Py::Sequence list(pcObj); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {