# Reset camera to closest in saving animation

**URL:** https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823
**Category:** ParaView Support
**Created:** [June 11, 2024, 6:01am UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823 "2024-06-11T06:01:18Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![dutta-alankar](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dutta-alankar/32/13310_2.png) [@dutta-alankar](https://discourse.paraview.org/u/dutta-alankar)
#### Post date: [June 11, 2024, 6:01am UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/1 "2024-06-11T06:01:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 11, 2024, 7:20am UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/2 "2024-06-11T07:20:00Z")

</div>

Hi @dutta-alankar

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

---

<div class="post-metadata">

### Author: ![dutta-alankar](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dutta-alankar/32/13310_2.png) [@dutta-alankar](https://discourse.paraview.org/u/dutta-alankar)
#### Post date: [June 11, 2024, 12:08pm UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/3 "2024-06-11T12:08:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 11, 2024, 12:23pm UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/4 "2024-06-11T12:23:26Z")

</div>

Here is what you need:

`GetActiveView().ResetCamera(True, 0.9)`

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [June 11, 2024, 2:06pm UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/5 "2024-06-11T14:06:42Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dutta-alankar](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dutta-alankar/32/13310_2.png) [@dutta-alankar](https://discourse.paraview.org/u/dutta-alankar)
#### Post date: [June 12, 2024, 8:44am UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/7 "2024-06-12T08:44:15Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Luukv8x](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/d78d45/32.png) [@Luukv8x](https://discourse.paraview.org/u/Luukv8x)
#### Post date: [November 25, 2024, 8:23am UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/8 "2024-11-25T08:23:30Z")

</div>

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](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!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 25, 2024, 8:38am UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/9 "2024-11-25T08:38:58Z")

</div>

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

Which is a C++ API automatically wrapped in python

---

<div class="post-metadata">

### Author: ![Luukv8x](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/d78d45/32.png) [@Luukv8x](https://discourse.paraview.org/u/Luukv8x)
#### Post date: [November 25, 2024, 8:43am UTC](https://discourse.paraview.org/t/reset-camera-to-closest-in-saving-animation/14823/10 "2024-11-25T08:43:29Z")

</div>

Thank you for your fast reply, that makes sense!
