[Paraview] pvbatch, Render, WriteImage

Glockner Stéphane Stephane.Glockner at enscbp.fr
Tue Jan 15 16:57:40 EST 2013


Hello,

I try to use paraview 3.98 (Linux 64b, binary package) in batch mode with pvbatch (or pvpython) to load a .pvsm file, render it and write a png image.

The problem is that the png image does not match the expected one. Rotation and zoom are not applied. In the render window, the image appears with only the zoom applied, and, quickly, zoom is  destroyed. The png image is created without zoom and rotation.

Here are command and file used :

>/work/soft/ParaView-3.98.0-Linux-64bit/bin/pvbatch test3.py
>cat test3.py
from paraview.simple import *

# Load the state
servermanager.LoadState("template2.pvsm")

# Make sure that the view in the state is the active one so we don't have to refer to it by name.
SetActiveView(GetRenderView())

# Now render and save.
Render()

#create image
WriteImage("image.png")



If I load template2.pvsm with paraview GUI everything is OK.



If I add

paraview.simple._DisableFirstRenderCameraReset()
before
servermanager.LoadState("template2.pvsm")

zoom is done but not rotation.



If I set camera parameter in the script file (info are coming from the pvsm file), zoom and rotation are done (but paraview.simple._DisableFirstRenderCameraReset() must be written to get zoom effect) :

from paraview.simple import *

# Load the state
paraview.simple._DisableFirstRenderCameraReset()
servermanager.LoadState("template2.pvsm")

# Make sure that the view in the state is the active one so we don't have to refer to it by name.
view=GetRenderView()
SetActiveView(view)

view.CameraPosition = [0.0959346567601405, 0.0701244153847553, 0.254296910247221]
view.CameraFocalPoint = [0.050000000745058, 0.0399999991059303, 0.00999999977648259]
view.CameraViewUp = [-0.0215432903915884, 0.992736514528741, -0.118364265555239]
view.CameraViewAngle = 30
view.CameraParallelScale = 0.0442643309695937
view.CameraParallelProjection = 1

# Now render and save.
Render()

#create image
WriteImage("image.png")


I suppose it should be much more simple to get the expected result. Is there anything wrong in the first python file ?
Thanks for your help
Regards
Stéphane



More information about the ParaView mailing list