+ Make Python API more pythonic
This commit is contained in:
@@ -163,10 +163,10 @@ static PyObject * exporter(PyObject *self, PyObject *args)
|
||||
MeshObject global_mesh;
|
||||
|
||||
PY_TRY {
|
||||
Py::List list(object);
|
||||
Py::Sequence list(object);
|
||||
Base::Type meshId = Base::Type::fromName("Mesh::Feature");
|
||||
Base::Type partId = Base::Type::fromName("Part::Feature");
|
||||
for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
PyObject* item = (*it).ptr();
|
||||
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
|
||||
@@ -382,25 +382,24 @@ createBox(PyObject *self, PyObject *args)
|
||||
|
||||
static PyObject *
|
||||
calculateEigenTransform(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *input;
|
||||
{
|
||||
PyObject *input;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O",&input))
|
||||
return NULL;
|
||||
if (!PyArg_ParseTuple(args, "O",&input))
|
||||
return NULL;
|
||||
|
||||
if(! PySequence_Check(input) ){
|
||||
PyErr_SetString(PyExc_Exception, "Input have to be a sequence of Base.Vector()");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PY_TRY {
|
||||
|
||||
MeshCore::MeshKernel aMesh;
|
||||
MeshCore::MeshPointArray vertices;
|
||||
vertices.clear();
|
||||
MeshCore::MeshFacetArray faces;
|
||||
faces.clear();
|
||||
MeshCore::MeshPoint current_node;
|
||||
PY_TRY {
|
||||
MeshCore::MeshKernel aMesh;
|
||||
MeshCore::MeshPointArray vertices;
|
||||
vertices.clear();
|
||||
MeshCore::MeshFacetArray faces;
|
||||
faces.clear();
|
||||
MeshCore::MeshPoint current_node;
|
||||
|
||||
Py::Sequence list(input);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
|
||||
Reference in New Issue
Block a user