/[escript]/trunk/doc/examples/pyvisi/ellipsoidonplaneclip.py
ViewVC logotype

Annotation of /trunk/doc/examples/pyvisi/ellipsoidonplaneclip.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1147 - (hide annotations)
Wed May 16 06:39:11 2007 UTC (14 years ago) by ksteube
File MIME type: text/x-python
File size: 1245 byte(s)
Added back in some files that were accidentally deleted.

1 ksteube 1147 # Import the necessary modules
2     from esys.pyvisi import Scene, DataCollector, EllipsoidOnPlaneClip, Camera
3     from esys.pyvisi.constant import *
4    
5     PYVISI_EXAMPLE_MESHES_PATH = "data_meshes/"
6     PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images/"
7     X_SIZE = 400
8     Y_SIZE = 400
9    
10     TENSOR_FIELD_CELL_DATA = "stress_cell"
11     FILE_3D = "interior_3D.xml"
12     IMAGE_NAME = "ellipsoid.jpg"
13     JPG_RENDERER = Renderer.ONLINE_JPG
14    
15     # Create a Scene.
16     s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
17     y_size = Y_SIZE)
18    
19     # Create a DataCollector reading from a XML file.
20     dc1 = DataCollector(source = Source.XML)
21     dc1.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FILE_3D)
22     dc1.setActiveTensor(tensor = TENSOR_FIELD_CELL_DATA)
23    
24     # Create a EllipsoidOnPlaneClip.
25     eopc1 = EllipsoidOnPlaneClip(scene = s, data_collector = dc1,
26     viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = True,
27     outline = True)
28     eopc1.setPlaneToXY()
29     eopc1.setScaleFactor(scale_factor = 0.2)
30     eopc1.rotateX(angle = 10)
31    
32     # Create a camera.
33     c1 = Camera(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST)
34     c1.bottomView()
35     c1.azimuth(angle = -90)
36     c1.elevation(angle = 10)
37    
38     # Render the object.
39     s.render(PYVISI_EXAMPLE_IMAGES_PATH + IMAGE_NAME)
40    

  ViewVC Help
Powered by ViewVC 1.1.26