Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

ADPL, editing a textfile from within a macro

Status
Not open for further replies.

JGoeransson

Mechanical
Nov 25, 2010
2
Hello.

I have a problem I can't seem to find a proper solution too.
I have a number of different structures to analyse, each structure have between 3 and 5 different loads (by which I mean I have structural loads on 3 to 5 separate places at once, on each structure) as well as several different loadcases for each structure. This amasses to a very large number of analyses and manually scripting the different loadings and postprocessing them is not a viable solution. So I want to write some code in order to automatically read all my loads from the stand-alone textfile containing all the loads from within my macro. By doing that I can let all the analyzes run by themselves without me needing to interfere.

These are the problems I have encountered:
1. Only one way to read text from an outside textfile (to the best of my knowledge): *SREAD. Which has a limit of 128 character long strings. This means that some data is left out when performing the read.
2. I can't find a way to delete the useless characters (which are predetermined in locations and lenght, inside the textfile) after I have opened the textfile (I presume that I can use *CFOPEN to open my textfile with load data).

So, my question/-s is simple I suppose:

Can I open a textfile with some command and edit it? I.e deleting characters in certain places?

Alternatively:

Can I read strings or characters from predefined places in a stand-alone textfile?

Best regards

Joakim Göransson
 
Replies continue below

Recommended for you

I would suggest having numerous scripting files:

1) Defining Parametrics
2) Building the geometry
3) Apply loads and write load cases (LSWRITE)
4) Solving (LSSOLVE)
5) Post processing

These can be called up in any order and as many times as you wish using the /INPUT command in a 'master file'.

If needs be, parameters (loads and positions) can be put in arrays, and called up in some form of loop.

Hope this helps.
 
I am not sure if this is what you are looking for, but,

* you can edit and create any input file with any ascii editor. I use HIGH-lighter FEM version 1.7, which recognises Ansys commands. I don't remember where I got it, but You'll find it.

* From Ansys you can input the entire text with the /input command.

* Input files can be nested. Make sure you end each input file with /eof.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor