[Paraview] help with a simple script?

Celia Bremer fuwsle at hotmail.com
Tue Nov 20 13:25:53 EST 2012



Seb,
Thank you. I'm still having problems. Here's what happens.
If I tack this code on to the end of my script (I didn't make it a function, so just the last 3 lines with the proper indentation), Paraview crashes once it gets to the code. An OpenGL window pops up and nothing's there (it's black), and then Windows says "paraview.exe stopped working".
In the shell - well, I don't actually get to that point in the shell because I can't get to the first (or second, etc) layout in the array from GetLayouts() this way.
>>> paraview version 3.14.1, Date: 2012-02-17
from paraview.simple import *
>>> servermanager.LoadState("empty.pvsm")
>>> layouts=GetLayouts()
>>> print layouts
{('ViewLayout1', '2178'): , ('ViewLayout1', '275'): }
>>> layout=layouts[0]
Traceback (most recent call last):
File "", line 1, in
KeyError: 0
So I thought maybe it should be GetLayouts.Values() since that can be indexed (I tried it in the shell). I changed the script to read "for layout in GetLayouts().values():". PV didn't crash but I got "TypeError: 'ViewLayout' object does not support indexing". This has to do with the arguments to UnRegisterProxy() - but I don't know what to do next because I don't know how to read the documentation at this point. (And I don't know what to google, so if anyone has suggestions...?) E.g. it says the syntax is UnRegisterProxy(self, groupname, proxyname, aProxy), but there are only 3 arguments here - pxm.UnRegisterProxy("layouts", layout[0], GetLayouts()[layout]). I also tried Delete(layout) but I got unregistration error.
Celia
________________________________
> Date: Mon, 19 Nov 2012 13:37:28 -0500
> Subject: Re: [Paraview] help with a simple script?
> From: sebastien.jourdain at kitware.com
> To: fuwsle at hotmail.com
> CC: dave.demarle at kitware.com; paraview at paraview.org
>
> Hi Celia,
>
> I think you found a bug, but I think I have something for you.
> The following method should clear the view/layouts.
>
> Seb
>
> $ def clearLayout():
> ... pxm = servermanager.ProxyManager()
>
> ... for layout in GetLayouts():
>
> ... pxm.UnRegisterProxy("layouts", layout[0], GetLayouts()[layout])
>
>
>
> On Fri, Nov 16, 2012 at 2:28 PM, Celia Bremer
> wrote:
>
> Seb,
>
> When I say that the OpenGL window freezes, I mean the window is
> unresponsive in that I can't minimize it, and Windows task manager says
> "Not Responding". There's nothing in the window except for the purple
> background, even when there should be something, e.g. if I did Show(o)
> before calling Render(), where o is one of the pipeline objects.
>
> The thing I called layout windows, and I suppose it's really called
> something else (view layouts?), happens when I run the script from the
> Python shell that comes with the GUI. I'm referring to the tabs,
> "Layout #1", "Layout #2", etc. Here:
>
>>>> paraview version 3.14.1, Date: 2012-02-17
> from paraview.simple import *
>>>> GetLayouts()
> {('ViewLayout1', '275'): 0x0000000010FB4748>}
>>>> servermanager.LoadState("testpipeline.pvsm")
>>>> GetLayouts()
> {('ViewLayout1', '275'): 0x0000000010FB4748>, ('ViewLayout5', '2353'):
> }
>>>> servermanager.LoadState("testpipeline.pvsm")
>>>> GetLayouts()
> {('ViewLayout1', '275'): 0x0000000010FB4748>, ('ViewLayout5', '3972'):
> ,
> ('ViewLayout5', '2353'): 0x0000000010FB47B8>}
>
> This happens even if I use an empty state file, i.e. what I get when I
> open Paraview GUI, save state, save as empty.pvsm. If I load this state
> from the GUI, it opens in the original layout window, ViewLayout1,
> without any craziness. If I open it from the shell as above, the first
> tab splits into 2 views, the right view looks all weird (attached), a
> new tab opens and the state file is loaded into a second tab. If I load
> the state file again, then the second tab splits like the first (and if
> there was any content, it stays on the left hand side), a third tab
> opens, and the content shows up in the third tab. And so on. The names
> of these new tabs depend on the state file (above: 1 5 5, it might be 3
> 1 3 3, or if I use an empty state file, then it's 1 1 1 1), so I don't
> know what's the deal with that, but as long as I can close them before
> moving on to the next state file, I don't think it'll cause problems.
>
> Celia
>
> ________________________________
>> Date: Fri, 16 Nov 2012 13:40:36 -0500
>> Subject: Re: [Paraview] help with a simple script?
>> From: sebastien.jourdain at kitware.com
>> To: fuwsle at hotmail.com
>> CC: dave.demarle at kitware.com;
> paraview at paraview.org
>>
>> Hi Celia,
>>
>> I'm not sure to follow what you mean by "it freezes" and "new layout
> window".
>>
>> When you render something from Python, the window is not interactive,
>> so maybe that's what you call freeze. And you need to manually call
>> Render() to update its content.
>> Regarding the layout window, I don't really have a clue what that could be.
>>
>> So I let you explain a bit more.
>>
>> Thanks,
>>
>> Seb
>>
>>
>> On Fri, Nov 16, 2012 at 1:21 PM, Celia Bremer
>>
>>
> wrote:
>>
>> Thank you. That worked but I still have problems: as soon as the OpenGL
>> window opens to render, it freezes, even if all the objects are hidden.
>> I think I'll have to do it from the Python shell from PV instead. I
>> have just one more question.
>>
>> When I load a state using LoadState(), that automatically opens a new
>> layout window. If I open the same state file from the GUI, no new
>> window is opened, so I don't think it's a property stored in the state
>> file. If I'm going to loop through 60 state files, I imagine all these
>> windows would become a problem. How do I either close the window, or
>> prevent it from opening in the first place?
>>
>> Celia
>>
>> ----------------------------------------
>>> From:
> dave.demarle at kitware.com
>>> Date: Fri, 16 Nov 2012 10:52:45 -0500
>>> Subject: Re: [Paraview] help with a simple script?
>>> To:
> fuwsle at hotmail.com
>>> CC:
>>
> sebastien.jourdain at kitware.com;
>>
> paraview at paraview.org
>>>
>>>> from paraview import servermanager
>>>> from paraview.simple import *
>>>> servermanager.LoadState("test.pvsm")
>>>
>>> SetActiveView(GetRenderView()) #you are missing this
>>>
>>>> view = GetActiveView()
>>>> view.ViewTime
>>>>
>>
> 		 	   		  


More information about the ParaView mailing list