[Paraview] python scripting inside Paraview

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Jun 12 09:01:45 EDT 2007


Hi Robert,

To make a source visible one needs to create what we call a "display" 
for that source. "Display" is a proxy which encapsulates the 
vtkMapper,vtkActor etc. Once must create the display for the source and 
then add it to the render module in which we want to "see" the source.

Here's the script that one can use to do the same:

import paraview
sphere = paraview.CreateProxy("sources","SphereSource","sources")


# Locate the view to which we'll add the "display". All views are
# registered in the group "view_modules" with the proxy manager.
pxm = paraview.pyProxyManager()

# Create a iterator that iterates over all proxies registered in
# a particular group.
iter = pxm.group_iter("view_modules");
activeView = None
for proxy in iter:
   # Locate a 3D render view.
   if proxy.IsA("vtkSMRenderModuleProxy"):
     activeView = proxy
     break
if activeView:
   # create a display for the source in the active view.
   disp = paraview.CreateDisplay(sphere, activeView);
   # Trigger a render.
   activeView.StillRender();

Utkarsh


Robert Maynard wrote:
> Currently I am stumped on how to turn on or off the visibility of items 
> from
> inside the paraview console.
> 
> Currently I am constructing Line and Sphere sources by doing
> sphere = paraview.CreateProxy("sources","SphereSource","sources")
> 
> But these always are constructed with their visibility turned off. I 
> have tried
> getting the properties of these objects using the vtkSMProxy 
> ListMethods() but
> that does not list it.
> 
> What do I need to access to be able to control their visibility?
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview


More information about the ParaView mailing list