Renderviews in pvbatch animation script

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), 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

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

This should work

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

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.

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

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.]

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

1 Like