I would like to create an animation of X-Y path plots in Abaqus/CAE. How can I do this?
(The following applies to Versions 6.3 and higher.)
While Abaqus/CAE does not currently have the capability to animate X-Y path plots,
freeware products exist that allow a sequence of .png files to be combined into an
animation. A script has been included with this answer to automate the creation of the
necessary .png files. Programs such as VideoMach can be used to create the animation.
Note that by listing the above shareware program, Abaqus, Inc. is in no way endorsing
the product. It is merely offered as an example of the type of image processing software
that is openly available.
For a given output database and path, the script will create an X-Y plot along the path and
print it to a file. The first and last steps to be considered for the animation must be
specified; files will be created for each frame in each step, including the bounding steps.
To create the series of .png files, complete the following steps:
1. Start Abaqus/CAE and open the output database (.odb) file of interest.
Tools ® Path ® Create
and create the desired path.
File ® Run Script
and select createAni.py
When prompted, enter:
The name of the output database file. It is not necessary to include the .odb
The name of the path to be used in creating the animation. Only one path
can be used per animation.
The minimum and maximum values for the Y-axis of the X-Y plots.
The first and last step numbers to be included.
5. The .png files will be created in the directory from which Abaqus/CAE was started.
1.The X-axis plot limits are set by the length of the path. The length of the path could
change over the course of the analysis, and subsequently the X-axis limits could
change through the animation.
2.Care must be taken when setting the upper and lower bounds on the Y-axis. If they
are set too high or too low an error will be issued as none of the plot will be visible
(Abaqus/Viewer does not allow the creation of an empty plot).
3.The script is currently hard coded to plot Mises stress. To plot a different variable,
lines 20-22 must be edited. Please consult:
‘setPrimaryVariable,’ Section 32.1.5 of the Abaqus 6.9 or 6.10 Scripting
from abaqus import *
from visualization import *
import displayGroupOdbToolset as dgo
# implemented as a function in order to return easily after cancelling
odbName = getInput(‘What is the name of the odb file?’)
if odbName == None:
if odbName[-4:] != ‘.odb’:
odbName = odbName + ‘.odb’
pathName = getInput(‘What is the name of the path to use?’)
if pathName == None:
vp = session.viewport[session.currentViewportName]
odb = session.openOdb(odbName)
# use the next statement to define the field value (setPrimaryVariable – 28.1.8 Scripting reference manual)
# get y values from user, x values defined automatically by length of path
temp = getInput(‘What is the min value for the y-axis?’)
if temp == None:
yMin = float(temp)
temp = getInput(‘What is the max value for the y-axis?’)
if temp == None:
yMax = float(temp)
steps = odb.step.keys()
plots = session.xyPlots.keys()
numplots = len(plots)
plotname = ‘XYPlot-‘+str(numplots + 1)
xyp = session.XYPlot(name=plotname)
raise ValueError,’ERROR: Creating XYPlot object’
print ‘The following steps exist: ‘,steps
stepList = getInput(‘Enter the first and last step numbers to include, separated by a colon’)
if stepList == None:
stepList= string.replace(stepList, ‘:’,”,”)
stepCount = 0
fCount = 0
for i in stepList:
key = steps[i]
frames = odb.step[key].frame
frameLen = len(frames)
for j in range(frameLen):
print i, j,
if fCount < 10:
fName = ‘pic_00%s.png’%fCount
elif fCount < 100:
fName = ‘pic_0%s.png’%fCount
fName = ‘pic_%s.png’%fCount
fCount = fCount + 1
pth = session.path[pathName]
xy=XYDataFromPath(name=’Temp-1′, path=pth, includeIntersections=FALSE,
stepCount = stepCount + 1
# Call the function