[Paraview] ParaView Scripting

Stefano Charissis S.Charissis at victorchang.edu.au
Fri Mar 2 20:36:20 EST 2012


Thanks Sebastien.

I compiled from source and so I'll look in simple.py. 

When I open the VTU I can see that it has N arrays in there. If I try to create an animation, it only uses the first array. But, each array corresponds to a different timestep, so it should loop through them to animate correctly.
And so I'm trying to write some sort of python script which will either fix the VTU (eg. Add timestep data to the xml) or do the necessary sequence of actions to produce an animation involving all the arrays. 

Stefano
________________________________________
From: Sebastien Jourdain [sebastien.jourdain at kitware.com]
Sent: Friday, 2 March 2012 10:21 PM
To: Stefano Charissis
Cc: Deij, Menno; paraview at paraview.org
Subject: Re: [Paraview] ParaView Scripting

Hi Stefano,

the mapping between the c++ and the proxies in python are not straight
forward, basically there is some XML file that explicitly define that
property/method mapping but if you have the code you could look at the
file ParaView/src/Utilities/VTKPythonWrapping/paraview/simple.py,
then the rest is Proxy specific.

One more thing, I still don't understand what you try to do in
python... D you want to switch from one data array to another ? Or ?

Thanks,

Seb

On Fri, Mar 2, 2012 at 3:44 AM, Stefano Charissis
<S.Charissis at victorchang.edu.au> wrote:
> Hi Menno,
>
> Thanks for that info!
>
> Up to now I had looking at the C function headers and trying to guess the Python calls!
>
> Stefano
> ________________________________________
> From: Deij, Menno [M.Deij at marin.nl]
> Sent: Friday, 2 March 2012 6:14 PM
> To: Stefano Charissis
> Cc: paraview at paraview.org
> Subject: RE: [Paraview] ParaView Scripting
>
> Hi Stefano,
>
> In addition to the good suggestions by Sebastien, you can get more information for each Python object using the following approaches:
>
> Let's say your object is called 'obj'
>
> 1. Get help:
>
> help(obj)
>
> 2. You can list all its attributes (properties & functions) using:
>
> dir(obj)
>
> or, better readable
>
> for element in dir(obj):
>    print element
>
> 3. Then, if your object is a SourceProxy (maybe even if it's a Proxy, I'm not sure), you can list its properties like so:
>
> for p in obj.ListProperties():
>    print p, obj.GetProperty(p)
>
> 4. Lastly, in the help on an object you can sometimes see that not all documentation is provided and you are referred to a vtk* object. Download the source code from ParaView and view the type header file to see the full information.
>
> Good luck,
>
> Menno
>
>
>
>
> dr. ir. Menno A. Deij
> Software Engineer
> Maritime Simulation Group
> E mailto:M.Deij at marin.nl
> T +31 317 49 35 06
>
> MARIN
> 2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands
> T +31 317 49 39 11, F , I www.marin.nl
>
> -----Original Message-----
> From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org] On Behalf Of Stefano Charissis
> Sent: Friday, March 02, 2012 3:27 AM
> To: Sebastien Jourdain
> Cc: paraview at paraview.org
> Subject: Re: [Paraview] ParaView Scripting
>
> Hi Sebastien,
>
> Thank you for your recommendations.
> I have already been through all those resources and I was not able to extract very much useful information from them. The the 'trace' suggestion seems promising. I can't quite get it to do what I want, but I'm sure it'll prove useful in the future.
>
> This is what using the trace gave me:
> --------------------------------------------------------------------------------------------------------
> try: paraview.simple
> except: from paraview.simple import *
> paraview.simple._DisableFirstRenderCameraReset()
>
> a3dResults_vtu = XMLUnstructuredGridReader( FileName=['/home/stefano/workspace/TestSimulations/3dpropagation/output/vtk_output/3dResults.vtu'] )
> a3dResults_vtu.PointArrayStatus = ['V_000000', 'V_000001', 'V_000002', 'V_000003', 'V_000004', 'V_000005']
>
> # From here, I don't even know how to do what I want to do manually
> # At this point if I am in Paraview and I hit 'Animate' then it will animate V_00000 only. But, in fact, V_000000 is timestep 0 of V, V_000001 is timestep 1 of V, etc...
> # So I essentially want it to either interpret the arrays as such or output a series of vtu files which I can then hopefully open 'together' (output*.vtu) and animate that...?
> --------------------------------------------------------------------------------------------------------
>
>
> Also. I would still like to know where I can look up the functionality of, for example, paraview.simple, for the future.
>
> Stefano
>
> ________________________________________
> From: Sebastien Jourdain [sebastien.jourdain at kitware.com]
> Sent: Friday, 2 March 2012 12:03 PM
> To: Stefano Charissis
> Cc: paraview at paraview.org
> Subject: Re: [Paraview] ParaView Scripting
>
> Hi Stefano,
>
> you can give a look at http://paraview.org/Wiki/ParaView and more precisely on:
>
> http://paraview.org/Wiki/ParaView#Python_Scripting
> http://paraview.org/Wiki/ParaView/Python_Scripting
> http://paraview.org/Wiki/Python_GUI_Tools
>
> Hope this could give you more insight... The trace can help you
> convert UI interaction into script which can be manually tweaked for
> your custom purpose.
>
> Seb
>
> On Thu, Mar 1, 2012 at 7:09 PM, Stefano Charissis
> <S.Charissis at victorchang.edu.au> wrote:
>> Hi all,
>>
>> My group has just started using ParaView in an attempt to visualise the output of an open-source application we are using. The app outputs a single .vtu file which has multiple arrays, each representing the data at every time step of the simulation. I cannot animate this as it does not have any time information. I could not find the solution online and nor could I find any documentation for the python scripting. I tried that figuring that if I could seperate the vtu into multiple (ie. 0.vtu, 1.vtu, etc) then I could automatically produce animations.
>> Does anyone know how this can be achieved?
>>
>> And, more generally, how can one go about learning ParaView scripting? I don't mind what language I have to use, I just want a comprehensive guide and documentation. I tried buying the book, but it is out of stock.
>>
>> Thanks,
>> Stefano
>>
>> ______________________________________________________________________
>> The Victor Chang Cardiac Research Institute's Email is scanned by the MessageLabs Email Security System.
>> _______________________________________________
>> 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
>
> Scanned by Messagelabs ***
>
> ______________________________________________________________________
> The Victor Chang Cardiac Research Institute's Email is scanned by the MessageLabs Email Security System.
> _______________________________________________
> 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
>
> Scanned by Messagelabs ***
>
> ______________________________________________________________________
> The Victor Chang Cardiac Research Institute's Email is scanned by the MessageLabs Email Security System.
> _______________________________________________
> 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

Scanned by Messagelabs ***

______________________________________________________________________
The Victor Chang Cardiac Research Institute's Email is scanned by the MessageLabs Email Security System.


More information about the ParaView mailing list