get python-odb_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.©

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值