Avoid empty meshes. Improve object type detection.

This commit is contained in:
Ian Rees
2017-02-19 13:22:55 +13:00
committed by wmayer
parent 2231baa060
commit da0f810282
3 changed files with 15 additions and 14 deletions

View File

@@ -315,7 +315,12 @@ private:
std::string outputFileName(fileNamePy);
PyMem_Free(fileNamePy);
MeshObject global_mesh;
// Construct list of objects to export before making the Exporter, so
// we don't get empty exports if the list can't be constructed.
Py::Sequence list(objects);
if (list.length() == 0) {
return Py::None();
}
auto exportFormat( MeshOutput::GetFormat(outputFileName.c_str()) );
@@ -338,7 +343,6 @@ private:
throw Py::Exception(Base::BaseExceptionFreeCADError, exStr.c_str());
}
Py::Sequence list(objects);
for (auto it : list) {
PyObject *item = it.ptr();
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {