Python script to get ODB object

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.©

本文发表于水景一页。永久链接:<http://cnzhx.net/fe/2016/04/29/python-script-to-get-odb-object/>。转载请保留此信息及相应链接。

雁过留声,人过留名

电子邮件地址不会被公开。 必填项已用*标注

特别提示:与当前文章主题无关的讨论相关但需要较多讨论求助信息请发布到水景一页讨论区的相应版块,谢谢您的理解与合作!请参考本站互助指南
您可以在评论中使用如下的 HTML 标记来辅助表达: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>