[Paraview] Saving screen shots of multiple views from an animation with python

Berk Geveci berk.geveci at kitware.com
Tue Jan 12 07:10:06 EST 2010


Utkarsh would know this best but I think you have at lease two choices:

* Run the animation multiple times, one for each view. I am guessing that there
is a way of setting which view is saved.
* Run the animation manually (still using the animation scene) and save the
views yourself.

On Mon, Jan 11, 2010 at 3:54 PM, Oliver Borm <oli.borm at web.de> wrote:
> Hello,
>
> is it possible to save the screen shots of multiple views from an
> animation in different images with python? In the GUI this is possible,
> when two views are open. But the two views are saved within one image,
> which is not really optimal for further post-processing. I've tried to
> do the same within python, but I only can render the two views in two
> windows. When I try to save the views, just the last view is saved. Does
> anybody know, how to fix this? Here is my test script, with the input
> from (
> http://public.kitware.com/Bug/file_download.php?file_id=2755&type=bug ) :
>
> from paraview.simple import *
>
> casefilename = "phaselag_rotor2.pvd"
> reader = servermanager.sources.PVDReader(FileName=casefilename)
>
> trans = Transform(Input=reader)
> trans.Transform.Rotate = [0.0,0.0,90.0]
>
> view1 = CreateRenderView()
> repn1 = servermanager.CreateRepresentation(reader, view1)
>
> view2 = CreateRenderView()
> repn2 = servermanager.CreateRepresentation(trans, view2)
>
> scene = servermanager.animation.AnimationScene()
> scene.TimeKeeper = servermanager.misc.TimeKeeper()
>
> scene.TimeKeeper.TimeSources.append(reader)
>
> scene.TimeKeeper.Views.append(view1)
> scene.TimeKeeper.Views.append(view2)
>
> # with 2 views
> scene.ViewModules = [view1, view2]
> # Update the reader to get the time information
> reader.UpdatePipelineInformation()
> # Animate from 1st time step to last
> scene.StartTime = reader.TimestepValues.GetData()[0]
> scene.EndTime = reader.TimestepValues.GetData()[-1]
>
> # Create a special animation cue for time.
> cue = servermanager.animation.TimeAnimationCue()
> cue.AnimatedProxy = scene.TimeKeeper
> cue.AnimatedPropertyName = "Time"
> scene.Cues = [cue]
>
> scene.PlayMode = 1 #RealTime
> ## play the animation in two windows
> scene.Play()
>
> # Each frame will correspond to a time step
> scene.PlayMode = 2 # Snap to time steps
> writer = servermanager.vtkSMAnimationSceneImageWriter()
> writer.SetFileName("fubar.png")
> writer.SetFrameRate(1)
> writer.SetAnimationScene(scene.SMProxy)
>
> ## save files of animation
> writer.Save()
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list