Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result._plot_point_scalars: Use argument return_cpos in any case and fix screenshot function on Windows OS #73

Merged
merged 3 commits into from
Oct 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions ansys/mapdl/reader/rst.py
Original file line number Diff line number Diff line change
@@ -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)
Comment on lines +2822 to +2827
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cleaner. Thanks!


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