manpagez: man pages & more
info asymptote
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9. Interactive mode

Interactive mode is entered by executing the command asy with no file arguments. When the -multiline option is disabled (the default), each line must be a complete Asymptote statement (unless explicitly continued by a final backslash character \); it is not necessary to terminate input lines with a semicolon. If one assigns settings.multiline=true, interactive code can be entered over multiple lines; in this mode, the automatic termination of interactive input lines by a semicolon is inhibited. Multiline mode is useful for cutting and pasting Asymptote code directly into the interactive input buffer.

Interactive mode can be conveniently used as a calculator: expressions entered at the interactive prompt (for which a corresponding write function exists) are automatically evaluated and written to stdout.

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

help

view the manual;

reset

reset the Asymptote environment to its initial state, except for changes to the settings module (see settings), the current directory (see cd), and breakpoints (see section Debugger);

input FILE

does an interactive reset, followed by the command include FILE. If the file name FILE contains nonalphanumeric characters, enclose it with quotation marks. A trailing semi-colon followed by optional Asymptote commands may be entered on the same line.

quit

exit interactive mode (exit is a synonym; the abbreviation q is also accepted unless there exists a top-level variable named q). A history of the most recent 1000 (this number can be changed with the historylines configuration variable) 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")

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.