|
6 | 6 | import vtk |
7 | 7 | from vtk.web import wslink as vtk_wslink |
8 | 8 | from vtk.web import protocols as vtk_protocols |
| 9 | +from vtkmodules.vtkRenderingAnnotation import vtkCubeAxesActor |
9 | 10 | from wslink import server |
10 | 11 |
|
11 | 12 | # Local application imports |
@@ -69,7 +70,8 @@ def initialize(self): |
69 | 70 | # Custom API |
70 | 71 | mesh_protocols = VtkMeshView() |
71 | 72 | model_protocols = VtkModelView() |
72 | | - self.registerVtkWebProtocol(VtkView()) |
| 73 | + vtk_view = VtkView() |
| 74 | + self.registerVtkWebProtocol(vtk_view) |
73 | 75 | self.registerVtkWebProtocol(VtkViewerView()) |
74 | 76 | self.registerVtkWebProtocol(mesh_protocols) |
75 | 77 | self.registerVtkWebProtocol(VtkMeshPointsView()) |
@@ -106,6 +108,22 @@ def initialize(self): |
106 | 108 | widget.SetInteractor(renderWindowInteractor) |
107 | 109 | widget.SetViewport(0.0, 0.0, 0.2, 0.2) |
108 | 110 | axes = vtk.vtkAxesActor() |
| 111 | + |
| 112 | + grid_scale = vtkCubeAxesActor(camera=renderer.active_camera) |
| 113 | + grid_scale.DrawXGridlinesOn() |
| 114 | + grid_scale.DrawYGridlinesOn() |
| 115 | + grid_scale.DrawZGridlinesOn() |
| 116 | + grid_scale.SetGridLineLocation(grid_scale.VTK_GRID_LINES_FURTHEST) |
| 117 | + grid_scale.GetTitleTextProperty(0).SetColor(255, 255, 255) |
| 118 | + grid_scale.GetTitleTextProperty(1).SetColor(255, 255, 255) |
| 119 | + grid_scale.GetTitleTextProperty(2).SetColor(255, 255, 255) |
| 120 | + grid_scale.SetFlyModeToStaticEdges() |
| 121 | + vtk_view.register_object("grid_scale", "", "", grid_scale, "", "") |
| 122 | + grid_scale_actor = vtk_view.get_object("grid_scale")["actor"] |
| 123 | + grid_scale_actor.SetVisibility(False) |
| 124 | + |
| 125 | + renderer.AddActor(grid_scale) |
| 126 | + |
109 | 127 | widget.SetOrientationMarker(axes) |
110 | 128 | widget.EnabledOn() |
111 | 129 | widget.InteractiveOff() |
|
0 commit comments