[ANSYS, Inc. Logo] return to home search
next up previous contents index

3.5 Text Menu Input from Character Strings

Often, when writing a Scheme extension function for ANSYS FLUENT, 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 mesh 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 could also be written without using menu commands at all, 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-mesh)
   (cx-restore-view view))
 '(1 2) '(front back))

String input can also provide an easy way to create aliases within ANSYS FLUENT. For example, to create an alias that will display the mesh, you could 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 mesh will be drawn in the active window.

figure   

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-load-string.

As a result, 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 mesh")


next up previous contents index Previous: 3.4.2 System Commands for
Up: 3. Text User Interface
Next: 3.6 Using the Text
Release 12.0 © ANSYS, Inc. 2009-01-29