I have written basic Tcl scripts for meshing/smoothing/exporting our meshes to minimize user interaction in the process. I am now looking to generalize these a bit by putting a GUI on the front end that I can input tetin name/location, whether to tet>hex, how to smooth, what name/location to output to.

Looking at the 'Programmers Guide' this seems best done building up from a form_init command. This seems quite specific to ICEM's Tcl launguage and thus I cannot find any examples of it on the net.

Please can you send me some examples for scripts that build up forms and act on their entries. Also if you can point me in the direction of any useful sites that will be much appreciated


I would probably stay away from all the form_ procedures, since they are really done in the older GUI style, and if you create your own Tk widgets, you can then run ICEM in batch, but use only your windows without loading the main ICEM window. Then you can do everything with all the basic Tcl/Tk commands. By the way, all the base commands of Tcl/Tk are available with ICEM.
I`ve attached an example script which creates one window and selects surfaces. It is meant to be used with ICEM`s GUI loaded. Just type `source Tcl_gui_example.tcl` in the ICEM message window with this script in the working directory.



proc create_top_window {w} {
toplevel $w
wm title $w "ICEM CFD Script ($w)"
button $w.surfs -text "Select" -command "set ${w}_surfs [geo_select surface]"
entry $w.ent -textvariable ${w}_surfs
label $w.surfs_label -text "Surfaces"
set endb [frame $w.end_buttons -bd 0]
button $endb.apply -text "Apply" -command "do_proc [set ${w}_surfs]"
button $endb.done -text "Done" -command "destroy $w"
grid $w.surfs_label $w.ent $w.surfs -sticky we -padx 2 -pady 2
grid $endb.apply $endb.done -padx 2
grid $endb - - -sticky we -pady 2
grid columnconfigure $w 1 -weight 1
}

proc do_proc {surfaces} {
# This procedure performs the action
mess "selected surfaces: $surfacesn"
}

# This line sets everything going when the script is sourced
create_top_window .icem_win1
# Multiple windows can be created with a different window, such as "create_top_window .icem_win2"





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