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

Adding screenshot method. #2846

Merged
merged 7 commits into from
Mar 4, 2024
Merged

Adding screenshot method. #2846

merged 7 commits into from
Mar 4, 2024

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Mar 1, 2024

To show/download screenshots.

mapdl.screenshot()
image

Close #2845

Details

# Importing packages
import numpy as np
from ansys.mapdl.core import launch_mapdl

# Starting MAPDL
mapdl = launch_mapdl(loglevel="WARNING", print_com=True)

# Analysis setup
mapdl.com("ANSYS MEDIA REL. 2023R2 (05/12/2023) REF. VERIF. MANUAL: REL. 2023R2")
mapdl.prep7()
mapdl.title("VM151, NONAXISYMMETRIC VIBRATION OF A CIRCULAR PLATE")
mapdl.com("FORMULAS FOR NATURAL FREQUENCY AND MODE SHAPE, BLEVINS, PAGE 240")

# Element definition
mapdl.et(1, "SHELL61")
mapdl.r(1, .05)  # THICKNESS OF PLATE

# Material model
mapdl.mp("EX", 1, 30E6)
mapdl.mp("DENS", 1, .00073)
mapdl.mp("PRXY", 1, 0.3)

# Geometry definition
mapdl.k(1)
mapdl.k(2, 3)
mapdl.l(1, 2)

# Meshing
mapdl.lesize(1, "", "", 9)
mapdl.lmesh(1)

# Apply boundary conditions
mapdl.nsel("S", "LOC", "X", 0)
mapdl.d("ALL", "UX")

mapdl.nsel("S", "LOC", "X", 3)  # SELECT NODE AT R=3 AND CONSTRAIN
mapdl.d("ALL", "UX", "", "", "", "", "UY")

mapdl.nsel("ALL")
mapdl.d("ALL", "UZ")  # CONSTRAIN TORSIONAL DOF'S

# Setting modal analysis
mapdl.finish()
mapdl.solution()
mapdl.antype("MODAL")  # MODE FREQUENCY ANALYSIS
mapdl.mxpand(3)  # EXPAND FIRST 3 MODE SHAPES
mapdl.modopt("LANB", 9)
mapdl.outpr("BASIC", "ALL")
mapdl.mode(0)  # ZERO HARMONIC MODE

# Solving
mapdl.solve()
mapdl.finish()

# Post processing
mapdl.post1()
mapdl.window(1, "LTOP")
mapdl.set(1, 1)
mapdl.pldisp(1)
mapdl.run("/NOERASE")
mapdl.window(1, "OFF")
F1 = mapdl.get_value("MODE", 0, "FREQ")

# Solve for the first harmonic mode
mapdl.solution()
mapdl.mode(1)  # FIRST HARMONIC MODE
mapdl.solve()

# Post-processing
mapdl.post1()
mapdl.window(2, "RTOP")
mapdl.set(1, 1)
mapdl.pldisp(1)
mapdl.window(2, "OFF")
F2 = mapdl.get_value("MODE", 1, "FREQ")

# Solve for the second harmonic mode
mapdl.solution()
mapdl.mode(2)  # SECOND HARMONIC MODE
mapdl.solve()

# Post-processing
mapdl.post1()
mapdl.window(3, "BOT")
mapdl.set(1, 1)
mapdl.pldisp(1)
F3 = mapdl.get_value("MODE", 1, "FREQ")

# Printing image
#mapdl.show("PNG")
mapdl.screenshot() # for 0.68.1 or superior

mapdl.exit()

@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@github-actions github-actions bot added Enhancement Improve any current implemented feature New Feature Request or proposal for a new feature labels Mar 1, 2024
@germa89 germa89 self-assigned this Mar 1, 2024
@germa89 germa89 requested a review from clatapie March 1, 2024 21:00
@germa89 germa89 enabled auto-merge (squash) March 1, 2024 21:13
Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
@germa89 germa89 requested a review from PipKat March 1, 2024 21:53
Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
@germa89 germa89 requested a review from PipKat March 4, 2024 15:42
Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
@germa89 germa89 requested a review from PipKat March 4, 2024 15:47
Copy link
Member

@PipKat PipKat left a comment

Choose a reason for hiding this comment

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

Very minor suggestions.

Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
@germa89 germa89 merged commit 0134c23 into main Mar 4, 2024
27 checks passed
@germa89 germa89 deleted the feat/screenshot-feature branch March 4, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improve any current implemented feature New Feature Request or proposal for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We need a mapdl.screenshot command
2 participants