晚上好,
我已经完成了获取模型并生成结果的脚本。我试图在同一个脚本中编写一种读取压力值的方法,但 python 说:
" File "C:/Users/TFG", line 250, in <module> RegionTen=odb.rootAssembly.noseSets['Set-1'] KeyError: Set-1 "
我理解 Set-1 不会退出,但事实并非如此。我希望有人能帮助我。
我创建 Set-1 :
mdb.models['Model-1'].parts['Part-1'].Set(faces= mdb.models['Model-1'].parts['Part-1'].faces.getSequenceFromMask(('[#1 ]', ), ), name='Set-1')
我阅读压力的代码是:
odb = openOdb( path='C:\Temp\Job-1.odb')
RegionTen = odb.rootAssembly.nodeSets['Set-1']
tamFrames = len(odb.steps['Step-1'].frames)
lastFrames = odb.steps['Step-1'].frames[tamFrames-1]
stress33 = lastFrame.fieldOutputs['S'].getSubset(position=ELEMENT_NODAL, region=RegionTen)
stress13 = lastFrame.fieldOutputs['CTSHR13'].getSubset(position=ELEMENT_NODAL, region=RegionTen)
stress23 = lastFrame.fieldOutputs['CTSHR23'].getSubset(position=ELEMENT_NODAL, region=RegionTen)
print(stress11, stress22, stress12)