CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSYS Meshing & Geometry (https://www.cfd-online.com/Forums/ansys-meshing/)
-   -   [ICEM] Simple tcl/tk script (https://www.cfd-online.com/Forums/ansys-meshing/104414-simple-tcl-tk-script.html)

Far July 9, 2012 07:16

Simple tcl/tk script
 
1 Attachment(s)
I am learning now a days tcl/tk in-order to make the sophisticated scripts for ICEM automation.

As a first step I made few scripts by recording the ICEM sesion and now I am digging more into the tcl.

Here is the first code and you need tcl/tk interpreter tcl/tk download.

Here is code

Quote:

# # is used for making comments
# Set command is used to assign a value to variable
# In following command len is variable and [string length foobar is argument]
#[] are used for command substitution
# string length foobar return the length of the string foobar which is 6
#puts command is used as print command
set len [string length foobar]
puts $len
set len 6
puts $len
set y [expr 7.2/4]
puts $y
set x 7
puts $x
set len [expr [string length foobar]+$x]
puts $len
set pi [expr 2*asin(1.0)]
puts $pi
puts stdout {Hello, World!}
You should use this command on the command prompt tclsh code1.tcl or you can also use tcl shell to run command. In that case there is no need of puts command. Tcl shell can be activated by this command tclsh or tclsh85.

We can discuses in detail regarding each command if some one is interested.

Far July 10, 2012 02:34

Should I keep on adding the tutorials on regular basis in this thread?

BrolY July 10, 2012 05:59

That's a good idea, thanks for that Far ;)

Far July 10, 2012 11:58

So I will keep this thread alive. At some time (may be four to five simple tutorials), we shall do one ICEM tcl script. The advantage would be that we can understand how tcl is being used by ICEM.

My idea is to do the ICEM tcl tutorials after every five to six simple tcl tutorials. Here is the my plan:

To explain data/variable assignment
How to deal data in tcl
how to read the data from user
how to read the data from file
how to dynamically allocate the data
how to handle arrays
how to use if, while, for command for conditional and recursive use
how to create GUI using tk
how to couple C/C++ with tcl

I will do the hard work by reading the book and giving you many examples on each single command so that you can understand what will happen with different combinations of command with different arguments. But I need your participation to make it useful and interesting.

b.shuvayan May 17, 2014 15:36

A tutorial to read user defined information from a .txt file
 
Hey Far!

I just wanted to know if you have something coming up regarding uploading some tutorial related to using TCL/TK language for ICEM CFD automation. I was looking for something which would explain how to readjust mesh or change mesh automatically after reading the user input file (i.e .txt file).

any suggestions???

m zahid September 2, 2014 09:45

hi
 
Hi far
I am interested in TCL/TK language, if you have some basic or advance material e.g. tutorials. Please share in this forum; I think many peoples are interested in TCL/TK language.
Here is my email please email me if you have TCL/TK tutorials.
mziqureshi@hotmail.com
Regards,

harsh1311990 September 18, 2014 21:25

Dear Sir,
as u stated that you will upload some material in this blog but i can not find it. Can you upload it or Can you send me through email? my email id is harsh1311990@gmail.com....
i will really appriate your work and even though i also want to start this knd of work when i will become master in this field.thanking you.i will wait for your reply.

qi dawson January 21, 2015 23:12

compile tcl/tk error
 
hi!

i'm trying to build tcl/tk for windows 7. i did successfully for tcl. however, when i try to compile tk. there is an error as follows,

*** Compiler has 'Optimizations'
*** Compiler does not have 'Pentium 0x0f fix'
*** Linker does not have 'Win98 alignment problem'
rules.vc(522) : fatal error U1050:
Failed to find tcl.h. The TCLDIR macro does not appear correct.
Stop.

how to solve it? thank you....


All times are GMT -4. The time now is 07:32.