/[escript]/trunk/pyvisi_old/examples/basicExample.py
ViewVC logotype

Contents of /trunk/pyvisi_old/examples/basicExample.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 786 - (show annotations)
Tue Jul 25 04:58:05 2006 UTC (13 years, 1 month ago) by gross
File MIME type: text/x-python
File size: 2304 byte(s)
switched off pyvisi
1 """
2 Basic example of pyvisi usage.
3
4 Will hopefully help me write a decent interface.
5
6 @var __author__: name of author
7 @var __license__: licence agreement
8 @var __copyright__: copyrights
9 @var __url__: url entry point on documentation
10 @var __version__: version
11 @var __date__: date of the version
12 """
13
14 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
15 http://www.access.edu.au
16 Primary Business: Queensland, Australia"""
17 __license__="""Licensed under the Open Software License version 3.0
18 http://www.opensource.org/licenses/osl-3.0.php"""
19 __author__="Paul Cochrane"
20 __url__="http://www.iservo.edu.au/esys"
21 __version__="$Revision$"
22 __date__="$Date$"
23
24
25 # example code for how a user would write a script in pyvisi
26 from esys.pyvisi import * # base level visualisation stuff
27 #from esys.pyvisi.utils import * # pyvisi specific utils
28 # import the objects to render the scene using vtk
29 from esys.pyvisi.renderers.vtk import *
30
31 # these things are just here to make data to plot, not all of which are used
32 from ESyS import *
33 import Finley
34
35 # now make some data of some kind
36 mesh = Finley.Brick(3,5,7) # a Finley mesh
37 vectorData = mesh.Nodes().getX() # get vector data from the mesh nodes
38
39 # define the scene object
40 # a Scene is a container for all of the kinds of things you want to put
41 # into your plot for instance, images, meshes, arrow/vector/quiver plots,
42 # contour plots, spheres etc.
43 scene = Scene()
44
45 # define a camera object. There will need to be one camera per scene.
46 camera = Camera()
47
48 # add the camera to the scene
49 scene.add(camera)
50
51 # create an ArrowPlot object
52 #plot = ArrowPlot()
53
54 # add the plot to the scene
55 #scene.add(plot)
56
57 # assign some data to the plot
58 #plot.setData(vectorData)
59
60 # create an Image object
61 img = Image(file="ranges.jpg",format="jpeg")
62
63 # add the image to the scene
64 scene.add(image)
65
66 # render the scene, outputing the data to a jpeg file
67 scene.render(file="example.jpg",format="jpeg")
68 # if we are just using vtk, this should head out to a file, or an opengl window
69 # if we are using mayavi with vtk, then this will be in a mayavi window
70
71 # saving a scene could also be written as (handy for PBS jobs?)
72 # could try working out the format from the filename extension
73 scene.save(file="example.jpg", format="jpeg")
74

  ViewVC Help
Powered by ViewVC 1.1.26