When writing a Scheme extension function for ANSYS Fluent Meshing, it is convenient to be able to include menu commands in the function. This can be done with ti-menu-load-string. For example, to open graphics window 2, use:
(ti-menu-load-string "di ow 2")
A Scheme loop that will open windows 1 and 2 and display the front view of the grid in window 1 and the back view in window 2 is given by
(for-each (lambda (window view) (ti-menu-load-string (format #f "di ow ~a gr view rv ~a" window view))) ’(1 2) ’(front back))
This loop makes use of the format function to construct the string used by menu-load-string. This simple loop can also be written without using menu commands, but you need to know the Scheme functions that get executed by the menu commands to do it:
(for-each (lambda (window view) (cx-open-window window) (display-grid) (cx-restore-view view)) ’(1 2) ’(front back))
String input can also provide an easy way to create aliases within ANSYS Fluent Meshing. For example, to create an alias that will display the grid, you can type the following:
(alias ’dg (lambda () (ti-menu-load-string "/di gr")))
Then any time you enter dg from anywhere in the menu hierarchy, the grid will be drawn in the active window.
Important: ti-menu-load-string evaluates the string argument in the top level menu. It ignores any menu you may be in when you invoke ti-menu-loadstring. Therefore, the command
(ti-menu-load-string "open-window 2 gr") ; incorrect usage
will not work even if you type it from within the display/ menu. The string itself must cause control to enter the display/ menu, as in
(ti-menu-load-string "display open-window 2 grid")