# Renderviews in pvbatch animation script

**URL:** https://discourse.paraview.org/t/renderviews-in-pvbatch-animation-script/4084
**Category:** ParaView Support
**Tags:** python
**Created:** [April 16, 2020, 2:51am UTC](https://discourse.paraview.org/t/renderviews-in-pvbatch-animation-script/4084 "2020-04-16T02:51:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![wsherman](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@wsherman](https://discourse.paraview.org/u/wsherman)
#### Post date: [April 16, 2020, 2:51am UTC](https://discourse.paraview.org/t/renderviews-in-pvbatch-animation-script/4084/1 "2020-04-16T02:51:22Z")

</div>

Hello all,

I have a couple of questions on interfacing with renderviews through the Python interface. I have a pvbatch script that I use to generate animation frames, and typically I’ve just had a single renderview in the statefile that I load. But presently I have a statefile with a layout containing two renderviews, and naturally, the “WriteAnimation()” command outputs a PNG file with both views shown.

In this case, I’d like to be able to write the animation with only a particular renderview in view.

So ideally, I wonder if there’s a way to either display a view, or to choose a particular view to write, while ignoring the other views.

Failing that, I can delete the undesired view(s), since after all once the batch process is over, I’m not saving the state back to the file. But if possible I’d like to be able do deactivate and reactive views – in case in a future project I want to render one view and then another as separate animations.

So that was question 1. Question 2 is: to enable me to select the view(s) to be deleted, I’d like to check the name of the view and keep only the view with the expected name (e.g. “AnimView”). So I know how to set the name of a view (both in GUI and in Python – RenameView(‘AnimView’, mainView)). But for the life of me, I can’t figure out how to check the name of the views returned by:  
` >>> servermanager.GetRenderViews()`

And I’ve Googled and Googled and Googled some more, looking through the code of “simple.py” ([https://kitware.github.io/paraview-docs/latest/python/\_modules/paraview/simple.html](https://kitware.github.io/paraview-docs/latest/python/_modules/paraview/simple.html)), and no luck. So I’m hoping someone here might know the answer off the top of their head (or near their fingers).

Thanks in advance,  
Bill

---

<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: [April 16, 2020, 2:55am UTC](https://discourse.paraview.org/t/renderviews-in-pvbatch-animation-script/4084/2 "2020-04-16T02:55:08Z")

</div>

```
SaveAnimation('/home/glow/tmp/a.png', layout1, SaveAllViews=0,
    ImageResolution=[1589, 692],
    FrameWindow=[0, 9])

```

This should work

---

<div class="post-metadata">

### Author: ![wsherman](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@wsherman](https://discourse.paraview.org/u/wsherman)
#### Post date: [April 16, 2020, 2:57am UTC](https://discourse.paraview.org/t/renderviews-in-pvbatch-animation-script/4084/3 "2020-04-16T02:57:11Z")

</div>

Wow, that was a fast answer Mathieu!

A followup if I might: what’s the difference between SaveAnimation and WriteAnimation? Is there something I should watch for when changing from one to the other?

And two, might you also know how to programatically inquire about the name of a view?

Thanks!  
Bill

---

<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: [April 16, 2020, 3:04am UTC](https://discourse.paraview.org/t/renderviews-in-pvbatch-animation-script/4084/4 "2020-04-16T03:04:25Z")

</div>

```
def WriteAnimation(filename, **params):
    """  
    ::deprecated:: 5.3
    Use :func:`SaveAnimation` instead.

```

You should use SaveAnimation.

```
pxm = servermanager.ProxyManager()
pxm.GetProxyName(view.SMProxy.GetXMLGroup(), view)

```

Not very user-friendly, we may want to improve that.

---

<div class="post-metadata">

### Author: ![wsherman](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@wsherman](https://discourse.paraview.org/u/wsherman)
#### Post date: [April 16, 2020, 3:12am UTC](https://discourse.paraview.org/t/renderviews-in-pvbatch-animation-script/4084/5 "2020-04-16T03:12:42Z")

</div>

Once again, thanks for the quick and extremely informative reply!

> [@mwestphal](#):
>
> ```auto
> def WriteAnimation(filename, **params):
> """  
> ::deprecated:: 5.3
> Use :func:`SaveAnimation` instead.
> 
> ```
> 
> You should use SaveAnimation.

Okay, good to know. Incidentally, I just checked, and I’m not getting the deprecated message, and I’m using the final release of 5.8.0. But I’m happy to update. [Edit: oh I see, that’s not an output string, just in the comments.]

> [@mwestphal](#):
>
> ```auto
> pxm = servermanager.ProxyManager()
> pxm.GetProxyName(view.SMProxy.GetXMLGroup(), view)
> 
> ```

Excellent. just tested it, and it works! I did actually try the GetXMLGroup() method on a few objects, but not through the ProxyManager.

Thanks in the future,  
Bill
