Skip to content

Commit fc67a49

Browse files
feat: Add view buttons, toggle bounding box axes and change between orthogonal and perspective projections
1 parent cf61c6e commit fc67a49

File tree

2 files changed

+575
-0
lines changed

2 files changed

+575
-0
lines changed

src/ansys/tools/visualization_interface/backends/plotly/plotly_interface.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from pyvista import PolyData
2929

3030
from ansys.tools.visualization_interface.backends._base import BaseBackend
31+
from ansys.tools.visualization_interface.backends.plotly.widgets.button_manager import ButtonManager
3132
from ansys.tools.visualization_interface.types.mesh_object_plot import MeshObjectPlot
3233

3334

@@ -37,6 +38,12 @@ class PlotlyBackend(BaseBackend):
3738
def __init__(self) -> None:
3839
"""Initialize the Plotly backend."""
3940
self._fig = go.Figure()
41+
self._button_manager = ButtonManager(self._fig)
42+
43+
# Stack buttons vertically on the left side
44+
self._button_manager.add_plane_view_buttons()
45+
self._button_manager.add_coordinate_system_toggle_button()
46+
self._button_manager.add_projection_toggle_button()
4047

4148
def _pv_to_mesh3d(self, pv_mesh: Union[PolyData, pv.MultiBlock]) -> Union[go.Mesh3d, list]:
4249
"""Convert a PyVista PolyData or MultiBlock mesh to Plotly Mesh3d format.
@@ -101,6 +108,7 @@ def _convert_polydata_to_mesh3d(self, pv_mesh: PolyData) -> go.Mesh3d:
101108

102109
return go.Mesh3d(x=x, y=y, z=z, i=i, j=j, k=k)
103110

111+
104112
@property
105113
def layout(self) -> Any:
106114
"""Get the current layout of the Plotly figure.

0 commit comments

Comments
 (0)