×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Python script for importing amplitude data - problems with script

Python script for importing amplitude data - problems with script

Python script for importing amplitude data - problems with script

(OP)
I am trying to write a very quick python script that imports amplitude data from a .txt file at a different location. I have zero experience with python and could really use some help. Below is the (very small) python code.

# -*- coding: mbcs -*-
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
from sys import path
path.append('D:\New Folder\Config2_Automated')
mdb.models['Model-1'].TabularAmplitude(name='Amp-1',input=TopLeg_TopJoint_FxQ2.txt, smooth=SOLVER_DEFAULT, timeSpan=STEP)



I get the following error:

NameError: name 'TopLeg_TopJoint_FxQ2' is not defined



So basically, I want to simply import the .txt file into my ABAQUS model, as an amplitude. Since the file is located elsewhere, I tried to write a path. However, my path must still not work because I get the error that my .txt file is not defined. Any suggestions? What does the error mean and how do I get ABAQUS/python to recognize the .txt file??

Thanks!



RE: Python script for importing amplitude data - problems with script

TopLeg_TopJoint_FxQ2 is a variable (which you haven't defined)
use ' ' to make it into a string
'TopLeg_TopJoint_FxQ2.txt'

Easiest is just to do what you want in CAE, and look up abaqus.rpy to see to what python commands it translates

RE: Python script for importing amplitude data - problems with script

(OP)
sdebock -thanks, I appreciate the helpful reply.

Unfortunately that does not work either. Also, using the corresponding CAE file does not give me the code I want. Basically, I want to automate a process that imports data from a given .txt file to abaqus for numerous iterations. This should not be hard, but I am having problems. I can do it manually in CAE by going to the amplitude, clicking tabular, right clicking the cells, and selecting 'read from file'. I then find the file I want to import and select it. The problem in the corrosponding .rpy file is that scripts shows that amplitude as if it were entered manually. Since I intend for the amplitude to change for different iterations, I need abaqus to be able to import the data. Alos, doing this manually will take to long, so it must be inbedded into the scripts.

I have also tried using the .inp file with the code

*AMPLITUDE, NAME=name, INPUT=file_name

but this is not working either! The job fails and I get the following message:

All data lines on *amplitude, definition=tabular, excepting the last data line, must have exactly four data pairs (eight entries) or one single data pair (two entries). Please check the data lines for *amplitude.

My .txt file is simply two columns of data, each having the same amount of points. I really could use some help here! I just need to automate the process, so putting the command in either the .inp files for the jobs in in a python command are fine. I just cannot do it manually in CAE.






Summary:
-I want to be able to import data to the tabular amplitude feature in ABAQUS. I want the process to be automatic, so I do not have to do it manually each time
-I cannot just import the data in CAE and use the corrosponding .rpy file. THis is because when I go thru the process in CAE, the corresponding .rpy file just shows the tabular amplitude data as if it were entered manually in CAE, not imported from an external file like it needs to be.
-I have tried 2 methods each descibed previously: 1) creating a python code. 2) importing it in the .inp file. Both methods yield errors for me.


I would really appreciate some help!
THanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources