[Paraview] Python - load state just like when using the GUI

Tim Gallagher tim.gallagher at gatech.edu
Thu Aug 25 14:31:08 EDT 2011


Thanks!

Would it be also possible to get it setup so we can override the files in the state file upon loading, just as is done with the GUI? I was going to try and implement this myself, but after spending 6 hours trying to track through the code to figure out how it works, I'm stumped. My first adventure into VTK and Paraview guts didn't go so well...

For that to work, I guess there would need to be an extra step in the process. First would be to load the state file but not execute anything. Then modify the XML tree as desired, then update the pipeline. 

The most flexible way to do it (because it would allow changes to things other than filenames) is to have a dictionary you can specify the id and the value. For instance:

{'278.FileName': 'MyFile', '278.CellArrayStatus.array_list':['Pressure','Temperature']}

etc.. That would have to be passed through a function since I assume we can't expose the actual information directly to the user since it resides on the server and not the client. 

Has anybody thought about this recently? I saw it had been discussed and given up on a year ago... I will keep trying to figure out how the code works in my spare time, but it will probably be a long time before I figure it out.

Tim

----- Original Message -----
From: "Utkarsh Ayachit" <utkarsh.ayachit at kitware.com>
To: gtg085x at mail.gatech.edu
Cc: "ParaView list" <paraview at paraview.org>
Sent: Thursday, August 25, 2011 9:25:55 AM
Subject: Re: [Paraview] Python - load state just like when using the GUI

Here's the bug report, FYI: http://paraview.org/Bug/view.php?id=12549

On Thu, Aug 25, 2011 at 9:21 AM, Utkarsh Ayachit
<utkarsh.ayachit at kitware.com> wrote:
> Good catch. That's actually a bug in the simply.py module. I'm
> committing a fix, it will be included in the upcoming 3.12 release.
>
> Utkarsh
>
> On Wed, Aug 24, 2011 at 11:56 PM, Tim Gallagher
> <tim.gallagher at gatech.edu> wrote:
>> Hi all,
>>
>> So I did some more digging. It turns out the instructions on the wiki at:
>>
>> http://www.vtk.org/Wiki/ParaView/Python_Scripting#Loading_State_and_Manipulating_It
>>
>> is wrong. If you follow those steps, you just get a black image with nothing in it. However, I found a presentation at:
>>
>> http://www.vgtc.org/PDF/slides/2008/visweek/tutorial6_ayachit_python.pdf
>>
>> with the correct steps. To load the state file correctly, one must do:
>>
>> from paraview.simple import *
>> servermanager.LoadState(filename)
>> view = servermanager.GetRenderView()
>> view.StillRender()
>>
>> I've requested an account on the wiki so I can make the change to the page (assuming as a new user I can... if not, can somebody update the information?)
>>
>> Tim
>>
>> ----- Original Message -----
>> From: "Tim Gallagher" <tim.gallagher at gatech.edu>
>> To: "ParaView list" <paraview at paraview.org>
>> Sent: Wednesday, August 17, 2011 11:48:54 PM
>> Subject: Re: [Paraview] Python - load state just like when using the GUI
>>
>> We actually just tried to do the same thing for the first time yesterday and had the same issues... so if anybody has an answer, we'd like it too!
>>
>> Is it just a matter of accessing some kind of data pulled in from the state file and doing a Show() or something? I got the data to appear that way (SelectActiveSource(); Show()), but the views aren't right.
>>
>> Tim
>>
>> ----- Original Message -----
>> From: "Villads Egede" <s052397 at student.dtu.dk>
>> To: paraview at paraview.org
>> Sent: Wednesday, August 17, 2011 4:11:40 PM
>> Subject: [Paraview] Python - load state just like when using the GUI
>>
>> Hi,
>>
>>
>> I'm fairly new to Paraview but am trying to get a hang on it.
>>
>> My problem is that I need to make some animations by loading different
>> datasets rendered the same way. After having looked at the state file
>> (pvsm) one can save in the GUI I thought it would be piece of cake to
>> open these ones via a Python script and then save a screenshot from
>> there (thus being able to replace the path to the dataset and then being
>> able to create the animation), but when I do that, all the view settings
>> are not loaded in contrast to when I do it through the GUI. Is there a
>> way to "execute" the settings from the state?
>>
>>
>> Best regards
>> Villads Egede, Denmark
>>
>> _______________________________________________
>> 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
>> _______________________________________________
>> 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
>> _______________________________________________
>> 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