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

Fix closing animation window crash python #113

Merged
merged 5 commits into from
Feb 22, 2022

Conversation

germa89
Copy link
Contributor

@germa89 germa89 commented Feb 22, 2022

As the title.

Close #112

Thank @akaszynski for the guidance.

@germa89 germa89 added the bug Something isn't working label Feb 22, 2022
@germa89 germa89 self-assigned this Feb 22, 2022
@germa89
Copy link
Contributor Author

germa89 commented Feb 22, 2022

Code example to check:

import tempfile
import os
import pyvista as pv
from ansys.mapdl.reader import save_as_archive
from ansys.mapdl.core import launch_mapdl

# launch MAPDL as a service
mapdl = launch_mapdl(loglevel="ERROR")

# Create a simple plane mesh centered at (0, 0, 0) on the XY plane
mesh = pv.Plane(i_resolution=100, j_resolution=100)
mesh.plot(color="w", show_edges=True)

###############################################################################
# Write the mesh to a temporary file
archive_filename = os.path.join(tempfile.gettempdir(), "tmp.cdb")
save_as_archive(archive_filename, mesh)

# Read in the archive file
response = mapdl.cdread("db", archive_filename)
mapdl.prep7()
print(mapdl.shpp("SUMM"))

# specify shell thickness
mapdl.sectype(1, "shell")
mapdl.secdata(0.01)
mapdl.emodif("ALL", "SECNUM", 1)

mapdl.units("SI")  # not necessary, but helpful for book keeping
mapdl.mp("EX", 1, 200e9)  # Elastic moduli in Pa (kg/(m*s**2))
mapdl.mp("DENS", 1, 7800)  # Density in kg/m3
mapdl.mp("NUXY", 1, 0.3)  # Poissons Ratio
mapdl.emodif("ALL", "MAT", 1)

# Run an unconstrained modal analysis
# for the first 20 modes above 1 Hz
mapdl.modal_analysis(nmode=20, freqb=1)

###############################################################################
# Load the result file within ``pyansys`` and plot the 8th mode.
result = mapdl.result


result.animate_nodal_displacement(
    18,
    loop=True,
)

@germa89
Copy link
Contributor Author

germa89 commented Feb 22, 2022

@akaszynski this fix is only applicable to Windows (os.name=='nt') because I'm not aware Linux has this issue.

I don't have a Linux GUI so I cannot check it.

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.

Will need a follow up on Linux, waiting for upstream fix in pyvista.

@akaszynski akaszynski enabled auto-merge (squash) February 22, 2022 20:56
@akaszynski akaszynski merged commit d6b3f44 into main Feb 22, 2022
@akaszynski akaszynski deleted the fix/closing-animation-crash branch February 22, 2022 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

result.animate_nodal_displacement() crashes
2 participants