ABAQUS Scripting File
ABAQUS Scripting File
(OP)
Hi All,
I have written a simple python program which will help me extract the 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: File "output.py", line 13, in ?
disp=displacementfield.getSubset(region=first_set)
TypeError: region; found tuple, expecting OdbInstance
"Program"
# output.py" is a programme which reads the required filed 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=10
i=0
while (i<=n):
first_set=odb.rootAssembly.instances['CYLINDER-1_1'].nodeSets.keys('nodeset1')
displacementfield=odb.steps['Step_Load'].frames[i].fieldOutputs['U']
disp=displacementfield.getSubset(region=first_set)
dispvalues=disp.values
for v in dispvalues:
print v.data[0],v.data[1],v.data[2]
dispfile=open('disp.txt','w')
dispfile.Write(v.data[0],v.data[1],v.data[2])
disp.save()
disp.close()
odb.close()
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
I have written a simple python program which will help me extract the 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: File "output.py", line 13, in ?
disp=displacementfield.getSubset(region=first_set)
TypeError: region; found tuple, expecting OdbInstance
"Program"
# output.py" is a programme which reads the required filed 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=10
i=0
while (i<=n):
first_set=odb.rootAssembly.instances['CYLINDER-1_1'].nodeSets.keys('nodeset1')
displacementfield=odb.steps['Step_Load'].frames[i].fieldOutputs['U']
disp=displacementfield.getSubset(region=first_set)
dispvalues=disp.values
for v in dispvalues:
print v.data[0],v.data[1],v.data[2]
dispfile=open('disp.txt','w')
dispfile.Write(v.data[0],v.data[1],v.data[2])
disp.save()
disp.close()
odb.close()
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





RE: ABAQUS Scripting File
first_set=odb.rootAssembly.instances['CYLINDER-1_1'].nodeSets['nodeset1']
RE: ABAQUS Scripting File
Thank you for the reply. WEll The error msg is for the line :disp=displacementfield.getSubset(region=first_set). The previous line which points to the "nodeset1" works fine with nodesets.keys('nodeset1') syntax where in it didnt work with nodesets['nodeset1'] syntax.
I dont know why it says found a tuple , expected an odb instance.
Regards
Anjali
RE: ABAQUS Scripting File
Thank you for the reply. WEll The error msg is for the line :disp=displacementfield.getSubset(region=first_set). The previous line which points to the "nodeset1" works fine with nodesets.keys('nodeset1') syntax where in it didnt work with nodesets['nodeset1'] syntax.
I dont know why it says found a tuple , expected an odb instance.
Regards
Anjali
RE: ABAQUS Scripting File
The access to the odbSet objects is:
session.odbs[name].rootAssembly.instances[name].nodeSets[name]
For details, see ABAQUS Scripting Reference Manual.
There are some potential other mistakes I noticed in the code:
1. the counter i is not increased in the loop while (i<=n):
therefore you have an infinite loop
2. dispfile.Write(v.data[0],v.data[1],v.data[2])
The file method is write(string).
3. ????
disp.save()
disp.close()
Best.