[Paraview] Two python questions: client vtk object ->server; macro-> set plugin fields

Lawrence Angrave angrave at illinois.edu
Sun Nov 7 08:41:52 EST 2010


Hi,
Some python client related questions -

Some Background: I have a pure-vtk python project that reads in 
volumetric and time-series polydata. I'd like to convert this to be a 
paraview plugin and macros. Ideally this would be a pure python solution 
and it would create two paraview sources (an unstructured grid and 
polydata) when the user opens a custom config file.  Eventually it would 
be great to create a default pipeline of filters too.

Q1 Is it possible to send a vtk unstructured grid object, built within a 
python macro, to the Paraview server? FYI I'll probably implement this 
with a python plugin instead but wondered if the above implementation is 
even possible with Paraview 3.8.1 (or later)?

FYI I played with TrivialProducer and GetClientSideObject but did not 
see a way to push the data back to the server without saving to disk 
first i.e. the opposite of "Fetch" and then asking paraview to load the 
files.

   import paraview.vtk as vtk
    from paraview.simple import *
    .. Create client vtk objects... Now want to display them in paraview...
   tp=TrivialProducer()
   # Proxy does not support SetOutput
   tpclient=tp.GetClientSideObject()
   tpclient.SetOutput( myvtkpolydata ) # Nothing appears on server :-(
    # How do I send my poly data and ugrid to the server without saving 
to disk?


Q2 Is about an alternative implementation idea -
An alternative would be to create a python programmable filter that 
reads in the file and wrap it as a plugin. I'd need to two plugins (one 
for the UGrid and one of the poly data). Correct? How would you 
recommend that I control these from a python macro? e.g. The python 
macro would display a filename chooser, read in some basic config 
parameters and then set the relevant parameters on each filter before 
invoking the filter.
I understand a filechooser may be possible using PyQt but am wondering 
if it's trivial to call custom methods and set attributes on a python 
programmable filter directly from a python macro (or other python 
plugin). Are there any code-snippets that you can recommend? I didnt see 
anything relevant on the wiki.

By the way, thanks for the python bindings. We find python development 
so much faster than traditional C++ development - it's great not having 
to wait for a C++ build to complete.

Thanks for your help!
Lawrence.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20101107/60237c44/attachment.htm>


More information about the ParaView mailing list