Skip to content

Commit

Permalink
Result._plot_point_scalars: fix screenshot function on Windows OS
Browse files Browse the repository at this point in the history
pyvista\plotting\plotting.py:4882: On Windows OS "in the event that the user hits
the exit-button on the GUI then it must be finalized and deleted as accessing it
will kill the kernel... proper screenshots cannot be saved if this happens"
Therefore, when you used ´_plot_point_scalars(..., screenshot=...)´, you got at
ansys\mapdl\reader\rst.py:2830:
´RuntimeError: This plotter is closed and unable to save a screenshot.´

The only solution is, to pass the ´screenshot´ argument to ´plotter.show´
as done in this patch.
  • Loading branch information
beppo-dd committed Oct 12, 2021
1 parent 56f38f1 commit d5ad42d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions ansys/mapdl/reader/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -2819,21 +2819,18 @@ 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,
**show_kwargs)
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,
screenshot=screenshot,
**show_kwargs)

if screenshot is True:
Expand Down

0 comments on commit d5ad42d

Please sign in to comment.