Commit 70b33a1f authored by Tom Fischer's avatar Tom Fischer
Browse files

Script rename vtu point data array

parent c4fa5804
#!/usr/bin/env python39
from vtk import *
from sys import argv, exit
if len(argv) < 5:
print("Usage: " + argv[0] + " input_property_name output_property_name input.vtu output.vtu")
exit(1)
input_file = argv[3]
output_file = argv[4]
print("Reading from", input_file)
print("Writing to", output_file)
r = vtkXMLUnstructuredGridReader()
r.SetFileName(input_file)
r.Update()
m = r.GetOutput()
point_data = m.GetPointData()
point_data_array = point_data.GetArray(argv[1])
point_data_array.SetName(argv[2])
w = vtkXMLUnstructuredGridWriter()
w.SetFileName(output_file)
w.SetInputData(m)
w.SetDataModeToAscii()
w.SetCompressorTypeToNone()
w.Update()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment