Python 提取odb结果
### python脚本提取解释
# 导入模块
from odbAccess import *
from abaqusConstants import *
from odbMaterial import *
from odbSection import *
import math
# 打开odb文件
odb = openOdb(path=r'G:\CABLE_CON\TEXT2\Job-1.odb')
Step_1=odb.steps['Step-1']
# 锁定目标绳索
region = Step_1.historyRegions['Element ASSEMBLY.1']
xy1=region.historyOutputs['CTF1'].data[300]
# 取最后一帧数据,并将括号删掉
s=str(xy1)
s = s.replace("(", "")
s = s.replace(")", "")
# 将绳力输出到 F1.txt 文件
disFile=open('F1.txt','w')
disFile.write(s)
disFile.close()
# 取最后一帧数据
lastFrame=Step_1.frames[-1]
Zuobiao=lastFrame.fieldOutputs['COORD']
Regioncare=odb.rootAssembly.nodeSets['RP']
Coor1=Zuobiao.getSubset(region=Regioncare)
Zuobiao_x=Coor1.values[0].data[0]
Zuobiao_y=Coor1.values[0].data[1]
Zuobiao_z=Coor1.values[0].data[2]
Zhuanjiao=lastFrame.fieldOutputs['UR']
ZJ=Zhuanjiao.getSubset(region=Regioncare)
Zhuanjiao_x=ZJ.values[0].data[0]
Zhuanjiao_y=ZJ.values[0].data[1]
Zhuanjiao_z=ZJ.values[0].data[2]
# 将位姿信息输出到 weizi.txt 文件
total=Zuobiao_x,Zuobiao_y,Zuobiao_z,Zhuanjiao_x,Zhuanjiao_y,Zhuanjiao_z
s1=str(total)
s1 = s1.replace("(", "")
s1 = s1.replace(")", "")
disFile=open('weizi.txt','w')
disFile.write(s1)
disFile.close()
技巧:不知道元组内部元素时,在ABAQUS界面运行:输出所需信息
print Step_1.historyRegions.keys()
参考网站:
https://wenku.baidu.com/view/9f7dd660f31dc281e53a580216fc700abb685284.html
查看更多评论 >