[Paraview] pvbatch: Manipulate file list of loaded state file

Fabian Braennstroem f.braennstroem at gmx.de
Mon Oct 4 11:15:56 EDT 2010


Hello Karl,

I wonder, if you had success with your approach!? Actually, I would like 
to do similar with these lines:

from paraview.simple import *
servermanager.LoadState("/home/gcae504/Dissertation/3D_Nielsen/OpenFoam/01_SAS_SSTF_URANS/01__56T_SST/STREAM_SLICE0.pvsm")
SetActiveView(GetRenderView())
Render()
sources=GetSources()
print "Sources: ", sources
FindSource("Slice1").SliceType.Origin = [5.0, 1.0, 1.0]
print FindSource("Slice1").SliceType.Origin
Render()

For the first test, I would like to change the Slice origin.
Unfortunately, the script gives me a segmentation fault using the 
Python-Shell from within paraview and using pvpython it simply gives a 
black picture.
I do not use the python trace state option as there are some settings 
missing and the above approach would fit better into my daily working 
style.

Would be nice, if you have a suggestion how to do this and how to change 
the source file name!?

Thanks in advance!
Fabian

On 10/13/2009 12:52 AM, Moreland, Kenneth wrote:
> Hopefully someone will have answered your question by the time I get off
> this airplane and sync my email so that this message gets sent, but
> allow me to suggest an alternative method. I recommend you try the new
> Python tracing as an alternative. To do this, turn on Python tracing
> (currently attached to the Python shell, but should move soon), load the
> file, set up the pipeline and any other desired state, and then save the
> state. Load the resulting Python shell in your favorite editor and
> change it to load the files you really want.
>
> This use case of loading state files is really just a workaround to the
> fact that you could not directly output a Python script from ParaView.
> Now that you can automatically create scripts from within ParaView,
> loading state files from scripts is (mostly) obsolete.
>
> -Ken
>
>
> On 10/11/09 1:55 PM, "Karl König" <kkoenig11 at web.de> wrote:
>
>     Hi,
>
>     I've been trying to no avail for many hours now to do something that
>     sounds quite simple to do, but seems to be not yet documented in the PV
>     wiki, the tutorials, PV presentation slides nor the mailing list.
>     I hope someone can give me a hint what I'm doing wrong.
>
>     The thing I'm trying to do is a variant of what Kent posted 1,5 year ago
>     about and Utkarsh gave advice on
>     (http://www.paraview.org/pipermail/paraview/2008-February/007134.html):
>
>     1) Load a single file from a file series, not a file series, create a
>     pipeline and save a state file.
>
>     2) Let pvbatch load the state file, swap the file for a file list
>     (determined via glob, see e.g. page 7 of
>     http://www.cscs.ch/fileadmin/user_upload/customers/users_entry_point/HORUS_Doc/PvPython.pdf)
>     and iterate over all files
>
>     I've successfully loaded the state file and manipulated the source
>     proxy's FileName property, extracted the scene object by means of
>     servermanager.ProxyManager, updated the animation scene's TimeKeeper
>     object and then repeatedly called scene.GoToNext(). But the new file
>     list got not respected, still only the file mentioned in the state file
>     gets loaded.
>
>     I've also tried to create a new reader instance with the file list as
>     argument, looped over all source proxies within the state file and
>     changed their Input property in case that were a reader. Then, created a
>     new animation scene in the same way as AnimateReader does it in
>     Utilities/VTKPythonWrapping/paraview/servermanager.py and tried again to
>     loop over all files. Still not working.
>     Saving the state file from pvbatch and loading it into ParaView
>     confirmed that I'm missing something as ParaView spits out quite some
>     error messages for those objects I swapped the input for:
>     "Input port 0 of algorithm vtkExtractBlock has 0 connections but is not
>     optional."
>
>     Is there someone who accomplished loading a state file and manipulating
>     the reader's file list and is willing to share his knowledge?
>
>     Thanks a lot
>     Karl
>
>
>     N.B.:
>     If there is a solution to this problem, it could also pose an
>     approximate alternative solution for those looking for support for live
>     data in PV, an issue discussed just recently here: By means of a timer,
>     file size or file inspection it would be easy enough to have Python
>     ensure the validity of an input fill, then re-execute the pipeline for
>     the new file, create a snapshot automatically and wait for the next file
>     to appear.
>     _______________________________________________
>     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
>
>
>
>
> **** Kenneth Moreland
> *** Sandia National Laboratories
> ***********
> *** *** *** email: kmorel at sandia.gov
> ** *** ** phone: (505) 844-8919
> *** web: http://www.cs.unm.edu/~kmorel
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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