vsvirane
Mechanical
- Jul 31, 2014
- 1
Hi All,
I am having a little problem. I am into parametric design and optimization. I have been able to successfully generate the .odb file using matlab but I am having problem reading the data from it. I have written a python script for it but everytime I run it using matlab I get the error that says that it cannot understand the lastframe.
I am new to python and any help would be great. I am using the following to run python script from matlab
[highlight #CC0000] ! abaqus interactive job=Job-1
! abaqus python ReadODB_Job1.py Job-1.odb Job-1.m[/b][/highlight]
also below ull find the python code
import odbAccess
names=["odbRes_Job1"]
nameOfStep="Step-Torsion"
for y in range(len(names)):
NameOfFile = names[y]+".txt"
FileResultsX = open(NameOfFile,"w")
myOdb = odbAccess.openOdb(path="Job-1.odb")
lastStep = myOdb.steps[nameOfStep]
for z in range(len(lastStep.frames)):
lastFrame = myOdb.steps[nameOfStep].frames[z]
Times=lastFrame.frameValue
U = lastFrame.fieldOutputs["U"]
UR = lastFrame.fieldOutputs["UR"]
UT = lastFrame.fieldOutputs["UT"]
# FileResultsX.write("Node\tUR1\n")
for nodeNumber in range(14,15):
FileResultsX.write("%d\t" % nodeNumber)
for ur in UR.values:
if ur.nodeLabel == nodeNumber:
FileResultsX.write("%10.8E\t" % (ur.data[0]))
myOdb.close()
FileResultsX.close()
Any help will be greatly appreciated
I am having a little problem. I am into parametric design and optimization. I have been able to successfully generate the .odb file using matlab but I am having problem reading the data from it. I have written a python script for it but everytime I run it using matlab I get the error that says that it cannot understand the lastframe.
I am new to python and any help would be great. I am using the following to run python script from matlab
[highlight #CC0000] ! abaqus interactive job=Job-1
! abaqus python ReadODB_Job1.py Job-1.odb Job-1.m[/b][/highlight]
also below ull find the python code
import odbAccess
names=["odbRes_Job1"]
nameOfStep="Step-Torsion"
for y in range(len(names)):
NameOfFile = names[y]+".txt"
FileResultsX = open(NameOfFile,"w")
myOdb = odbAccess.openOdb(path="Job-1.odb")
lastStep = myOdb.steps[nameOfStep]
for z in range(len(lastStep.frames)):
lastFrame = myOdb.steps[nameOfStep].frames[z]
Times=lastFrame.frameValue
U = lastFrame.fieldOutputs["U"]
UR = lastFrame.fieldOutputs["UR"]
UT = lastFrame.fieldOutputs["UT"]
# FileResultsX.write("Node\tUR1\n")
for nodeNumber in range(14,15):
FileResultsX.write("%d\t" % nodeNumber)
for ur in UR.values:
if ur.nodeLabel == nodeNumber:
FileResultsX.write("%10.8E\t" % (ur.data[0]))
myOdb.close()
FileResultsX.close()
Any help will be greatly appreciated