<font color="#000000"><font face="arial,helvetica,sans-serif">Dear all,</font></font><div><font color="#000000"><font face="arial,helvetica,sans-serif">I am currently able to visualize correctly in ParaView a .vtp file for each time step of a simulation, and to print a screenshot for each. I want to do that in batch, but I want to keep the same state for each one (view point, filters applied, etc). I Have already saved the state into a .psvm file , and I tried to write a python script which, after being run by pvbatch, will (hopefully) print the screenshots. But, unfortunately, it is not working. I tried to change the filename in the state by processing search and replace, but still is not working. For instance, it keeps working on the first data input only. I use ParaView 3.14.0 in Snow Leopard. The reader stuff (commented) is giving me errors. I am sure this is easy, but I am overwhelmed with the large amount of info about python and paraview with no reference to this issue. Please, please, any advice is greatly welcome, and I am sorry if this has been answered previously (I looked at google and the mailing list). Below is my script, which can also be found at </font></font><font face="arial, helvetica, sans-serif"><a href="http://pastebin.com/UkDAcnHE">http://pastebin.com/UkDAcnHE</a> .</font></div>
<div><font color="#000000"><font face="arial,helvetica,sans-serif"><br></font></font></div><div><font color="#000000"><font face="arial,helvetica,sans-serif"><div>#!/bin/python</div><div>import glob, string, os, commands</div>
<div>from paraview.simple import *</div><div><br></div><div>#help(servermanager)</div><div># vtp files are inside the local subdir DISPLAY</div><div>files = (commands.getoutput("ls DISPLAY/data-*.vtp | grep -v contacts")).split()</div>
<div><br></div><div># process each file</div><div>for filename in files:</div><div> fullfn = commands.getoutput("ls $PWD/" + filename).replace('/','\/')</div><div> fn = filename.replace('DISPLAY/', '')</div>
<div> #os.system("cp ../dem_git/addons/paraview_state.pvsm tmp.pvsm")</div><div> os.system("cp ~/Desktop/state.pvsm tmp.pvsm")</div><div> os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") # replace first intance with full path</div>
<div> os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") # replace second intance with full path</div><div> os.system("sed -i.bck 's/DATA.vtp/" + fn + "/1' tmp.pvsm") # replace third with just the filename path</div>
<div> servermanager.LoadState("tmp.pvsm")</div><div> pm = servermanager.ProxyManager()</div><div> #reader = pm.GetProxy("sources",fullfn)</div><div> #reader.FileNames = fullfn</div><div> #reader.FileNameChanged()</div>
<div> #reader.UpdatePipeline()</div><div> SetActiveView(GetRenderView())</div><div> Render()</div><div> WriteImage(fn + "-image.png")</div><div> os.system("rm -f tmp.pvsm")</div><div> #servermanager.Finalize()</div>
<div><br></div></font></font></div><div><font color="#000000"><font face="arial,helvetica,sans-serif"> </font></font><span style="font-family:arial,helvetica,sans-serif"> </span></div><div><br style="font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif">Best regards / Cordialmente,</span><br style="font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif"><br></span><div><span style="font-family:arial,helvetica,sans-serif">William-Fernando Oquendo</span><div>
<div style="font-family:arial,helvetica,sans-serif">--------------------------</div><div style="font-family:arial,helvetica,sans-serif">Este correo puede carecer de tildes o eñes debido al teclado. </div><div style="font-family:arial,helvetica,sans-serif">
<br></div></div></div><br>
</div>