Script to Create new ODB with selected results
Script to Create new ODB with selected results
(OP)
Hi all,
I've got a rather large abaqus 6.9.1 model with a random response analysis.
I do not have CAE, and the pre/post processor that I do have (NX 7.5 or I-DEAS 6) will not recognize the output variables from the output decks (RS, RE, RU, etc).
I'm wondering if it would be possible to rewrite the RS, RE, RU results from each frame into a new ODB file as S, E, U so that my pre/post processor will read them.
I've got some of the simple Python examples working that are contained in the documentation, but I can't get the results written into the new odb file. I keep getting errors on the uFile.addData( ) line.
I'm trying to follow the procedures in 9.5, 9.6, and 9.10.2 of the Scripting User's Manual.
Any help wold be appreciated, also, if there's an easier way I'd like to hear your suggestions.
Thanks.
I've got a rather large abaqus 6.9.1 model with a random response analysis.
I do not have CAE, and the pre/post processor that I do have (NX 7.5 or I-DEAS 6) will not recognize the output variables from the output decks (RS, RE, RU, etc).
I'm wondering if it would be possible to rewrite the RS, RE, RU results from each frame into a new ODB file as S, E, U so that my pre/post processor will read them.
I've got some of the simple Python examples working that are contained in the documentation, but I can't get the results written into the new odb file. I keep getting errors on the uFile.addData( ) line.
I'm trying to follow the procedures in 9.5, 9.6, and 9.10.2 of the Scripting User's Manual.
Any help wold be appreciated, also, if there's an easier way I'd like to hear your suggestions.
Thanks.





RE: Script to Create new ODB with selected results
It appears to work when looking at the console window, but my pre/post processor doesn't recognize that an additional step has been added.
Do I need to change something else in the ODB file for this? I'm not sure why the new step isn't seen when importing the new ODB file.
The "first ODB file" in the code below refers to the file with the random results, the "second ODB file" is the same model, but with just a 1g static load applied. I'm moving the RMS data to the 1G file just to have a smaller ODB to import when I'm done.
Thanks.
=======================
## Open First ODB File:
print '-'
print '-First ODB File: '
print '----------------'
##odbName=raw_input('Enter ODB File Name: ') ## (uncomment for user input)
##odbRandom=openOdb(path=odbName) ## (uncomment for user input)
odbRandom=openOdb(path="MDExample.odb")
## Print Step Names:
print '-'
print '-Steps:'
for stepName in odbRandom.steps.keys():
print ' ', stepName
print '-'
## Set Active Step:
##
##stepName=raw_input('Enter Step Name: ') ## (uncomment for user input)
##stepRandom=odbRandom.steps[stepName] ## (uncomment for user input)
stepRandom=odbRandom.steps['RandomDOF2']
print ' Selected Step = ', stepRandom.name
## Print Number of Frames:
numberOfFrames=len(stepRandom.frames)
print ' Number of Frames = ', numberOfFrames-1
## Set Active Frame:
frameRandom=stepRandom.frames[-1] ## automatically select last frame
print ' Selected Frame = ', frameRandom.frameId
## Load Results:
print '-'
print ' Results Found: '
for fieldName in frameRandom.fieldOutputs.keys():
print ' ', fieldName
##odbSelectResultsName=raw_input('Enter Results Name: ') ## (uncomment for user input)
##odbSelectResults=openOdb(path=odbSelectResultsName) ## (uncomment for user input)
odbSelectResults=frameRandom.fieldOutputs['RS']
print '-'
print ' Selected Results = ', odbSelectResults.name
##for s in odbSelectResults.values: ## Test to see data entries
## print s.elementLabel, s.data
## Open Second ODB File:
print '-'
print '-Second ODB File: '
print '-----------------'
##odbName=raw_input('Enter ODB File Name: ') ## (uncomment for user input)
##odbRandom=openOdb(path=odbName) ## (uncomment for user input)
odbWrite=openOdb(path="MDExample_1G.odb")
## Print Step Names:
print '-'
print '-Steps:'
for stepName in odbWrite.steps.keys():
print ' ', stepName
print '-'
## Set Active Step:
##
##stepName=raw_input('Enter Step Name: ') ## (uncomment for user input)
##stepRandom=odbRandom.steps[stepName] ## (uncomment for user input)
stepWrite=odbWrite.steps['StaticLoad']
print ' Selected Step = ', stepWrite.name
## Print Number of Frames:
numberOfFrames=len(stepWrite.frames)
print ' Number of Frames = ', numberOfFrames-1
## Set Active Frame:
frameWrite=stepWrite.frames[-1] ## automatically select last frame
print ' Selected Frame = ', frameWrite.frameId
## Load Results:
print '-'
print ' Results Found: '
for fieldName in frameWrite.fieldOutputs.keys():
print ' ', fieldName
##odbSelectResultsName=raw_input('Enter Results Name: ') ## (uncomment for user input)
##odbSelectResults=openOdb(path=odbSelectResultsName) ## (uncomment for user input)
odbWriteResults=frameWrite.fieldOutputs['S']
print '-'
print ' Selected Results = ', odbWriteResults.name
#for s in odbWriteResults.values: ## test to see data entries
# print s.elementLabel, s.data
## Combine Results:
newDataSet=odbSelectResults+odbWriteResults
## Save New Field:
newResultsStep=odbWrite.Step(name='Test',
description='User Defined Results',
domain=TIME,
timePeriod=0)
newResultsFrame=newResultsStep.Frame(incrementNumber=0,
frameValue=0.0)
newResultsField=newResultsFrame.FieldOutput(name='S',
description='User Defined Results',
type=TENSOR_3D_PLANAR)
newResultsField.addData(field=newDataSet)
odbWrite.save()
## Verify New Step is Written and Data is Entered:
##print '-'
##print '-Steps:'
##for stepName in odbWrite.steps.keys():
## print ' ', stepName
##print '-'
##print '-'
##print ' Results Found: '
##for fieldName in odbWrite.steps['Test'].frames[-1].fieldOutputs.keys():
## print ' ', fieldName
##for s in odbWrite.steps['Test'].frames[-1].fieldOutputs['S'].values:
## print s.elementLabel, s.data
## Close ODB files:
odbRandom.close()
odbWrite.close()