Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations The Obturator on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Python code for importing data from .txt file into ABAQUS

Status
Not open for further replies.

OverWorked453

New member
Feb 15, 2013
12
I am trying to write a python script for a parametric study in ABAQUS. Part of this involves importing data from other .txt files into the amplitudes of my loads (the tabular amplitude in ABAQUS). How do I write this in my python code? In other words, how do I write a python code that imports data from a .txt file into the tabualr amplitude in ABAQUS? IS there a simple commad for this?

The amplitude will change for different types of simulations I run (i.e., the data in the .txt file that I import the data from will change slightly for different scenarios). Therefore, it is important that the python code is able to import this data into the tabular amplitude in ABAQUS, because manually copying the data is not an option.



Thanks
 
Replies continue below

Recommended for you

Depends on the formatting of your .txt files.
you can do
f = open('workfile', 'w')
values=f.read() # read the complete file
values=f.readline() #read one line, loop over it to get them all

Then you get a string, probably you will need to do a split(',') or '\t' to get a list of values, still in string format but a float(x) can fix that.
Then, you reorder your values until you have the needed sequence of pairs of Floats specifying time/frequency and amplitude pairs to input into the TabularAmplitude(...).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor