From 55b33e55976f5d9571c842720892ccab64a52514 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 2 Dec 2015 23:10:14 +0000 Subject: [PATCH] =?UTF-8?q?added=20option=20=E2=80=9Cinplace=E2=80=9D=20to?= =?UTF-8?q?=20directly=20modify=20VTK=20file=20instead=20of=20creating=20c?= =?UTF-8?q?opy=5Fadded.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- processing/post/vtk_addRectilinearGridData.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index fa02d2576..01b6427a3 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -38,6 +38,10 @@ parser.add_option('-c', '--color', dest = 'color', action = 'extend', metavar = '', 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()