diff --git a/ansys/mapdl/reader/rst.py b/ansys/mapdl/reader/rst.py index 542e7bff..05c03f85 100644 --- a/ansys/mapdl/reader/rst.py +++ b/ansys/mapdl/reader/rst.py @@ -2752,6 +2752,11 @@ def _plot_point_scalars(self, scalars, rnum=None, grid=None, result_text = self.text_result_table(rnum) plotter.add_text(result_text, font_size=20, color=text_color) + # camera position added in 0.32.0 + show_kwargs = {} + if pv._version.version_info >= (0, 32, 0): + show_kwargs['return_cpos'] = return_cpos + if animate: if off_screen: # otherwise this never exits loop = False @@ -2761,11 +2766,6 @@ def _plot_point_scalars(self, scalars, rnum=None, grid=None, orig_pts = copied_mesh.points.copy() - # camera position added in 0.32.0 - show_kwargs = {} - if pv._version.version_info[1] > 31: - show_kwargs['return_cpos'] = return_cpos - plotter.show(interactive=False, auto_close=False, window_size=window_size, full_screen=full_screen, @@ -2819,20 +2819,19 @@ def q_callback(): plotter.close() cpos = plotter.camera_position - elif screenshot: - cpos = plotter.show(auto_close=False, interactive=interactive, - window_size=window_size, - full_screen=full_screen) - if screenshot is True: - img = plotter.screenshot() - else: - plotter.screenshot(screenshot) - plotter.close() + elif screenshot is True: + cpos, img = plotter.show(interactive=interactive, + window_size=window_size, + full_screen=full_screen, + screenshot=screenshot, + **show_kwargs) else: cpos = plotter.show(interactive=interactive, window_size=window_size, - full_screen=full_screen) + full_screen=full_screen, + screenshot=screenshot, + **show_kwargs) if screenshot is True: return cpos, img