[Paraview] pvbatch, Render, WriteImage

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Jan 16 15:53:22 EST 2013


Try calling the following at the start of the script:

from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

Utkarsh

On Tue, Jan 15, 2013 at 4:57 PM, Glockner Stéphane
<Stephane.Glockner at enscbp.fr> wrote:
> 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
>
> _______________________________________________
> 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