+ make try/catch block around sortEdges

+ set shape immutable when getting from feature
+ no use of tuples in removeShape

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5402 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2012-01-12 14:04:19 +00:00
parent 7feebeb5a2
commit d3af186c1c
3 changed files with 46 additions and 34 deletions

View File

@@ -1320,14 +1320,21 @@ static PyObject * sortEdges(PyObject *self, PyObject *args)
}
}
std::list<TopoDS_Edge> sorted = sort_Edges(Precision::Confusion(), edges);
try {
std::list<TopoDS_Edge> sorted = sort_Edges(Precision::Confusion(), edges);
Py::List sorted_list;
for (std::list<TopoDS_Edge>::iterator it = sorted.begin(); it != sorted.end(); ++it) {
sorted_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(*it)),true));
Py::List sorted_list;
for (std::list<TopoDS_Edge>::iterator it = sorted.begin(); it != sorted.end(); ++it) {
sorted_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(*it)),true));
}
return Py::new_reference_to(sorted_list);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return 0;
}
return Py::new_reference_to(sorted_list);
}
static PyObject * cast_to_shape(PyObject *self, PyObject *args)