我建议在以下内容中加入更多的错误捕捉:
- (defun c:pll ( / ent )
- (setq ent (entlast))
- (command "_.pline")
- (if
- (and
- (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\"))
- (not (eq ent (setq ent (entlast))))
- )
- (progn
- (princ (strcat "\nLength: " (rtos (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))))
- (entdel ent)
- )
- )
- (princ)
- )
- (vl-load-com) (princ)
如果用户在PLINE命令处于活动状态时按ESC键(这将导致当前代码出错),或在指定两个顶点之前单击鼠标右键/按ENTER键(在这种情况下,当前程序将出错或删除上次创建的实体),则上述情况允许。
李 |