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.__setInput() |
27 |
self.__setCutFunction() |
28 |
self.__vtk_cutter.Update() |
29 |
|
30 |
def __setInput(self): |
31 |
""" |
32 |
Set the input for the cutter. |
33 |
""" |
34 |
|
35 |
self.__vtk_cutter.SetInput(self.__object) |
36 |
|
37 |
def __setCutFunction(self): |
38 |
""" |
39 |
Set the cut functions. |
40 |
""" |
41 |
|
42 |
self.__vtk_cutter.SetCutFunction(self.__plane) |
43 |
|
44 |
def _getOutput(self): |
45 |
""" |
46 |
Return the output of the cutter. |
47 |
|
48 |
@rtype: vtkPolyData |
49 |
@return: Polygonal data |
50 |
""" |
51 |
|
52 |
return self.__vtk_cutter.GetOutput() |