/[escript]/trunk/pyvisi/py_src/testingplane.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/testingplane.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 889 - (show annotations)
Tue Nov 7 23:42:31 2006 UTC (15 years ago) by jongui
File MIME type: text/x-python
File size: 1389 byte(s)
drivers added
1 import vtk
2
3 file_name = "../test/python/data_data/interior_3D.xml"
4 xmlReader = vtk.vtkXMLUnstructuredGridReader()
5 xmlReader.SetFileName(file_name)
6
7 plane = vtk.vtkPlane()
8 planeCut = vtk.vtkCutter()
9 planeCut.SetInput(xmlReader.GetOutput())
10 planeCut.SetCutFunction(plane)
11
12 out = xmlReader.GetOutput()
13 center = out.GetCenter()
14 #origin = out.GetOrigin()
15
16 planeCut.Update()
17 plane.Modified()
18 #plane.SetOrigin(center[0], center[1], center[2]+ 0.001)
19 plane.SetOrigin(0.0,0.0,0.000000000000000000000000000001)
20
21 #--------------------------------------------
22 #plane.SetNormal(-0.01,0.0,1.0)
23 plane.SetNormal(0.0,0.0,1.0)
24 #------------------------------------------
25
26 planeCut.Update()
27 plane.Modified()
28
29 cutMapper = vtk.vtkDataSetMapper()
30 cutMapper.SetInput(planeCut.GetOutput())
31
32 cutActor = vtk.vtkActor()
33 cutActor.SetMapper(cutMapper)
34
35 outline=vtk.vtkOutlineFilter()
36 outline.SetInput(xmlReader.GetOutput())
37
38 outlineMapper = vtk.vtkDataSetMapper()
39 outlineMapper.SetInput(outline.GetOutput())
40
41 outlineActor = vtk.vtkActor()
42 outlineActor.SetMapper(outlineMapper)
43 outlineActor.GetProperty().SetColor(0,0,0)
44
45 ren = vtk.vtkRenderer()
46 renWin = vtk.vtkRenderWindow()
47 renWin.AddRenderer(ren)
48 iren = vtk.vtkRenderWindowInteractor()
49 iren.SetRenderWindow(renWin)
50
51 ren.AddActor(cutActor)
52 ren.AddActor(outlineActor)
53
54 ren.SetBackground(1,1,1)
55 renWin.SetSize(400,400)
56
57 iren.Initialize()
58 renWin.Render()
59 iren.Start()
60

  ViewVC Help
Powered by ViewVC 1.1.26