I'm aware that you can add readers for different datafile types to paraview, however, that all talks about doing a bunch of VTK stuff in c++ and (maybe worse) re-compiling paraview to make it aware of your datafile format. On the other hand, paraview also supports scripting in python. Maybe it is my lack of familiarity with VTK, but, to me it looks like I can only manipulate VTK objects from pvpython. Is there any way to dynamically add a reader to paraview using pvpython?
Add a datafile type reader to paraview using pvpython
What you want is a "Python Programmable Filter. Refer to ParaView Wiki. This wiki page shows how to write a CSV reader in Python.
As time has passed, ParaView has new options to achieve this.
It's worth looking at the recently added Python Algorithm feature in ParaView.
Examples are given in the source code.
© 2022 - 2024 — McMap. All rights reserved.