ParaView Python Scripting

From ScorecWiki

Jump to: navigation, search

Record Paraview GUI actions

Open paraview then select tools->python shell->trace->[start|stop] trace

Example: load N vtu files and assign a color to each

 try: paraview.simple
 except: from paraview.simple import *
 import random
 import time
 v = []
 for i in range(64):
   f = "/fasttmp/cwsmith/meshes/AAA/vtk/aaa" + str(i) + ".vtu"
   print f
   v.append(XMLUnstructuredGridReader( FileName=[f] ))
   drep = GetDisplayProperties()
   rgb= [random.random(), random.random(), random.random()]
   drep.DiffuseColor = rgb
 Render()
Personal tools