So you have text output from some ANSYS analysis and you wish you could just do this:
cat lift.txt cop.txt drag.txt >> results.txt
and you are writing an ANSYS macro and want it to run on all platforms. The following macro will use APDL commands to join the files together.
macro1.mac
/inquire,linesin1,lines,lift,txt
*sread,str1array,lift,txt,,80,,linesin1
/inquire,linesin2,lines,cop,txt
*sread,str2array,cop,txt,,80,,linesin2
/inquire,linesin3,lines,drag,txt
*sread,str3array,drag,txt,,80,,linesin3
*cfopen,results,txt
*vlen,linesin1
*vwrite,str1array(1)
%80S
*vlen,linesin2
*vwrite,str2array(1)
%80S
*vlen,linesin3
*vwrite,str3array(1)
%80S
*cfclose
Bonus: If you want to strip some lines off of the top or read less than all the lines, you can pass additional arguments to *sread:
/inquire,linesin1,lines,lift,txt
Lines_skip=5
Lines_read=linesin1-lines_skip
*sread,str1array,lift,txt,,80,lines_skip,lines_read

You must log in to post a comment.