*push-error-using-command* (AutoLISP)
错误处理函数,指示在自定义处理程序中使用该函数command*error* 支持的平台:Windows 和 Mac OS 签名(*push-error-using-command*) 没有参数。 返回值类型:T 返回值 。T 言论在定义包含该函数用法的自定义处理程序函数后,应进行调用。*push-error-using-command**error*command 使用 时,只能访问全局变量,而不能访问从自定义处理程序中发生错误的函数中定义的局部变量。如果需要访问局部变量,请将函数的任何实例替换为函数并改为调用。*push-error-using-command**error*commandcommand-s*push-error-using-stack*
注意:在本地自定义处理程序中使用该函数时,不能使用此函数。command*error*
例子下面的示例演示了该函数的用法。*push-error-using-command* (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 Command function instead of Command-s
; in the 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 “String”) 以输入错误处理程序。 相关概念 |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-1 10:00
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.