« Return to Thread: Python Script For Result Extracting from Multiple Odb Files

Python Script For Result Extracting from Multiple Odb Files

by Esun :: Rate this Message:

| View in Thread

Dear All,

I have been trying to extract certain unique nodal outputs, namely U2 and F2 from multiple ODB files.
I have written the following code in python:

'Please find attached file pertaining the code with the appropriate indentation'

from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=122.440704345703,
height=214.188812255859)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()

from viewerModules import *
for i in range(2, 10):
 odbfile = 'C:/UpdatedODB/' + str(i) +'.odb'
 o2 = session.openOdb(name=odbfile, readOnly=True)
 session.viewports['Viewport: 1'].setValues(displayedObject=o2)
 odb = session.odbs[odbfile]
 x0=session.xyDataListFromField(odb=odb, outputPosition=NODAL, variable=(('RF', NODAL, ((COMPONENT, 'RF2'), )), ('U', NODAL, ((COMPONENT, 'U2'), )), ), nodePick=(('PUNCH-1', 1, ('[#800000 ]', )), ), )
 x0 = session.xyDataObjects['RF:RF2 PI: PUNCH-1 N: 24']
 x1 = session.xyDataObjects['U:U2 PI: PUNCH-1 N: 24']
 session.xyReportOptions.setValues(layout=SINGLE_TA BLE)
 session.writeXYReport(fileName='Results.rpt', xyData=(x0, x1))
 odb.close()data.txt


To be honest the code works like a charm up to the writing stage as all the outputs are produced in the Abqus.
Having said that, for some reason it keeps writing the first set of results in the output file for 9 times rather than producing the 9 sets of U2&F2 !!!

I would really be grateful if someone could tell me where the problem is.

Thanks a lot in advance.
Ehsan

 « Return to Thread: Python Script For Result Extracting from Multiple Odb Files