+ fix Part.__sortEdges__, check for object type in Part.Wire

This commit is contained in:
wmayer 2015-04-10 18:25:31 +02:00
parent 0c32b1b0ec
commit b3cbf2b3da
2 changed files with 9 additions and 0 deletions

View File

@ -1524,24 +1524,28 @@ static std::list<TopoDS_Edge> sort_Edges(double tol3d, const std::vector<TopoDS_
last = pEI->v2;
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;
}
}

View File

@ -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) {