Merge commit 'v2.0.2-1939-ge5b65ede'
This commit is contained in:
commit
753fc6cf9a
|
@ -53,19 +53,22 @@ parser.set_defaults(data = [],
|
||||||
if not options.vtk: parser.error('No VTK file specified.')
|
if not options.vtk: parser.error('No VTK file specified.')
|
||||||
if not os.path.exists(options.vtk): parser.error('VTK file does not exist.')
|
if not os.path.exists(options.vtk): parser.error('VTK file does not exist.')
|
||||||
|
|
||||||
if os.path.splitext(options.vtk)[1] == '.vtr':
|
vtk_file,vtk_ext = os.path.splitext(options.vtk)
|
||||||
|
|
||||||
|
if vtk_ext == '.vtr':
|
||||||
reader = vtk.vtkXMLRectilinearGridReader()
|
reader = vtk.vtkXMLRectilinearGridReader()
|
||||||
reader.SetFileName(options.vtk)
|
reader.SetFileName(options.vtk)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
rGrid = reader.GetOutput()
|
rGrid = reader.GetOutput()
|
||||||
writer = vtk.vtkXMLRectilinearGridWriter()
|
writer = vtk.vtkXMLRectilinearGridWriter()
|
||||||
elif os.path.splitext(options.vtk)[1] == '.vtk':
|
elif vtk_ext == '.vtk':
|
||||||
reader = vtk.vtkGenericDataObjectReader()
|
reader = vtk.vtkGenericDataObjectReader()
|
||||||
reader.SetFileName(options.vtk)
|
reader.SetFileName(options.vtk)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
rGrid = reader.GetRectilinearGridOutput()
|
rGrid = reader.GetRectilinearGridOutput()
|
||||||
writer = vtk.vtkXMLRectilinearGridWriter()
|
writer = vtk.vtkXMLRectilinearGridWriter()
|
||||||
elif os.path.splitext(options.vtk)[1] == '.vtu':
|
vtk_ext = '.vtr'
|
||||||
|
elif vtk_ext == '.vtu':
|
||||||
reader = vtk.vtkXMLUnstructuredGridReader()
|
reader = vtk.vtkXMLUnstructuredGridReader()
|
||||||
reader.SetFileName(options.vtk)
|
reader.SetFileName(options.vtk)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
|
@ -74,7 +77,7 @@ elif os.path.splitext(options.vtk)[1] == '.vtu':
|
||||||
else:
|
else:
|
||||||
parser.error('Unsupported VTK file type extension.')
|
parser.error('Unsupported VTK file type extension.')
|
||||||
|
|
||||||
writer.SetFileName(options.vtk)
|
writer.SetFileName(vtk_file+vtk_ext)
|
||||||
|
|
||||||
Npoints = rGrid.GetNumberOfPoints()
|
Npoints = rGrid.GetNumberOfPoints()
|
||||||
Ncells = rGrid.GetNumberOfCells()
|
Ncells = rGrid.GetNumberOfCells()
|
||||||
|
|
|
@ -49,16 +49,19 @@ parser.set_defaults(data = [],
|
||||||
if not options.vtk: parser.error('no VTK file specified.')
|
if not options.vtk: parser.error('no VTK file specified.')
|
||||||
if not os.path.exists(options.vtk): parser.error('VTK file does not exist.')
|
if not os.path.exists(options.vtk): parser.error('VTK file does not exist.')
|
||||||
|
|
||||||
if os.path.splitext(options.vtk)[1] == '.vtp':
|
vtk_file,vtk_ext = os.path.splitext(options.vtk)
|
||||||
|
|
||||||
|
if vtk_ext == '.vtp':
|
||||||
reader = vtk.vtkXMLPolyDataReader()
|
reader = vtk.vtkXMLPolyDataReader()
|
||||||
reader.SetFileName(options.vtk)
|
reader.SetFileName(options.vtk)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
Polydata = reader.GetOutput()
|
Polydata = reader.GetOutput()
|
||||||
elif os.path.splitext(options.vtk)[1] == '.vtk':
|
elif vtk_ext == '.vtk':
|
||||||
reader = vtk.vtkGenericDataObjectReader()
|
reader = vtk.vtkGenericDataObjectReader()
|
||||||
reader.SetFileName(options.vtk)
|
reader.SetFileName(options.vtk)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
Polydata = reader.GetPolyDataOutput()
|
Polydata = reader.GetPolyDataOutput()
|
||||||
|
vtk_ext = '.vtp'
|
||||||
else:
|
else:
|
||||||
parser.error('unsupported VTK file type extension.')
|
parser.error('unsupported VTK file type extension.')
|
||||||
|
|
||||||
|
@ -149,7 +152,7 @@ for name in filenames:
|
||||||
writer = vtk.vtkXMLPolyDataWriter()
|
writer = vtk.vtkXMLPolyDataWriter()
|
||||||
writer.SetDataModeToBinary()
|
writer.SetDataModeToBinary()
|
||||||
writer.SetCompressorTypeToZLib()
|
writer.SetCompressorTypeToZLib()
|
||||||
writer.SetFileName(options.vtk)
|
writer.SetFileName(vtk_file+vtk_ext)
|
||||||
writer.SetInputData(Polydata)
|
writer.SetInputData(Polydata)
|
||||||
writer.Write()
|
writer.Write()
|
||||||
|
|
||||||
|
|
|
@ -53,16 +53,18 @@ parser.set_defaults(data = [],
|
||||||
if not options.vtk: parser.error('no VTK file specified.')
|
if not options.vtk: parser.error('no VTK file specified.')
|
||||||
if not os.path.exists(options.vtk): parser.error('VTK file does not exist.')
|
if not os.path.exists(options.vtk): parser.error('VTK file does not exist.')
|
||||||
|
|
||||||
if os.path.splitext(options.vtk)[1] == '.vtr':
|
vtk_file,vtk_ext = os.path.splitext(options.vtk)
|
||||||
|
if vtk_ext == '.vtr':
|
||||||
reader = vtk.vtkXMLRectilinearGridReader()
|
reader = vtk.vtkXMLRectilinearGridReader()
|
||||||
reader.SetFileName(options.vtk)
|
reader.SetFileName(options.vtk)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
rGrid = reader.GetOutput()
|
rGrid = reader.GetOutput()
|
||||||
elif os.path.splitext(options.vtk)[1] == '.vtk':
|
elif vtk_ext == '.vtk':
|
||||||
reader = vtk.vtkGenericDataObjectReader()
|
reader = vtk.vtkGenericDataObjectReader()
|
||||||
reader.SetFileName(options.vtk)
|
reader.SetFileName(options.vtk)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
rGrid = reader.GetRectilinearGridOutput()
|
rGrid = reader.GetRectilinearGridOutput()
|
||||||
|
vtk_ext = '.vtr'
|
||||||
else:
|
else:
|
||||||
parser.error('unsupported VTK file type extension.')
|
parser.error('unsupported VTK file type extension.')
|
||||||
|
|
||||||
|
@ -159,7 +161,7 @@ for name in filenames:
|
||||||
writer = vtk.vtkXMLRectilinearGridWriter()
|
writer = vtk.vtkXMLRectilinearGridWriter()
|
||||||
writer.SetDataModeToBinary()
|
writer.SetDataModeToBinary()
|
||||||
writer.SetCompressorTypeToZLib()
|
writer.SetCompressorTypeToZLib()
|
||||||
writer.SetFileName(options.vtk)
|
writer.SetFileName(vtk_file+vtk_ext)
|
||||||
writer.SetInputData(rGrid)
|
writer.SetInputData(rGrid)
|
||||||
writer.Write()
|
writer.Write()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue