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

Conversation

beppo-dd
Copy link
Contributor

@beppo-dd beppo-dd commented Oct 12, 2021

  1. Use argument return_cpos in any case: before, it was used only, when if animate. Now, it used in any case of the call plotter.show. I tested the changes of 56f38f1 on Windows 10.
  2. Fix screenshot function on Windows OS: 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 the commit d5ad42d.
  3. Future-safe pyvista version check: the old version check would break with version 1.0.0, commit 1c00879.

... before, it was used only, when `if animate`. Now, it used in any case of the call `plotter.show`.
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.
@beppo-dd beppo-dd changed the title Result._plot_point_scalars: Use argument return_cpos in any case Result._plot_point_scalars: Use argument return_cpos in any case and fix screenshot function on Windows OS Oct 12, 2021
... the old version would break with version 1.0.0.
I used the same compare operation as in
<https://github.com/rbarrois/python-semanticversion/blob/master/semantic_version/base.py>
tested manually.
Comment on lines +2822 to +2827
elif screenshot is True:
cpos, img = plotter.show(interactive=interactive,
window_size=window_size,
full_screen=full_screen,
screenshot=screenshot,
**show_kwargs)
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!

@akaszynski
Copy link
Collaborator

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"

This still needs to be fixed upstream in pyvista; it's just been tough to find enough time to patch that as well as noted in pyvista/pyvista#1706.

Copy link
Collaborator

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

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

Agreed with all the changes.

@beppo-dd, do you need this out soon in a patch release?

@akaszynski akaszynski merged commit 827437a into ansys:main Oct 13, 2021
@beppo-dd
Copy link
Contributor Author

@akaszynski, Thank you for your kind and fast responses! No, I do not need a soon patch release. For me my local patch is sufficient.

@cecidip
Copy link

cecidip commented May 27, 2024

Was this issue fixed finally ? I am having the same problem that python crashes once i close the plot. I work on Mac (macOS Sonoma 14.4.1 ) . Thank you

@beppo-dd
Copy link
Contributor Author

beppo-dd commented May 27, 2024

@cecidip Yes, this issue was fixed finally. It was merged to the main branch with commit 827437a. This fix was released with v0.53.0.
But, I tested this fix just under Windows 10 not under macOS (unusual, as ANSYS Mechanical APDL is not available for macOS at all).
You double post your question here and at pyvista/pyvista#1706. So, your problem could be that issue of pyvista which is still open, see also the corresponding comment of @akaszynski

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants