prompt function displays a message (a string) in the AutoCAD Command window and returns nil to the VLISP Console window. The princ, prin1, and print functions all display an expression (not necessarily a string) in the AutoCAD Command window and return the expression to the VLISP Console window. Optionally, these functions can send output to a file. The differences are as follows:
When entered from VLISP, theControl Characters in Strings for an explanation of the control characters used in the example.
The following examples demonstrate the differences between the four basic output functions and how they handle the same string of text. If you enter the examples from VLISP, the text following prints is what you see at the AutoCAD Command prompt; text following returns appears within the VLISP Console window or within an application. See(setq str "The \"allowable\" tolerance is \261 \274\"")
(prompt str) printsThe "allowable" tolerance is1/4"
and returns nil
(princ str) printsThe "allowable" tolerance is1/4"
and returns "The \"allowable\" tolerance is 1/4\""
(prin1 str) prints"The \"allowable\" tolerance is1/4""
and returns "The \"allowable\" tolerance is 1/4\""
(print str) prints<blank line>
"The \"allowable\" tolerance is1/4""<space>
and returns "The \"allowable\" tolerance is 1/4\""
write-char and write-line functions can also display output to a Command window. Refer to the AutoLISP Reference for information on these functions.
Note that the