Hi all,
I'm currently scripting a icemcfd analysis with tcl/tk.
At a certain point I need to edit a .dat file (with x and z coordinates). Normal this is easy to achieve however I haven't succeeded yet doing this in tcl/tk.
The .dat file looks as follow:
X1 Z1
X2 Z2
. .
. .
. .
I would like to edit this file in 1 or 2 steps to achieve the following result:
First step: Add the Z-coordinates (all Y are 0)
X1 Y1 Z1
X2 Y2 Z2
. . .
. . .
. . .
Final result should look as follow:
X-colon Y-colon Z-colon
expr[X1+$var] expr[Y1+$var] expr[Z1+$var]
expr[X2+$var] expr[Y2+$var] expr[Z2+$var]
. . .
. . .
. . .
It would be realy nice if afterwards I would still be able to put kind of a note on the first line of this file ("#number"). (This would then tell icemcfd how many points are needed to create curve) So finaly the file should have the following layout:
#Number
X-colon Y-colon Z-colon
expr[X1+$var] expr[Y1+$var] expr[Z1+$var]
expr[X2+$var] expr[Y2+$var] expr[Z2+$var]
. . .
. . .
. . .
I have already read the post on:
However as I already mentioned this didn't solve my problem.
Does anyone know how to achive this?
My idea to solve this was as follow:
The first thing to do is make a matrix of the .dat file.
Than I could edit this matrix and print it back to a .txt or .dat file to save the results.
If I'm not mistaken this would give me the desired result however I haven't succeeded so far.
Who can help me?
Thanks!!!
I'm currently scripting a icemcfd analysis with tcl/tk.
At a certain point I need to edit a .dat file (with x and z coordinates). Normal this is easy to achieve however I haven't succeeded yet doing this in tcl/tk.
The .dat file looks as follow:
X1 Z1
X2 Z2
. .
. .
. .
I would like to edit this file in 1 or 2 steps to achieve the following result:
First step: Add the Z-coordinates (all Y are 0)
X1 Y1 Z1
X2 Y2 Z2
. . .
. . .
. . .
Final result should look as follow:
X-colon Y-colon Z-colon
expr[X1+$var] expr[Y1+$var] expr[Z1+$var]
expr[X2+$var] expr[Y2+$var] expr[Z2+$var]
. . .
. . .
. . .
It would be realy nice if afterwards I would still be able to put kind of a note on the first line of this file ("#number"). (This would then tell icemcfd how many points are needed to create curve) So finaly the file should have the following layout:
#Number
X-colon Y-colon Z-colon
expr[X1+$var] expr[Y1+$var] expr[Z1+$var]
expr[X2+$var] expr[Y2+$var] expr[Z2+$var]
. . .
. . .
. . .
I have already read the post on:
However as I already mentioned this didn't solve my problem.
Does anyone know how to achive this?
My idea to solve this was as follow:
The first thing to do is make a matrix of the .dat file.
Than I could edit this matrix and print it back to a .txt or .dat file to save the results.
If I'm not mistaken this would give me the desired result however I haven't succeeded so far.
Who can help me?
Thanks!!!