diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py index 718cfeb..5a90d67 100644 --- a/invesalius/data/surface.py +++ b/invesalius/data/surface.py @@ -876,7 +876,14 @@ class SurfaceManager(): os.remove(_temp_file) temp_file = utl.decode(temp_file, const.FS_ENCODE) - self._export_surface(temp_file, filetype) + try: + self._export_surface(temp_file, filetype) + except ValueError: + if wx.GetApp() is None: + print("It was not possible to export the surface because the surface is empty") + else: + wx.MessageBox(_("It was not possible to export the surface because the surface is empty"), _("Export surface error")) + return shutil.move(temp_file, filename) @@ -903,6 +910,9 @@ class SurfaceManager(): else: polydata = pu.Merge(polydata_list) + if polydata.GetNumberOfPoints() == 0: + raise ValueError + # Having a polydata that represents all surfaces # selected, we write it, according to filetype if filetype == const.FILETYPE_STL: -- libgit2 0.21.2