Open Odb and Display a Contour Plot from Opening an output database and displaying a contour plot.

Print a contour plot to a local PNG-format file.

Run the following command before running this script:

abaqus fetch job=viewer_tutorial

The following example of a script containing Abaqus Scripting Interface commands uses the output database used by Viewing the Output from Your Analysis.

Use the following command to retrieve the example script:

abaqus fetch job=viewerOpenOdbAndContour

The script does the following:

  • Creates a viewport, and makes it the current viewport.

  • Opens an output database.

  • Displays a contour plot.

  • Displays the model in the first frame of the third step.

  • Sets the number of contour intervals and the contour limits.

  • Prints a color image of the viewport to a .png file.

import visualization
from abaqus import *
from abaqusConstants import *

# Create a new Viewport for this example.

myViewport = session.Viewport(name="Print a contour plot", origin=(10, 10), width=200, height=100)

# Open the output database and associate it
# with the new viewport.

odbPath = "viewer_tutorial.odb"
myOdb = visualization.openOdb(path=odbPath)


# Display a contour plot of the output database.


# Change to the first frame of the third step.
# Remember that indices in Python begin with zero:
#   The index of the first frame is 0.
#   The index of the third step is 2.

myViewport.odbDisplay.setFrame(step=2, frame=0)

# Change the number of contour intervals to 10
# starting at 0.0 and ending at 0.10.


# Generate color output.
# Do not print the viewport decorations or the black background.

session.printOptions.setValues(rendition=COLOR, vpDecorations=OFF, vpBackground=OFF)

# Print the viewport to a local PNG-format file.

session.printToFile(fileName="contourPlot", format=PNG, canvasObjects=(myViewport,))

Total running time of the script: (0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery