[Paraview] Python: two actors AND connection to local running
Paraview
Jordi Campos i Miralles
jcampos at maia.ub.es
Wed Jun 20 07:43:59 EDT 2007
After basic example of http://www.paraview.org/Wiki/ParaView:pvpython ,
I tried to create two actors with different colors, to pass them to
different Renderers of a running Paraview, but I found some problems.
I inserted the questions in the script code that is placed below.
Can anybody help me to understand how to perform it in Paraview
scripting?
Thanks in advance,
jor;)i
SCRIPT-----------------------------------------------------
# PV-03-RenderM.py
import paraview
# QUESTIONS ARE IN CAPITAL LETTERS
paraview.ActiveConnection = paraview.Connect() # Create a built-in server
source1 = paraview.CreateProxy("sources", # Sources
"SphereSource", "sources")
source2 = paraview.CreateProxy("sources", "ConeSource", "sources")
mapper1 = paraview.CreateProxy("mappers", # Mappers
"PolyDataMapper", "mappers")
mapper1.SetInput( source1 )
mapper1.UpdateVTKObjects()
mapper2 = paraview.CreateProxy("mappers", "PolyDataMapper", "mappers")
mapper2.SetInput( source2 )
actor1 = paraview.CreateProxy("props", # Actors
"Actor", "props") # (todo: check LODActor)
actor1.SetMapper( mapper1 )
actor1.SetPosition( 2, 0, 0 )
actor1.UpdateVTKObjects()
actor2 = paraview.CreateProxy("props", "Actor", "props")
actor2.SetMapper( mapper2 )
prop = paraview.CreateProxy("properties", # Properties
"Property", "properties")
prop.SetColor(1, 1, 0)
prop.UpdateVTKObjects() # IS IT NECESSARY???
prop = actor2.SetProperty()
actor2.UpdateVTKObjects()
# IS THERE A SHORTER WAY TO CHANGE THE COLOR???
renderer = paraview.CreateProxy("renderers", # Renderers
"Renderer", "renderers")
# renderer.AddActor( actor1 ) FAILS, WHY???
# renderer.AddActor( actor2 )
# ALSO renderer.AddToActors( actor1 )... ????
print paraview.GetRenderModules()
# RETURNS EMPTY LIST, SHOULDN'T NEW CREATED 'render' APPEAR???
renderW = paraview.CreateRenderWindow() # RenderWindows
# I WOULD LIKE TO USE LODRenderModule W CONE
# AND SimpleRenderModule W SPHERE, IS IT POSSIBLE?
disp1 = paraview.CreateDisplay(source1, renderW) # Displays
disp2 = paraview.CreateDisplay(source2, renderW)
# WHICH IS THE CORRESPONDANCE IN VTK?
renderW.ResetCamera()
renderW.StillRender()
# WHO CAN I TAKE AN SCREENSHOT???
raw_input("Enter to finish")
# I'M INTERESTED INI CONNECTING TO A RUNNING PARAVIEW (LOCAL IN MY MACHINE),
# CREATE THE SCENE AND AFTERWARDS LET THE USER INTERACT, IS IT POSSIBLE???
-----------------------------------------------------
pg 90 of
http://namaste.maia.ub.es/public/vtk-volume-rendering-tutorial.pdf
--
Jordi Campos i Miralles
Departament de Matemàtica Aplicada i Anàlisi, MAiA
Facultat de Matemàtiques, Universitat de Barcelona
Gran Via de les Corts Catalanes, 585
08007 Barcelona
Telf : +34 93 403 93 72
More information about the ParaView
mailing list