added option “inplace” to directly modify VTK file instead of creating copy_added.

This commit is contained in:
Philip Eisenlohr 2015-12-02 23:10:14 +00:00
parent fc2d79e17b
commit 55b33e5597
1 changed files with 6 additions and 1 deletions

View File

@ -38,6 +38,10 @@ parser.add_option('-c', '--color',
dest = 'color',
action = 'extend', metavar = '<string LIST>',
help = 'RGB color tuple label')
parser.add_option('-r', '--inplace',
dest = 'inplace',
action = 'store_true',
help = 'modify VTK file in place')
parser.add_option('-r', '--render',
dest = 'render',
action = 'store_true',
@ -46,6 +50,7 @@ parser.add_option('-r', '--render',
parser.set_defaults(scalar = [],
vector = [],
color = [],
inplace = False,
render = False,
)
@ -147,7 +152,7 @@ for name in filenames:
writer = vtk.vtkXMLRectilinearGridWriter()
writer.SetDataModeToBinary()
writer.SetCompressorTypeToZLib()
writer.SetFileName(os.path.splitext(options.vtk)[0]+'_added.vtr')
writer.SetFileName(os.path.splitext(options.vtk)[0]+('' if options.inplace else '_added.vtr'))
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(rGrid)
else: writer.SetInputData(rGrid)
writer.Write()