[Paraview] Paraview python - loop to run through multiple files

Rebekah L lapham1996 at gmail.com
Fri Jul 7 06:51:20 EDT 2017


Hey :)
I'm trying to script some code so that I can load a file in and then
WriteImage and then I want this to loop through multiple files so I don't
have to change the code each time for the new path. My problem is that
paraview won't recognise a path unless it is the exact path, so I can't get
it to change automatically. Any help would be greatly appreciated. Here is
my current code:

sso2_load_python
from paraview.simple import *
fname = '/home/sophy/Desktop'
#I put the files on the desktop so the path was shorter
filenames = ["c1", "c2"]
for x in filenames:
             Loadstate("/home/sophy/Desktop/x.pvsm")
      WriteImage("/home/sophy/Desktop/image.png")

#the previous two lines have the four space indent but my phone won't let
me type it like that



Thanks - Rebekah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170707/81bd3db9/attachment.html>


More information about the ParaView mailing list