General

General

I would like to make my own menu form in order to set values and select items for a Tcl script I have written for ICEM CFD. Looking at the ‘Programmers Guide’ this seems best done building up from a form_init command.

    • FAQFAQ
      Participant

      This can be done with the “form_” functions, but I would probably stay away from them, 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. All the base commands of Tcl/Tk are available within ICEM. Below is an example script which creates one window and selects surfaces. It is meant to be used with ICEM’s GUI loaded. You can save this as “Tcl_gui_example.tcl”, and 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”