Commit 93ce14c0750da0e4e313f9810694da70f7916d7c

Authored by Thiago Franco de Moraes
1 parent d09e271c
Exists in import_mesh

Added error messages when importing surface file

Showing 1 changed file with 6 additions and 3 deletions   Show diff stats
invesalius/data/surface.py
... ... @@ -260,15 +260,18 @@ class SurfaceManager():
260 260 elif filename.lower().endswith('.vtp'):
261 261 reader = vtk.vtkXMLPolyDataReader()
262 262 else:
  263 + wx.MessageBox(_("File format not reconized by InVesalius"), _("Import surface error"))
263 264 return
264 265  
265 266 reader.SetFileName(filename)
266 267 reader.Update()
267 268 polydata = reader.GetOutput()
268 269  
269   - name = os.path.splitext(os.path.split(filename)[-1])[0]
270   -
271   - self.CreateSurfaceFromPolydata(polydata, name=name)
  270 + if polydata.GetNumberOfPoints() == 0:
  271 + wx.MessageBox(_("InVesalius was not able to import this surface"), _("Import surface error"))
  272 + else:
  273 + name = os.path.splitext(os.path.split(filename)[-1])[0]
  274 + self.CreateSurfaceFromPolydata(polydata, name=name)
272 275  
273 276 def CreateSurfaceFromPolydata(self, polydata, overwrite=False,
274 277 name=None, colour=None,
... ...