and system independent
This commit is contained in:
Martin Diehl 2020-03-11 07:50:11 +01:00
parent 32734e7dce
commit c92a6ad459
1 changed files with 3 additions and 4 deletions

View File

@ -1,7 +1,6 @@
import os import os
import numpy as np import numpy as np
import vtk import vtk
import vtkmodules
#from vtk.util import numpy_support #from vtk.util import numpy_support
class VTK: # capitals needed/preferred? class VTK: # capitals needed/preferred?
@ -58,11 +57,11 @@ class VTK: # capitals needed/preferred?
def write(self,fname): #ToDo: Discuss how to handle consistently filename extensions def write(self,fname): #ToDo: Discuss how to handle consistently filename extensions
if (isinstance(self.geom,vtkmodules.vtkCommonDataModel.vtkRectilinearGrid)): if (isinstance(self.geom,vtk.vtkRectilinearGrid)):
writer = vtk.vtkXMLRectilinearGridWriter() writer = vtk.vtkXMLRectilinearGridWriter()
elif(isinstance(self.geom,vtkmodules.vtkCommonDataModel.vtkUnstructuredGrid)): elif(isinstance(self.geom,vtk.vtkUnstructuredGrid)):
writer = vtk.vtkUnstructuredGrid() writer = vtk.vtkUnstructuredGrid()
elif(isinstance(self.geom,vtkmodules.vtkCommonDataModel.vtkPolyData)): elif(isinstance(self.geom,vtk.vtkPolyData)):
writer = vtk.vtkXMLPolyDataWriter() writer = vtk.vtkXMLPolyDataWriter()
writer.SetFileName('{}.{}'.format(os.path.splitext(fname)[0], writer.SetFileName('{}.{}'.format(os.path.splitext(fname)[0],