CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ANSYS Meshing & Geometry

[ICEM] Simple tcl/tk script

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Far

Reply
 
LinkBack Thread Tools Display Modes
Old   July 9, 2012, 07:16
Default Simple tcl/tk script
  #1
Far
Super Moderator
 
Sijal
Join Date: Mar 2009
Location: Islamabad
Posts: 4,285
Blog Entries: 6
Rep Power: 43
Far will become famous soon enoughFar will become famous soon enough
Send a message via Skype™ to Far
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.
Attached Files
File Type: zip tcl_firstcode.zip (239 Bytes, 27 views)
tinhtt likes this.
Far is offline   Reply With Quote

Old   July 10, 2012, 02:34
Default
  #2
Far
Super Moderator
 
Sijal
Join Date: Mar 2009
Location: Islamabad
Posts: 4,285
Blog Entries: 6
Rep Power: 43
Far will become famous soon enoughFar will become famous soon enough
Send a message via Skype™ to Far
Should I keep on adding the tutorials on regular basis in this thread?
Far is offline   Reply With Quote

Old   July 10, 2012, 05:59
Default
  #3
Senior Member
 
AB
Join Date: Sep 2009
Location: France
Posts: 323
Rep Power: 14
BrolY will become famous soon enough
That's a good idea, thanks for that Far
BrolY is offline   Reply With Quote

Old   July 10, 2012, 11:58
Default
  #4
Far
Super Moderator
 
Sijal
Join Date: Mar 2009
Location: Islamabad
Posts: 4,285
Blog Entries: 6
Rep Power: 43
Far will become famous soon enoughFar will become famous soon enough
Send a message via Skype™ to Far
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.
Far is offline   Reply With Quote

Old   May 17, 2014, 15:36
Default A tutorial to read user defined information from a .txt file
  #5
Member
 
Shuvayan Brahmachary
Join Date: Oct 2012
Posts: 34
Rep Power: 5
b.shuvayan is on a distinguished road
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???
b.shuvayan is offline   Reply With Quote

Old   September 2, 2014, 09:45
Default hi
  #6
Member
 
Qureshi M Z I
Join Date: Sep 2013
Posts: 74
Rep Power: 5
m zahid is on a distinguished road
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,
m zahid is offline   Reply With Quote

Old   September 18, 2014, 21:25
Default
  #7
New Member
 
North Rhein Westfalen
Join Date: May 2014
Posts: 3
Rep Power: 4
harsh1311990 is on a distinguished road
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.
harsh1311990 is offline   Reply With Quote

Old   January 22, 2015, 00:12
Default compile tcl/tk error
  #8
New Member
 
Qi Dawson
Join Date: Jan 2015
Posts: 1
Rep Power: 0
qi dawson is on a distinguished road
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....
qi dawson is offline   Reply With Quote

Reply

Tags
automation, icem, scripting, tcl

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SIMPLE algorithm in 3D cylindrical coordinates zouchu Main CFD Forum 1 January 20, 2014 18:02
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 09:36
CFX mesh script error Malik77 CFX 0 June 24, 2011 07:42
Perl script for intialisation pratik mehta CFX 2 September 10, 2008 03:09
PISO vs. SIMPLE benedikt flurl Main CFD Forum 2 April 14, 2005 06:54


All times are GMT -4. The time now is 01:21.