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 File

Status
Not open for further replies.

hiwiansys

Mechanical
May 4, 2007
23
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.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





 
Replies continue below

Recommended for you

You should try

first_set=odb.rootAssembly.instances['CYLINDER-1_1'].nodeSets['nodeset1']
 
Hi,

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
 
Hi xerf,

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
 
Have you tried to check to type of first_set ?

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

Part and Inventory Search

Sponsor