hiwiansys
Mechanical
- May 4, 2007
- 23
Hi All,
I have written a simple python program which will help me extract the coordinates and displacement output for only the nodeset I am interested in and writes it into a text file.
Unfortunately it is giving me an error while I run the below program though I have used the right syntax
Error message:
In line 12 (coordinatefield=odb.steps['Step_Load'].frames[1].fieldOutputs['COORD'])
Key Error : 'COORD'
PS: if anyone of you can help me figure out what is wrong in the above code, it will be really helpful.
I thank you in advance
Hoping to hear from some one soon.
-Anjali
PROGRAM:
#-----------------------------OUTPUT.PY-------------------------------------------------------------
# output.py is a python programme which reads the required field output data from an
# output data base and writes it into a text file
#----------------------------------------------------------------------------------------------------------
from odbAccess import *
from textRepr import *
from abaqusConstants import *
import odbAccess
odb=openOdb(path='shear.odb')
n='NODESET1'
first_node=odb.rootAssembly.nodeSets['NODESET1']
coordinatefield=odb.steps['Step_Load'].frames[1].fieldOutputs['COORD']
coord1=coordinatefield.getSubset(region=first_node)
coordvalues1=coord1.values
disp1file=open('disp1.txt','a')
for v in dispvalues1:
disp1file.write(str("NODE=")+str(v.nodeLabel)+"\n")
for v in coordvalues1:
disp1file.write(str("COORDINATES=")+str(v.data[0])+","+str(v.data[1])+","+str(v.data[2])+"\n")
if n == 'NODESET1':
i=1
m=2
while i<=m:
first_node=odb.rootAssembly.nodeSets['NODESET1']
displacementfield=odb.steps['Step_Load'].frames.fieldOutputs['U']
disp1=displacementfield.getSubset(region=first_node)
dispvalues1=disp1.values
#disp1file=open('disp1.txt','a')
for v in dispvalues1:
#disp1file.write(str("NODE"))
#disp1file.write(str(v.nodeLabel)+"\n")
print (v.data[0], v.data[1], v.data[2])
disp1file.write(str("DISPLACEMENTS=")+str(v.data[0])+","+str(v.data[1])+","+str(v.data[2])+"\n")
i+=1
I have written a simple python program which will help me extract the coordinates and displacement output for only the nodeset I am interested in and writes it into a text file.
Unfortunately it is giving me an error while I run the below program though I have used the right syntax
Error message:
In line 12 (coordinatefield=odb.steps['Step_Load'].frames[1].fieldOutputs['COORD'])
Key Error : 'COORD'
PS: if anyone of you can help me figure out what is wrong in the above code, it will be really helpful.
I thank you in advance
Hoping to hear from some one soon.
-Anjali
PROGRAM:
#-----------------------------OUTPUT.PY-------------------------------------------------------------
# output.py is a python programme which reads the required field output data from an
# output data base and writes it into a text file
#----------------------------------------------------------------------------------------------------------
from odbAccess import *
from textRepr import *
from abaqusConstants import *
import odbAccess
odb=openOdb(path='shear.odb')
n='NODESET1'
first_node=odb.rootAssembly.nodeSets['NODESET1']
coordinatefield=odb.steps['Step_Load'].frames[1].fieldOutputs['COORD']
coord1=coordinatefield.getSubset(region=first_node)
coordvalues1=coord1.values
disp1file=open('disp1.txt','a')
for v in dispvalues1:
disp1file.write(str("NODE=")+str(v.nodeLabel)+"\n")
for v in coordvalues1:
disp1file.write(str("COORDINATES=")+str(v.data[0])+","+str(v.data[1])+","+str(v.data[2])+"\n")
if n == 'NODESET1':
i=1
m=2
while i<=m:
first_node=odb.rootAssembly.nodeSets['NODESET1']
displacementfield=odb.steps['Step_Load'].frames.fieldOutputs['U']
disp1=displacementfield.getSubset(region=first_node)
dispvalues1=disp1.values
#disp1file=open('disp1.txt','a')
for v in dispvalues1:
#disp1file.write(str("NODE"))
#disp1file.write(str(v.nodeLabel)+"\n")
print (v.data[0], v.data[1], v.data[2])
disp1file.write(str("DISPLACEMENTS=")+str(v.data[0])+","+str(v.data[1])+","+str(v.data[2])+"\n")
i+=1