;我写的时钟程序
;同样的问题,死循环,只能"ESC"强行退出,退出后osmode值为0
;请高手指点一下如何处理
;我试过自己定义出错程序,但是无效.退出循环属于中断不是出错!!!
(defun c:clock() (setvar "cmdecho" 0) (setq os (getvar "osmode")) (setvar "osmode" 0) (setq cen (getpoint "\n中心点:")) (setq rr (* (getdist cen "\n半径:") 2)) (lsp_22a) (lsp_22b) (lsp_22c) (setvar "osmode" os) )
(defun lsp_22a() (setvar "cecolor" "131") (command "donut" 0 (/ (* rr 43) 40) cen "") (setq pp_12 (polar cen (/ pi 2) (/ rr 2))) (setq pp_3 (polar cen 0 (/ rr 2))) (setq pp_6 (polar cen (* pi 1.5) (/ rr 2))) (setq pp_9 (polar cen pi (/ rr 2))) (setvar "cecolor" "2") (command "donut" 0 (/ rr 48) pp_12 "") (command "array" (entlast) "" "p" cen 60 360 "") (setvar "cecolor" "1") (command "donut" 0 (/ rr 24) pp_12 "") (command "array" (entlast) "" "p" cen 12 360 "") (setvar "cecolor" "7") (setq t1 (polar cen (/ pi -2) (* (/ rr 100) 4))) (setq t2 (polar cen (/ pi 2) (* (/ rr 20) 7))) (command "pline" t1 "W" 0 (/ rr 36) cen "w" (/ rr 36) 0 t2 "") (setq en3 (entlast)) (setvar "cecolor" "3") (setq d1 (polar cen (/ pi -2) (* (/ rr 100) 6))) (setq d2 (polar cen (/ pi 2) (* (/ rr 20) 8))) (command "pline" d1 "W" 0 (/ rr 40) cen "w" (/ rr 40) 0 d2 "") (setq en1 (entlast)) (setvar "cecolor" "5") (setq m1 (polar cen (/ pi -2) (* (/ rr 100) 7))) (setq m2 (polar cen (/ pi 2) (* (/ rr 20) 8.8))) (setq m3 (polar cen (/ pi -2) (* (/ rr 100) 1))) (command "pline" m1 "w" 0 0 m3 "a" "ce" cen "a" 180 "a" 180 "ce" cen "l" m2 "") (setq en2 (entlast)) (setvar "cecolor" "bylayer") (setq ti (rtos (getvar "cdate") 2 6)) (setq tt (substr ti 10 2)) (setq dd (substr ti 12 2)) (setq mm (substr ti 14 2)) (command "rotate" en3 "" cen (* (atoi tt) -30)) (command "rotate" en3 "" cen (* (atoi dd) -0.5)) (command "rotate" en1 "" cen (* (atoi dd) -6)) (command "rotate" en2 "" cen (* (atoi mm) -6)) )
(defun lsp_22b() (setq txt_1 (polar cen (/ pi -2) (/ rr 4))) (setq data (substr ti 1 8)) (setvar "cecolor" "6") (command "text" "m" txt_1 (/ rr 24) 0 data) )
(defun lsp_22c() (setq n 1) (while (= n 1) (setq ti1 (rtos (getvar "cdate") 2 6)) (setq tt1 (substr ti1 10 2)) (setq dd1 (substr ti1 12 2)) (setq mm1 (substr ti1 14 2)) (if (/= dd1 dd) (progn (setq dd dd1) (command "rotate" en3 "" cen -0.1) ) ) (if (/= mm1 mm) (progn (setq mm mm1) (command "rotate" en1 "" cen -0.1) (command "rotate" en2 "" cen -6) ) ) ) )
(princ "\n\n…………〉〉时钟〈〈…………") (prin1) |