Skip to content

Commit

Permalink
Result._plot_point_scalars: Use argument return_cpos in any case
Browse files Browse the repository at this point in the history
... before, it was used only, when `if animate`. Now, it used in any case of the call `plotter.show`.
  • Loading branch information
beppo-dd committed Oct 12, 2021
1 parent a5e952b commit 56f38f1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ansys/mapdl/reader/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[1] > 31:
show_kwargs['return_cpos'] = return_cpos

if animate:
if off_screen: # otherwise this never exits
loop = False
Expand All @@ -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,
Expand Down Expand Up @@ -2822,7 +2822,8 @@ def q_callback():
elif screenshot:
cpos = plotter.show(auto_close=False, interactive=interactive,
window_size=window_size,
full_screen=full_screen)
full_screen=full_screen,
**show_kwargs)
if screenshot is True:
img = plotter.screenshot()
else:
Expand All @@ -2832,7 +2833,8 @@ def q_callback():
else:
cpos = plotter.show(interactive=interactive,
window_size=window_size,
full_screen=full_screen)
full_screen=full_screen,
**show_kwargs)

if screenshot is True:
return cpos, img
Expand Down

1 comment on commit 56f38f1

@akaszynski
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point, there's no reason why we can't return the camera position regardless of the animate parameter.

Please sign in to comment.