这是以前ZZ版帮忙写的一个程序 一直以来都是很好用的
请ZZ版帮忙修改下
不要Q- E+ 了 改成直接输入数字 这个数字要有记忆功能 (我所说的记忆就是在不退出当前CAD ,再用这个程序还是上次输入的那个数字)- (defun c:tt(/ GR SS ds str)
- (setvar 'cmdecho 0)
- (setq ds 4.0)
- (setq str "按W S A D 移动Q-,E+,空格回车左\右键退出:")
- (if (setq ss(ssget)) (progn
- (princ (strcat "\n" str "距离" (rtos ds 2)))
- (while (and (/= (car (setq gr(grread t 15 0)))3)
- (not(equal gr '(2 32)))
- (not(equal gr '(2 13)))
- (not(equal gr '(11 0)))
- (not(equal gr '(25 0))))
- (cond
- ((or (equal gr '(2 119))(equal gr '(2 87))) ;wW
- (vl-cmdf "_.move" ss "" '(0 0) (polar '(0 0) (* pi 0.5) ds))
- (prompt (strcat "\r" str "向上移动"))
- )
- ((or (equal gr '(2 83))(equal gr '(2 115))) ;Ss
- (vl-cmdf "_.move" ss "" '(0 0) (polar '(0 0) (* pi 1.5) ds))
- (prompt (strcat "\r" str "向下移动"))
- )
- ((or (equal gr '(2 65))(equal gr '(2 97))) ;Aa
- (vl-cmdf "_.move" ss "" '(0 0) (polar '(0 0) pi ds))
- (prompt (strcat "\r" str "向左移动"))
- )
- ((or (equal gr '(2 68))(equal gr '(2 100))) ;Dd
- (vl-cmdf "_.move" ss "" '(0 0) (polar '(0 0) 0 ds))
- (prompt (strcat "\r" str "向右移动"))
- )
- ((or (equal gr '(2 81))(equal gr '(2 113))) ;Qq
- (setq ds (- ds 4) ds (if (< ds 0) 0 ds))
- (prompt (strcat "\r" str "距离" (rtos ds 2)))
- )
- ((or (equal gr '(2 69))(equal gr '(2 101))) ;Ee
- (setq ds (+ ds 4))
- (prompt (strcat "\r" str "距离" (rtos ds 2)))
- )
- )
- )
- ))
- (setvar 'cmdecho 1)
- (princ)
- )
|