Idiot's Guide to the Paraview Python Module

From ParaQ Wiki
Jump to navigationJump to search

Examples

  import paraview

  # Create default builtin connection
  paraview.ActiveConnection = paraview.connect()

  # Create the reader object
  reader = paraview.createProxy("sources", "ExodusReader", "sources")
  reader.SetFileName("/home/myself/Datasets/Exodus/can.ex2")
  reader.UpdateVTKObjects()
  
  # Execute the reader explicitly. 
  reader.UpdatePipeline()

  # Update all information properties. 
  reader.UpdatePropertyInformation()

  # Get the timestep available in the data set.
  time_step_range = reader.GetTimeStepRangeInfo()
  print "TimeStep Range: %s" % str(time_step_range)

  # Get the point arrays available.
  point_array_info = reader.GetPointArrayInfo()
  print "Point Arrays: %s" % str(point_array_info)

  # Set timestep to last.
  reader.SetTimeStep(time_step_range[1])

  # Enable the first point array.
  reader.SetPointArrayStatus(point_array_info[0], point_array_info[1]);
  reader.UpdateVTKObjects()