ParaView and Python: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
No edit summary
Line 42: Line 42:




:Change!  (Lets look at, and change somthing)
::Print the Theta Resolution
:::print(sphere.ThetaResolution)
::Change it to 64
:::sphere.ThetaResolution=64
:::Show()
:::Render()


:Control input
::Lets delete the clip
:::Delete(clip)
::Lets add a filter to the sphere, without selecting it first
:::wireframe=ExtractEdges(Input=sphere)
:::Show()
:::Render()





Revision as of 23:55, 4 December 2015

Introduction

ParaView offers a rich and powerful Python interface. This allows users to automate processing of their data, and gives access to powerful tools in the Visualization Tool Kit (VTK). This tutorial will describe ParaView and Python. It shows a user how to drive ParaView using Python commands, and how to automate the creation and use of these commands.

Overview

ParaView is a client/ server architecture. The client includes the ParaView GUI and display. The server reads the user's data, processes the data, and passes these images to the client. We can use Python to control ParaView either in the GUI, at the client level, or directly on the server.


A simple Python example within ParaView

  • Start ParaView.
  • Start the Python Interpreter Tools → Python Shell
Lets create and display a sphere.
(Type the following into the Python Shell)
sphere=Sphere()
Show()
Render()
We have now created a sphere in the pipeline, turned on it's visibility, and re-rendered.


Next, lets add a shrink filter. We hide the sphere, add the shrink filter, and re-render.
Hide()
shrink=Shrink()
Show()
Render()


ParaView will allow us to use either the normal GUI controls or Python. For instance:
Select the Sphere in the pipeline browser.
In the Python Shell, type the following:
clip=Clip()
Show()
Render()


Help! (How do we find out what commands are available?)
To see all commands available in ParaView:
dir()
To see all of the options for the Clip command:
dir(Clip)
To see all of the options for the clip we created above:
dir(clip)


Change! (Lets look at, and change somthing)
Print the Theta Resolution
print(sphere.ThetaResolution)
Change it to 64
sphere.ThetaResolution=64
Show()
Render()


Control input
Lets delete the clip
Delete(clip)
Lets add a filter to the sphere, without selecting it first
wireframe=ExtractEdges(Input=sphere)
Show()
Render()


Beginning paraview 1.jpg


Beginning paraview 2.jpg



Where do you go next?

  • Filters tutorial.
  • GUI tutorial.
  • Client server tutorial.
  • Making 2d plots tutorial.
  • Making Powerpoint slides tutorial.

Acknowledgements

Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.