[Paraview] Python questions

2011-02-10 Thread James Perry

Hello,

We are attempting to use Paraview to visualise some data from a 
simulation. At present we have a standalone Python script that converts 
the data into a legacy VTK file which Paraview can read. Ideally we'd 
like to integrate the script into Paraview as a programmable source so 
that the data can be imported directly.


I have got the script running inside Paraview, but have encountered two 
problems and wondered if anyone knew how to avoid them:



1. The data is in the form of a vtkStructuredGrid. However the grid 
produced by the script won't display in Paraview and the information tab 
says it contains 0 points and 0 cells. (If the same data is written out 
to a VTK file and read in from there, it displays fine). We found this 
bug report:


http://public.kitware.com/Bug/view.php?id=2974

which suggests this behaviour is the result of a bug in VTK. Does anyone 
know if there is a workaround which would allow us to create a valid 
structured grid object from Python?



2. We would like to pop up a file selection dialog when the script runs 
instead of having the input filename hard-coded into it. According to 
this message:


http://www.paraview.org/pipermail/paraview/2010-April/017010.html

it should be possible to access PyQt functionality from within Paraview. 
However when I run the minimal example from the message it crashes 
Paraview. Does anyone know if there is something else I need to do to 
make this work? I'm aware it's not officially supported, but if someone 
has managed to do it I'd be interested to hear from them.



I'm running ParaView 3.8.1, built from source on Windows XP using Visual 
Studio 2008. I have Qt 4.7.1 and Python 2.6 with PyQt installed.


Many thanks,
James

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
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


Re: [Paraview] Python questions

2011-02-10 Thread James Perry

Hi Jean,

Thanks a lot - that solves my first problem!

Regards,
James


On 10/02/2011 12:30, Favre Jean wrote:


Hello James

I don't believe this is a bug. I have  used the ProgrammableSource and was able 
to render a grid without any difficulty. What is missing in your procedure is 
most likely setting the WholeExtent.


try loading this script and you'll get a rendered image

paraview --script=state.py


-
Jean M. Favre
Swiss National Supercomputing Center




--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
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