Change the time variables in pvpython


So far I have managed to use the GUI to produce an animation successfully. As I want to automated this process, I have used the tracer to generate a python script, but it doesn’t capture the time information.

The setup is quite simple, the only variable that changes is the time, i.e. ramp up to 30 seconds, step another 10s and then ramp up until the end. As the tracer doesn’t seem to be capturing this can anyone else suggest the correct python commands? I have seen a few examples of keyframes and such, but they don’t seem to help.


Here is a generic example. you are looking for view.ViewTime.

from paraview.simple import *

reader = ExodusIIReader(FileName="can.ex2")
view = GetActiveView()

cam = GetActiveCamera()

for cur_time in reader.TimestepValues[:]:
  view.ViewTime = cur_time

Thank you for your reply.

This is essentially what I am after replicating. I am trying to introduce a 10 second pause into a series of time steps. I essentially have a moving source that stops at a detector. There is no need to model the detector stopped at this location, rather just pause the animation for the duration and then continue. When the animation is saved you get this pause. I just can’t figure out how to do this without the need of the GUI.

Kind Regards,


time.sleep(10) ?

Thanks for your reply, but I think I’ve figured out how to do it as you suggested but by creating my own time line and setting the viewtime equal to that. Then by saving the screenshots instead of saving an animation I can generation an animation externally. As long as it works, it can all be automated. Thanks for your help

Indeed ! Do not use SaveAnimation !