Python script could also be used to perform postprocessing in Abaqus. The first step might be to get the ODB object containing the data to process. Here are two methods to create a variable for the ODB object.
From current viewport
This might be the most convenient way to assign an ODB object to a variable. Manual operation, however, is required before this could work.
So the first step is to navigate to the desired ODB in current viewport in Abaqus, which means we must “see” the result of the desired model in current work space. Yes, the odb file is already opened in Abaqus just in front of us.
Now the following script will get something from current viewport.
from abaqus import session # get the current viewport currentViewport = session.viewports[session.currentViewportName] # get odb object from current viewport odb = currentViewport.displayedObject
This should be enough for ordinary data process, such as plot the velocity in History Output,
xy0 = xyPlot.XYDataFromHistory(odb=odb, outputVariableName='Spatial velocity: V1', suppressQuery=True)
But we could do more for labelling,
# get odb file path with name odbNameFull = odb.path # split into separately path and name odbPath = os.path.split(odbNameFull)[0] odbName = os.path.split(odbNameFull)[1]
From file
We can also open an ODB and process it all in script. But we must know exactly the path and name of the ODB file. For example,
C:\Works\example-model.odb
Here is the script for using this ODB file as object,
# the path and name odbNameFull = "C:\Works\example-model.odb" # open and assign this odb object to a variable odb = openOdb(path = odbNameFull)
If you have something about this, please leave a comment below to share with us.©
本文发表于水景一页。永久链接:<https://cnzhx.net/fe/2016/04/29/python-script-to-get-odb-object/>。转载请保留此信息及相应链接。