1 |
""" |
2 |
@author: John NGUI |
3 |
""" |
4 |
|
5 |
import vtk |
6 |
|
7 |
class Cutter: |
8 |
""" |
9 |
Class that defines a cutter. |
10 |
""" |
11 |
|
12 |
def __init__(self, object, plane): |
13 |
""" |
14 |
Initialise the cutter. |
15 |
|
16 |
@type object: vtkUnstructuredGrid, etc |
17 |
@param object: Input for the cutter |
18 |
@type plane: vtkPlane |
19 |
@param plane: Plane to cut the object |
20 |
""" |
21 |
|
22 |
self.__object = object |
23 |
self.__plane = plane |
24 |
self.__vtk_cutter = vtk.vtkCutter() |
25 |
|
26 |
self.__setupCutter() |
27 |
|
28 |
def __setupCutter(self): |
29 |
""" |
30 |
Setup the cutter. |
31 |
""" |
32 |
|
33 |
self.__setInput() |
34 |
self.__setCutFunction() |
35 |
self.__vtk_cutter.Update() |
36 |
|
37 |
def __setInput(self): |
38 |
""" |
39 |
Set the input for the cutter. |
40 |
""" |
41 |
|
42 |
self.__vtk_cutter.SetInput(self.__object) |
43 |
|
44 |
def __setCutFunction(self): |
45 |
""" |
46 |
Set the cut functions (using a plance). |
47 |
""" |
48 |
|
49 |
self.__vtk_cutter.SetCutFunction(self.__plane) |
50 |
|
51 |
def _getOutput(self): |
52 |
""" |
53 |
Return the output of the cutter. |
54 |
|
55 |
@rtype: vtkPolyData |
56 |
@return: Polygonal data |
57 |
""" |
58 |
|
59 |
return self.__vtk_cutter.GetOutput() |