[Paraview] Python script for Interactive render window

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Thu Jun 14 10:39:18 EDT 2007


The "Distributed stand-alone" mode as described in the ParaView book is 
no longer supported by ParaView i.e. to run in parallel, one must run in 
client-server mode. This isn't that cumbersome really,
instead of
   mpirun -np 4 paraview
we do
   mpirun -np 4 pvserver
   paraview (and then connect to the correct server).

Same is true for pvpython.

Here's script to read a file and then render in parallel.

import paraview
# Create default builtin connection
paraview.ActiveConnection = paraview.Connect("localhost",11111);

# Create the reader proxy.
# Note that one must create the correct reader based on the type of the
# file being read.
reader = paraview.CreateProxy("sources", "ExodusReader", "sources")
reader.SetFileName("/tmp/somedataset.ex2")
reader.UpdateVTKObjects()

# Create render window
renWin = paraview.CreateRenderWindow()
# Till the view to always render on all processess in parallel and then
# composite the image together.
renWin.SetRemoteRenderThreshold(0);
renWin.UpdateVTKObjects();

# create and add display
display = paraview.CreateDisplay(reader, renWin)
# render
renWin.ResetCamera()
renWin.StillRender()

Utkarsh

Raashid Baig wrote:
> Thanks a lot sir,
> You have really saved a lot of my time and effort. I have one more doubt 
> if you can clarify that, it will be really helpful.
> 
> I have posted this on the paraview mailing list, but I am not sure 
> weather I will get a reply. How can I write a simple paraview-python 
> script that will read some data file in parallel, go through the usual 
> pipeline, each process independently creates an image  based on its 
> partition of geometry and the process collectively combine all the 
> images to created a single image.
> I want to follow Distributed Stand-Alone Mode as described in the 
> Paraview book.
> 
> Yours Faithfully,
> Raashid Baig
> 
> On Thu, 14 Jun 2007 Utkarsh Ayachit wrote :
>  >Currently, the render window cannot be made interactive through 
> pvpython. To get an interactor to work in ParaView, there's some 
> additional meat that needs to be implemented by the GUI layer. The 
> python API does not provide for that.
>  >
>  >If you'd like, feel free to add a feature request to the paraview bug 
> tracker.
>  >
>  >Utkarsh
>  >
>  >
>  >Raashid Baig wrote:
>  >>I am a newbie and I have a very elementary doubt. How do we make the 
> renderwindow interactive (while using a python script) ? There is no 
> Initialize() or Start() method in GenericRenderWindowInteractor.
>  >>The only available methods shown through smdoc are :
>  >>['CenterOfRotation', 'InteractorStyle', 'RenderWindow', 'Renderer']
>  >>
>  >>
>  >>
>  >>pick great mobiles 
> <http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-home.htm/1050715198@Middle5/1239774_1233551/1238970/1?PARTNER=3&OAS_QUERY=null 
> target=new >
>  >>
>  >>
>  >>------------------------------------------------------------------------
>  >>
>  >>_______________________________________________
>  >>ParaView mailing list
>  >>ParaView at paraview.org
>  >>http://www.paraview.org/mailman/listinfo/paraview
> 
> 
> 
> pick great mobiles 
> <http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-home.htm/1050715198@Middle5/1239774_1233551/1238970/1?PARTNER=3&OAS_QUERY=null 
> target=new >
> 


More information about the ParaView mailing list