[Paraview] scripting beginner

Hartwig Anzt hartwig.anzt at kit.edu
Sat Feb 19 09:15:35 EST 2011


Hi!

I am real beginner in paraview scripting. Up to now, I used the paraview 
graphic platform, but since the tasks are getting more complex, I wanted 
to use paraview scripting with python.... and failed.

What I want to do:
- Load .vts-data
- Create Contour
- Set Data Range
- Save State/Save Picture

I wrote the following script:

 >from paraview.simple import *
 >
 >reader = OpenDataFile(PATH+'lfff00300000p_QC.vts')
 >contourFilter = Contour(reader)
 >contourFilter.ContourBy = 'velocity'
 >contourFilter.Isosurfaces = [0.0005, 0.001]
 >Show(contourFilter)
 >ResetCamera()
 >WriteImage('picture.png')
 >servermanager.SaveState('pythonstate.pvsm')


If I run the script, two errors occur, probably with the same reason.
The writer says:
vtkSMRenderViewProxy (0x1e6da30): Disabling offscreen rendering since 
empty image was detected.

When I open the state, there is nothing displayed. in order to see 
anything, I do have to press "Apply" for the Contour filter and "Reset" 
for the Camera, then everything looks fine.

How can I implement, that these two operations are conducted?

Thanks, Hartwig

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Karlsruhe Institute of Technology (KIT)
Engineering Mathematics and Computing Lab (EMCL) &
Institute for Applied and Numerical Mathematics 4

Dipl.-Math. techn. Hartwig Anzt
Research Associate

Fritz-Erler-Str. 23, Geb. 01.86
76133 Karlsruhe, Germany

Phone: +49 721 / 608 - 45849
Email: hartwig.anzt at kit.edu
Web:   http://numhpc.math.kit.edu, http://emcl.kit.edu, 

KIT - University of the State of Baden-Wuerttemberg and
National Laboratory of the Helmholtz Association



More information about the ParaView mailing list