Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Abaqus Scripting interface 1

Status
Not open for further replies.

ankurnaik

Mechanical
Jun 28, 2005
8
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
 
Replies continue below

Recommended for you

.inp file is a text file can use:

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 :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor