求教!强制取消命令时如何返回世界坐标系
(defun err(msg)(setvar "osmode" osmode)
(command "UCS" "W")
(princ msg)
)
(setq *error* err)我在程序中临时旋转了坐标系、想在强制中断命令后自动恢复到世界坐标系、
用上面的代码行不通、想求教一下各位大神有没有更好的方法
这样应该可以:
(defun *error* ( msg )
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
(progn (princ (strcat "\n错误:" msg)) (setvar "osmode" osmode) (command "UCS" "W")))
(princ)
) 本帖最后由 guosheyang 于 2022-10-31 15:35 编辑
测试下这个顺利执行还是强制esc都可以返回wcs了
(defun c:test ( / *error* )
(defun *error* ( msg )
(if(=(getvar'WORLDUCS)0)(command-s "ucs" ""))
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ (strcat "\nError: " msg))
)
(princ)
)
(command-s "ucs" 3 "pause""pause""pause")
(rtos (getreal "\n 输入实数或按esc键退出或enter键强制产生错误"))
(command-s "ucs" "")
(princ)
) guosheyang 发表于 2022-10-31 10:06
测试下这个顺利执行还是强制esc都可以返回wcs了
(defun c:test ( / *error* )
(defun *error*...
谢谢、我试一下 ssyfeng 发表于 2022-10-31 09:24
这样应该可以:
(defun *error* ( msg )
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) ...
谢谢、我试一下 guosheyang 发表于 2022-10-31 10:06
测试下这个顺利执行还是强制esc都可以返回wcs了
(defun c:test ( / *error* )
(defun *error*...
我试了一下可以的、好像把command改成command-s就可以了 xiaocainiao 发表于 2022-10-31 14:20
我试了一下可以的、好像把command改成command-s就可以了
是吗把你原来的错误处理函数的command改为command-s试下结果
(defun c:test ( / *error* )
(defun err(msg)
(setvar "osmode" osmode)
(command-s "UCS" "W")
(princ msg)
)
(command-s "ucs" 3 "pause""pause""pause")
(rtos (getreal "\n 输入实数或按esc键退出或enter键强制产生错误"))
(command-s "ucs" "")
(princ)
) guosheyang 发表于 2022-10-31 15:42
是吗把你原来的错误处理函数的command改为command-s试下结果
(defun c:test ( / *error* )
(defun ...
改成 command-s 可以了、我用07版不改也可以、好像就是这块的问题 用vl-cmdf应该是可以通用CAD2007和以后的高版本
页:
[1]