Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tom Fischer
smallscripts
Commits
70b33a1f
Commit
70b33a1f
authored
Sep 15, 2022
by
Tom Fischer
Browse files
Script rename vtu point data array
parent
c4fa5804
Changes
1
Hide whitespace changes
Inline
Side-by-side
renamePointDataArray.py
0 → 100755
View file @
70b33a1f
#!/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
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment