Reset camera to closest in saving animation

I want ParaView to reset camera closest every time it moves from one file to the other in a time series while saving an animation. This is because the underlying mesh moves in my simulation with time. How can I achieve this? Without this, the data is moving out of the visualization window after a few time steps.

Hi @dutta-alankar

In the time manager you can add a “Python” animation track, and call ResetCamera on each timestep.

The problem is ResetCamera() isn’t giving the proper zoom on the data. Instead, using reset camera closest button does this job. However, using trace, I cannot seem to find the python command equivalent to pressing this button. Trace only gives values specific to any particular snapshot. So I’m unable to do this programmatically on all snapshots.

Here is what you need:

GetActiveView().ResetCamera(True, 0.9)

In the time manager, you can add a track Camera, Follow Data. This will move the camera with the data as it changes. That might also help.

2 Likes

This is exactly what I was looking for. Thanks a lot!

Hi, I am facing a similar problem and found this question. I noticed that ResetCamera does not take any arguments other than optional View=None (https://www.paraview.org/paraview-docs/nightly/python/paraview.simple.html?highlight=resetcamera#paraview.simple.ResetCamera) yet you provide a working example with True and a number. What do these do and where can I find that information?
Thanks in advance!

This doc is for simple.ResetCamera, the example above is for view.ResetCamera: https://www.paraview.org/paraview-docs/nightly/cxx/classvtkSMRenderViewProxy.html#a00783354439d13230c905f9a25688e2b

Which is a C++ API automatically wrapped in python

1 Like

Thank you for your fast reply, that makes sense!