let vtk decide on the file extension

This commit is contained in:
Martin Diehl 2019-03-09 00:40:50 +01:00
parent 2394880741
commit 60feb96afd
3 changed files with 3 additions and 6 deletions

View File

@ -67,7 +67,6 @@ elif vtk_ext == '.vtk':
reader.Update()
rGrid = reader.GetRectilinearGridOutput()
writer = vtk.vtkXMLRectilinearGridWriter()
vtk_ext = '.vtr'
elif vtk_ext == '.vtu':
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName(options.vtk)
@ -77,7 +76,7 @@ elif vtk_ext == '.vtu':
else:
parser.error('Unsupported VTK file type extension.')
writer.SetFileName(vtk_file+vtk_ext)
writer.SetFileName(vtk_file+'.'+writer.GetDefaultFileExtension())
Npoints = rGrid.GetNumberOfPoints()
Ncells = rGrid.GetNumberOfCells()

View File

@ -61,7 +61,6 @@ elif vtk_ext == '.vtk':
reader.SetFileName(options.vtk)
reader.Update()
Polydata = reader.GetPolyDataOutput()
vtk_ext = '.vtp'
else:
parser.error('unsupported VTK file type extension.')
@ -152,7 +151,7 @@ for name in filenames:
writer = vtk.vtkXMLPolyDataWriter()
writer.SetDataModeToBinary()
writer.SetCompressorTypeToZLib()
writer.SetFileName(vtk_file+vtk_ext)
writer.SetFileName(vtk_file+'.'+writer.GetDefaultFileExtension())
writer.SetInputData(Polydata)
writer.Write()

View File

@ -64,7 +64,6 @@ elif vtk_ext == '.vtk':
reader.SetFileName(options.vtk)
reader.Update()
rGrid = reader.GetRectilinearGridOutput()
vtk_ext = '.vtr'
else:
parser.error('unsupported VTK file type extension.')
@ -161,7 +160,7 @@ for name in filenames:
writer = vtk.vtkXMLRectilinearGridWriter()
writer.SetDataModeToBinary()
writer.SetCompressorTypeToZLib()
writer.SetFileName(vtk_file+vtk_ext)
writer.SetFileName(vtk_file+'.'+writer.GetDefaultFileExtension())
writer.SetInputData(rGrid)
writer.Write()