-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (27 loc) · 1.01 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import vtk
def main():
cubeSource = vtk.vtkCubeSource()
cubeMapper = vtk.vtkPolyDataMapper()
cubeMapper.SetInputConnection(cubeSource.GetOutputPort())
cubeActor = vtk.vtkActor()
cubeActor.GetProperty().SetOpacity(0.5)
cubeActor.SetMapper(cubeMapper)
sphereSource = vtk.vtkSphereSource()
sphereMapper = vtk.vtkPolyDataMapper()
sphereMapper.SetInputConnection(sphereSource.GetOutputPort());
sphereActor = vtk.vtkActor()
sphereActor.GetProperty().SetColor(0.5,1,0.5);
#sphereActor.GetProperty().SetOpacity(0.5);
sphereActor.SetMapper(sphereMapper);
renderer = vtk.vtkRenderer()
renderer.AddActor(cubeActor);
renderer.AddActor(sphereActor);
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer);
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(renderWindow);
renderer.SetBackground(0,0,0);
renderWindow.Render();
interactor.Start();
if __name__ == '__main__':
main()