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

Annotation of /trunk/pyvisi/py_src/clipper.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1148 - (hide annotations)
Wed May 16 22:45:33 2007 UTC (14 years, 4 months ago) by jongui
File MIME type: text/x-python
File size: 1535 byte(s)
Added the updated files for pyvisi and removed some incorrect reference images.
1 ksteube 1147 """
2     @author: John NGUI
3     """
4    
5     import vtk
6    
7     class Clipper:
8     """
9     Class that defines a clipper.
10     """
11    
12 jongui 1148 def __init__(self):
13 ksteube 1147 """
14     Initialise the clipper.
15 jongui 1148 """
16    
17     self.__vtk_clipper = vtk.vtkClipDataSet()
18 ksteube 1147
19 jongui 1148 def _setupClipper(self, object, plane):
20     """
21     Setup the clipper.
22    
23 ksteube 1147 @type object: vtkUnstructuredGrid, etc
24     @param object: Input for the clipper
25     @type plane: vtkPlane
26     @param plane: Plane to clip the object
27     """
28    
29     self.__object = object
30     # True only if a plane is used to perform clipping. False for
31     # scalar clipping.
32     if(plane != None):
33     self.__plane = plane
34 jongui 1148
35 ksteube 1147 self.__setInput()
36     self.setInsideOutOn()
37    
38     def __setInput(self):
39     """
40     Set the input for the clipper.
41     """
42    
43     self.__vtk_clipper.SetInput(self.__object)
44    
45     def _setClipFunction(self):
46     """
47     Set the clip function (using a plane) for the clipper.
48     """
49    
50     self.__vtk_clipper.SetClipFunction(self.__plane)
51    
52     def setInsideOutOn(self):
53     """
54     Clip one side of the rendered object.
55     """
56    
57     self.__vtk_clipper.InsideOutOn()
58    
59     def setInsideOutOff(self):
60     """
61     Clips the other side of the rendered object.
62     """
63    
64     self.__vtk_clipper.InsideOutOff()
65    
66     def setClipValue(self, value):
67     """
68     Set the scalar clip value (intead of using a plane) for the clipper.
69    
70     @type value: Number
71     @param value: Scalar clip value
72     """
73    
74     self.__vtk_clipper.SetValue(value)
75    
76 jongui 1148 def _getClipperOutput(self):
77 ksteube 1147 """
78     Return the output of the clipper.
79    
80     @rtype: vtkUnstructuredGrid
81     @return: Unstructured grid
82     """
83    
84     return self.__vtk_clipper.GetOutput()
85    

  ViewVC Help
Powered by ViewVC 1.1.26