Skip to content

Commit fb2ab61

Browse files
committed
fix: not checking if actors have datasets.
1 parent 908278c commit fb2ab61

File tree

1 file changed

+12
-1
lines changed
  • src/ansys/tools/visualization_interface/backends/pyvista/widgets

1 file changed

+12
-1
lines changed

src/ansys/tools/visualization_interface/backends/pyvista/widgets/mesh_slider.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ def __init__(self, plotter_helper: "Plotter") -> None:
5252
self._button: vtkButtonWidget = self.plotter_helper._pl.scene.add_checkbox_button_widget(
5353
self.callback, position=(45, 60), size=30, border_size=3
5454
)
55-
self._meshes = self.plotter_helper._pl.scene.meshes
5655
self._mb = None
5756
self._mesh_actor_list = []
5857

58+
@property
59+
def _meshes(self):
60+
"""Return all the meshes which have dataset from the underlying plotter."""
61+
# This method is patching #208
62+
# until pyvista fix this upstream.
63+
actors = self.plotter_helper._pl.scene.actors.values()
64+
meshes = []
65+
for actor in actors:
66+
if hasattr(actor, 'mapper') and hasattr(actor.mapper, "dataset"):
67+
meshes.append(actor.mapper.dataset)
68+
return meshes
69+
5970
def callback(self, state: bool) -> None:
6071
"""Remove or add the mesh slider widget actor upon click.
6172

0 commit comments

Comments
 (0)