Skip to content
Advertisement

Plot Over Line with pvpython

Good afternoon, I am trying to use the filter “Plot Over Line” of Paraview in a Python script. Basically, I want to:

  • Open the file “.vtu”;
  • Use the filter PlotOverLine for the velocity;
  • Save the data in a “.csv” file.

On internet, I found a possible way to do this, but it gives error if ran with pvpython (even if using the word “simple” before the commands):

JavaScript

Advertisement

Answer

First, you may report here you errors.

As you suggest, your script cannot work as is, you should change the import to from paraview.simple import *.

Also, your writer does not have explicit input. I recommend to use CreateWriter(filename='path', input=myInput), or, for a one shot write, SaveData(filename='path', input=myInput).

Finally, one way to produce such scripts is to use Tools / Start Trace menu option (with the default config). Then perform actions in the interface. Finally Tools / Stop Trace give you the python script corresponding to your actions.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement