[Paraview] [Update] [Example files] To create a snapshot from a given datafile and state, how to change the datafile filename of the state?

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon May 28 09:18:52 EDT 2012


See if this helps: http://www.paraview.org/Wiki/ParaView_And_Mesa_3D

Utkarsh

On Mon, May 28, 2012 at 8:14 AM, William Oquendo <woquendo at gmail.com> wrote:
> 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.
>
> Best regards / Cordialmente,
>
> William-Fernando Oquendo
> --------------------------
> Este correo puede carecer de tildes o eñes debido al teclado.
>
>
>
>
> On Tue, Apr 24, 2012 at 10:37 AM, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com> wrote:
>>
>> I wouldn't go about loading the state again and again merely to change
>> the filename, instead change the filename directly on the reader
>> proxy.
>>
>> Use GetSources() to get a map of all the sources in the state. Looking
>> at the names, you should be able to figure out what's the reader
>> proxy. Then you can change the FileName on it.
>>
>> Utkarsh
>>
>> On Sat, Apr 21, 2012 at 5:07 PM, William Oquendo <woquendo at gmail.com>
>> wrote:
>> > In the following link you can find two examples of vtp file and the
>> > model
>> > state file. Thanks.
>> > http://goo.gl/XjPpE
>> >
>> >
>> > Best regards / Cordialmente,
>> >
>> > William-Fernando Oquendo
>> > --------------------------
>> > Este correo puede carecer de tildes o eñes debido al teclado.
>> >
>> >
>> >
>> >
>> > On Sat, Apr 21, 2012 at 4:03 PM, William Oquendo <woquendo at gmail.com>
>> > wrote:
>> >>
>> >> Dear all,
>> >> 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 http://pastebin.com/UkDAcnHE .
>> >>
>> >> #!/bin/python
>> >> import glob, string, os, commands
>> >> from paraview.simple import *
>> >>
>> >> #help(servermanager)
>> >> # vtp files are inside the local subdir DISPLAY
>> >> files = (commands.getoutput("ls DISPLAY/data-*.vtp | grep -v
>> >> contacts")).split()
>> >>
>> >> # process each file
>> >> for filename in files:
>> >>     fullfn = commands.getoutput("ls $PWD/" +
>> >> filename).replace('/','\/')
>> >>     fn = filename.replace('DISPLAY/', '')
>> >>     #os.system("cp ../dem_git/addons/paraview_state.pvsm tmp.pvsm")
>> >>     os.system("cp ~/Desktop/state.pvsm tmp.pvsm")
>> >>     os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") #
>> >> replace first intance with full path
>> >>     os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") #
>> >> replace second intance with full path
>> >>     os.system("sed -i.bck 's/DATA.vtp/" + fn + "/1' tmp.pvsm") #
>> >> replace
>> >> third with just the filename path
>> >>     servermanager.LoadState("tmp.pvsm")
>> >>     pm = servermanager.ProxyManager()
>> >>     #reader = pm.GetProxy("sources",fullfn)
>> >>     #reader.FileNames = fullfn
>> >>     #reader.FileNameChanged()
>> >>     #reader.UpdatePipeline()
>> >>     SetActiveView(GetRenderView())
>> >>     Render()
>> >>     WriteImage(fn + "-image.png")
>> >>     os.system("rm -f tmp.pvsm")
>> >>     #servermanager.Finalize()
>> >>
>> >>
>> >>
>> >> Best regards / Cordialmente,
>> >>
>> >> William-Fernando Oquendo
>> >> --------------------------
>> >> Este correo puede carecer de tildes o eñes debido al teclado.
>> >>
>> >>
>> >
>> >
>> > _______________________________________________
>> > 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