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

Oliver Borm oli.borm at web.de
Mon Jan 11 15:54:17 EST 2010


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




More information about the ParaView mailing list