我觉得用grread动态模拟,如果做得精细一点的话,完成代替getkword和自定义菜单,而且还可以做得很友好哦!
(纯属个人突发奇想……)
- ;---------------------------------------------------------------;
- ;动态选项 (feng:jn:grread) 返回选项'(梁 柱 门 窗) ;
- ;---------------------------------------------------------------;
- (defun feng:jn:grread ( po / p1 ang z l c m class *ERROR* size )
- (defun *ERROR* (msg)
- (redraw)
- )
- (princ "\n梁-L\t柱-Z\t窗-C\t门-M:")
- (while (/= (car (setq p1 (grread t 12 1))) 3)
- (setq size (/ (getvar "viewsize") 8000))
- (if (= (car p1) 5)
- (progn
- (setq ang (angle po (setq p1 (last p1)))
- z (MAPCAR '(LAMBDA (x) (MAPCAR '+ (MAPCAR '(LAMBDA (y) (* size y)) x) p1)) '((-150 150 0) (150 150 0) (150 150 0) (-150 -150 0) (-150 -150 0) (150 -150 0)))
- l (MAPCAR '(LAMBDA (x) (MAPCAR '+ (MAPCAR '(LAMBDA (y) (* size y)) x) p1)) '((-150 150 0) (-150 -150 0) (-150 -150 0) (150 -150 0)))
- c (MAPCAR '(LAMBDA (x) (MAPCAR '+ (MAPCAR '(LAMBDA (y) (* size y)) x) p1)) '((-150 150 0) (150 150 0) (-150 150 0) (-150 -150 0) (-150 -150 0) (150 -150 0)))
- m (MAPCAR '(LAMBDA (x) (MAPCAR '+ (MAPCAR '(LAMBDA (y) (* size y)) x) p1)) '((-150 150 0) (-150 -150 0) (-150 150 0) (0 -150 0) (0 -150 0) (150 150 0) (150 150 0) (150 -150 0)))
- )
- (redraw)
- (GRVECS (list 6 (MAPCAR '(LAMBDA (x y) (+ (* x size) y)) '(-1000 0 0) po)
- (MAPCAR '(LAMBDA (x y) (+ (* x size) y)) '(1000 0 0) po)
- (MAPCAR '(LAMBDA (x y) (+ (* x size) y)) '(0 -1000 0) po)
- (MAPCAR '(LAMBDA (x y) (+ (* x size) y)) '(0 1000 0) po)
- )
- )
- (cond
- ((<= 0 ang (/ pi 2)) (GRVECS (cons 1 l)) (setq class "梁"))
- ((< (/ pi 2) ang pi) (GRVECS (cons 2 z)) (setq class "柱"))
- ((<= pi ang (* pi 1.5)) (GRVECS (cons 3 c)) (setq class "窗"))
- ((< (* pi 1.5) ang (* 2 pi)) (GRVECS (cons 4 m)) (setq class "门"))
- )
- )
- )
- )
- (REDRAW)
- class
- )
|