CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 文档中心

*弹出错误模式*(AutoLISP)

2023-1-7 22:57| 发布者: admin| 查看: 213| 评论: 0|来自: AutoCAD

摘要: 错误处理函数,用于结束对 *push-error-using-command* 或 *push-error-using-stack* 的上一个调用

结束上一个调用 toor 的错误处理函数*push-error-using-command**push-error-using-stack*

支持的平台:视窗和 Mac OS

签名

(*pop-error-mode*)

没有参数。

返回值

类型:T

返回的值 ofis。T

言论

在将自定义处理程序函数替换为先前定义的处理程序后,应调用 to。*pop-error-mode**error**error*

注意:在处理程序中使用函数时不需要此函数。command-s*error*

例子

下面的示例演示函数的用法。*pop-error-mode*

(defun my_err (err_msg)
    (if (/= err_msg "Function cancelled")
      (prompt (strcat "\nError: " err_msg))
    )
    (command "._undo" "_e")
    (command "._U")
    (setq *error* olderr)
  (princ)
)

(defun myUtil (key / )
    (setq olderr *error*
          *error* my_err)
    (*push-error-using-command*)         ; Indicate use of the command function instead of command-s
                                         ; in a custom error handler

    (command "._undo" "_group")          ; The following will not be executed in this sample, but is good 
                                         ; framework for setting up your own error handlers
  
    (/ 1 0)                              ; Call a function with incorrect values to trigger the custom error handler
                                         ; Remove when setting up your code
   
    ;; Perform your tasks here

    (command "._undo" "_e")
    (setq *error* olderr)                ; Restore old *error* handler
    (*pop-error-mode*)                   ; End the use of *push-error-using-command*
)

加载示例代码后,在命令提示符下输入(myutil“字符串”)以输入错误处理程序。


路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 13:58

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部