如何进行错误处理?
<P> 为了操作时返回方便,我通常在程序中加入</P><P> (command "undo" "be")</P>
<P> 和</P>
<P> (command "undo" "e").但如果程序在运行过程中中断,就要特别运行一下undo命令undo命令才能用.</P>
<P> 请教各路英雄如何进行这种类型的错误处理</P> 大不了自定义*error*函数 能不能来个例子啊,谢谢了 <P>看看下面的程序是否是你想要的。</P>
<P>(defun c:mal ()<BR> (defun BZERR (st)<BR> (command "undo" "")<BR> (setq *error* olderr)<BR> (princ)<BR> )<BR> (setq olderr *error*<BR> *error* BZERR<BR> oldcmd (getvar "cmdecho")<BR> )<BR> (setvar "cmdecho" 0)<BR> (command "undo" "be")<BR> (while (and (setq pt1 (getpoint "\nFirst point:"))<BR> (setq pt2 (getpoint pt1 "\nSecond point:"))<BR> )<BR> (command "line" pt1 pt2 "")<BR> )<BR> (command "undo" "e")<BR> (setq *error* olderr)<BR> (setvar "cmdecho" oldcmd)<BR> (princ)<BR>)</P> 楼上的还是不错,但我希望是按ESC键后要自动运行的程序,而不需要专门重新输入命令才能恢复系统变量 <P>将你需要恢复的系统变量加到错误处理函数中就好了。</P>
页:
[1]