明经通道 AutoLISP 函数  
*error*
 

可由用户定义的错误处理函数

(*error* string) 

如果 *error* 不为 nil,则当 AutoLISP 的错误条件出现时,就会执行其中的定义,并由 AutoCAD 传给它一个包含错误信息的字符串作为参数。

用户 *error* 函数可以不带参数调用 command 函数(如 (command))。这样可以取消前面由 command 函数执行的 AutoCAD 命令。

返回值

除使用  vl-exit-with-value 外,本函数无返回值。

示例

如下函数与标准 AutoLISP 出错处理执行相同的任务,打印“错误:”和错误信息:

(defun *error* (msg)
  (princ "出错: ")
  (princ msg)
  (princ)
)

参阅

  vl-exit-with-errorvl-exit-with-valuevl-catch-all-applyvl-catch-all-error-messagevl-catch-all-error-p 函数。

明经通道 版权所有 未经许可 不得传播

 评论