Next: , Previous: Options, Up: Top


9 Interactive mode

Interactive mode is entered by executing the command asy with no file arguments. Each line must be a complete Asymptote statement; however, it is not necessary to terminate each line with a semicolon.

The following special commands are supported only in interactive mode and must be entered immediately after the prompt:

help
view the manual
reset
reset Asymptote to its initial state, except for changes to the settings module (see settings).
input FILE
resets the environment (except for breakpoints; see Debugger) and does an erase(); include FILE. If the file name FILE contains nonalphanumeric characters, enclose it with quotation marks. For convenience, a trailing semi-colon followed by optional Asymptote commands may be entered on the same line.
quit
exit interactive mode (abbreviated as q; exit is a synonym). A history of the most recent 1000 (can be changed with the historylines command-line option) previous commands will be retained in the file .asy/history in the user's home directory (unless the command line option -localhistory was specified, in which case the history will be stored in the file .asy_history in the current directory).

Typing ctrl-C interrupts the execution of Asymptote code and returns control to the interactive prompt.

Interactive mode is implemented with the GNU readline library, with command history and auto-completion. To customize the key bindings, see: http://cnswww.cns.cwru.edu/php/chet/readline/readline.html

The file asymptote.py in the Asymptote system directory provides an alternative way of entering Asymptote commands interactively, coupled with the full power of Python. Copy this file to your Python path and then execute from within Python the commands

from asymptote import *
g=asy()
g.size(200)
g.draw("unitcircle")
g.send("draw(unitsquare)")
g.fill("unitsquare, blue")
g.clip("unitcircle")
g.label("\"$O$\", (0,0), SW")