<font color="#000000"><font face="arial,helvetica,sans-serif">Thanks a lot for your answer. I will use your suggestion. Unfortunately, I am know facing the problem of getting those screenshots remotely, without X server, and I have not been able to compile paraview with offscreen support. When I finally got it, I will return to the script. Thanks again.<br clear="all">
</font></font><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>
<br><br><div class="gmail_quote">On Tue, Apr 24, 2012 at 10:37 AM, Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I wouldn't go about loading the state again and again merely to change<br>
the filename, instead change the filename directly on the reader<br>
proxy.<br>
<br>
Use GetSources() to get a map of all the sources in the state. Looking<br>
at the names, you should be able to figure out what's the reader<br>
proxy. Then you can change the FileName on it.<br>
<br>
Utkarsh<br>
<div><div><br>
On Sat, Apr 21, 2012 at 5:07 PM, William Oquendo <<a href="mailto:woquendo@gmail.com" target="_blank">woquendo@gmail.com</a>> wrote:<br>
> In the following link you can find two examples of vtp file and the model<br>
> state file. Thanks.<br>
> <a href="http://goo.gl/XjPpE" target="_blank">http://goo.gl/XjPpE</a><br>
><br>
><br>
> Best regards / Cordialmente,<br>
><br>
> William-Fernando Oquendo<br>
> --------------------------<br>
> Este correo puede carecer de tildes o eñes debido al teclado.<br>
><br>
><br>
><br>
><br>
> On Sat, Apr 21, 2012 at 4:03 PM, William Oquendo <<a href="mailto:woquendo@gmail.com" target="_blank">woquendo@gmail.com</a>> wrote:<br>
>><br>
>> Dear all,<br>
>> I am currently able to visualize correctly in ParaView a .vtp file for<br>
>> each time step of a simulation, and to print a screenshot for each. I want<br>
>> to do that in batch, but I want to keep the same state for each one (view<br>
>> point, filters applied, etc). I Have already saved the state into a .psvm<br>
>> file , and I tried to write a python script which, after being run by<br>
>> pvbatch, will (hopefully) print the screenshots. But, unfortunately, it is<br>
>> not working. I tried to change the filename in the state by processing<br>
>> search and replace, but still is not working. For instance, it keeps working<br>
>> on the first data input only. I use ParaView 3.14.0 in Snow Leopard. The<br>
>> reader stuff (commented) is giving me errors. I am sure this is easy, but I<br>
>> am overwhelmed with the large amount of info about python and paraview with<br>
>> no reference to this issue. Please, please, any advice is greatly welcome,<br>
>> and I am sorry if this has been answered previously (I looked at google and<br>
>> the mailing list). Below is my script, which can also be found<br>
>> at <a href="http://pastebin.com/UkDAcnHE" target="_blank">http://pastebin.com/UkDAcnHE</a> .<br>
>><br>
>> #!/bin/python<br>
>> import glob, string, os, commands<br>
>> from paraview.simple import *<br>
>><br>
>> #help(servermanager)<br>
>> # vtp files are inside the local subdir DISPLAY<br>
>> files = (commands.getoutput("ls DISPLAY/data-*.vtp | grep -v<br>
>> contacts")).split()<br>
>><br>
>> # process each file<br>
>> for filename in files:<br>
>> fullfn = commands.getoutput("ls $PWD/" + filename).replace('/','\/')<br>
>> fn = filename.replace('DISPLAY/', '')<br>
>> #os.system("cp ../dem_git/addons/paraview_state.pvsm tmp.pvsm")<br>
>> os.system("cp ~/Desktop/state.pvsm tmp.pvsm")<br>
>> os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") #<br>
>> replace first intance with full path<br>
>> os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") #<br>
>> replace second intance with full path<br>
>> os.system("sed -i.bck 's/DATA.vtp/" + fn + "/1' tmp.pvsm") # replace<br>
>> third with just the filename path<br>
>> servermanager.LoadState("tmp.pvsm")<br>
>> pm = servermanager.ProxyManager()<br>
>> #reader = pm.GetProxy("sources",fullfn)<br>
>> #reader.FileNames = fullfn<br>
>> #reader.FileNameChanged()<br>
>> #reader.UpdatePipeline()<br>
>> SetActiveView(GetRenderView())<br>
>> Render()<br>
>> WriteImage(fn + "-image.png")<br>
>> os.system("rm -f tmp.pvsm")<br>
>> #servermanager.Finalize()<br>
>><br>
>><br>
>><br>
>> Best regards / Cordialmente,<br>
>><br>
>> William-Fernando Oquendo<br>
>> --------------------------<br>
>> Este correo puede carecer de tildes o eñes debido al teclado.<br>
>><br>
>><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the ParaView Wiki at:<br>
> <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
><br>
</blockquote></div><br>