Abaqus Scripting interface
Abaqus Scripting interface
(OP)
Hello,
I needed some help in the Abaqus scripting interface. I have a .py file
from odbAccess import *
from string import *
odb = openOdb('Analysis.odb')
FirstLoadStep = odb.steps['Rise']
print 'First Load Step',FirstLoadStep
lastFrame = FirstLoadStep.frames[-1]
#print 'lastFrame',lastFrame
#print 'AVailable output',lastFrame.fieldOutputs
tempData = lastFrame.fieldOutputs['TEMP']
print tempData
elementData=[]
for val in tempData.value:
#print val.data
#elementLabel=0
if val.data >=1500:
print 'max Element',val.elementLabel
This script lets me print the values of all elements from the last frame which have a temperature greater than 1500. I would like to write these elements out to a file. (preferably a .inp file) How do I do that.
Kindly help.
Thanks
Ankur
I needed some help in the Abaqus scripting interface. I have a .py file
from odbAccess import *
from string import *
odb = openOdb('Analysis.odb')
FirstLoadStep = odb.steps['Rise']
print 'First Load Step',FirstLoadStep
lastFrame = FirstLoadStep.frames[-1]
#print 'lastFrame',lastFrame
#print 'AVailable output',lastFrame.fieldOutputs
tempData = lastFrame.fieldOutputs['TEMP']
print tempData
elementData=[]
for val in tempData.value:
#print val.data
#elementLabel=0
if val.data >=1500:
print 'max Element',val.elementLabel
This script lets me print the values of all elements from the last frame which have a temperature greater than 1500. I would like to write these elements out to a file. (preferably a .inp file) How do I do that.
Kindly help.
Thanks
Ankur





RE: Abaqus Scripting interface
fObj=open("myFile.inp","w")
......
if val.data >=1500:
print 'max Element',val.elementLabel
# format your output string here ...
# example... lineString=str(val.elementLabel)+"\n"
fObj.write(lineString)
....
fObj.close()
-if you want to insert elem labels into an existing .inp file at a certain location ..probably you will need to use an aditional list of strings , each string containing the existing lines in the initial .inp file.
-then insert the labels of element (or whatever you need) in the string list.
-after you finish all the insertions
overwrite the .inp file by writing each string in the list.
it's simple