ICEPAK FAQ: Writing Macros in Icepak - Getting started


How do I write my own Macros in Icepak?

The macros are written in TCL/TK language. Many of the comonly used utilities for typical Icepak macro writing are available as functions in Icepak.
I am attaching the API Guidelines for these functions. The macro program you create should be called *.tcl. This tcl file should be placed in
Fluent.Inc/Icepak3.2/icepak_lib/macros/ folder. Every time you chage this program you may make the latest version available for you under
model/macros menu. For this, you should go to File/Configure/library path/ menu and click "Done". When you do this, you will notice the latest files
will be loaded (message window will tell you this). However, please note that any changes to the GUI cannot be updated like this. YOu need to quit and
re-launch Icepak.

Following is my "advice" for a kickstart to macro writing:

Download and install all existing macros from Icepak user service center: <a target=_blank href="http://www.icepak.com/prod/icepak/support/login/parts/index.htm">http://www.icepak.com/prod/icepak/support/login/parts/index.htm</a>http://www.icepak.com/prod/icepak/support/login/parts/index.htm
Go over the design and functions of these existing macros.
Identify a macro that closely matches (in functionality or GUI) the macro you are trying to write.
The macro you selected will be in Fluent.Inc/Icepak3.2/icepak_lib/macros/ folder (macro names are usually intuitive)
Rename this macro and start making minor modifications to understand how the macro works. There are certain changes that you must make in the
first few lines of the code to distinguish your macro from the original macro. Following is an example of some of the things you need to do
distinguish your macro and avioid clash of variables. Following are the first few lines from PBGA macro. My comments appear in Bold letters
within followed by ###


#Macro Design & coding: Kamal Karimanal, Fluent Inc.,

set "macro_definition(PBGA)" make_pbga
### 'PBGA' is the macro name. Replace this everywhere since a macro already exists in that name.
### 'make_pbga' is the name of the macro program rename wherever this string appears.
set "macro_subtype(PBGA)" Packages
### 'Packages' is the name of the category under which the PBGA macro is classified in the pull down menu.
### If you replace 'Packages' with 'My-Macros' you will see a new catgory 'My-Macros' under macros menu in Icepak.
proc make_pbga {} {
global pbga_data pbga_data_units macro_directory
### 'pbga_data' and 'pbga_data_units' are names of arrays. You may want to define unique array names.
### Replace these strings everywhere
set w [form_init .pbga "pbga creation (12-11-2001)" model]
### 'pbga creation (12-11-2001)' is the Title that appears on top of your macro GUI screen.
if {$w != ""} {
array set pbga_data {
mode library

xoff 0.0
yoff 0.0
zoff 0.0
.
.
.

Making variants of existing macros and load the new macro every time you make small sets of changes to understand how the macro program is used
by the Icepak software.
Then start building your macro.
Use existing functions in the API as much as possible.
YOu may want to consult books on TCL/TK for syntax.





Show Form
No comments yet. Be the first to add a comment!