Skip to content

Commit ffa9011

Browse files
committed
Fix _PyVistaPlotter.add_point_labels
1 parent 0000f01 commit ffa9011

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/ansys/dpf/core/plotter.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,17 @@ def get_label_at_grid_point(index):
193193
import pyvista as pv
194194

195195
active_scalars = None
196-
if parse(pv.__version__) >= parse("0.35.2"):
196+
if parse(pv.__version__) >= parse("0.42.0"):
197+
# Get actors of active renderer
198+
actors = list(self._plotter.actors.values())
199+
for actor in actors:
200+
mapper = actor.mapper if hasattr(actor, "mapper") else None
201+
if mapper:
202+
dataset = mapper.dataset
203+
if type(dataset) is pv.core.pointset.UnstructuredGrid:
204+
active_scalars = dataset.active_scalars
205+
break
206+
elif parse(pv.__version__) >= parse("0.35.2"):
197207
for data_set in self._plotter._datasets:
198208
if type(data_set) is pv.core.pointset.UnstructuredGrid:
199209
active_scalars = data_set.active_scalars

0 commit comments

Comments
 (0)