- (defun c:wk(/ ss i l1 l2 ll ur os d)
- (defun *MYERR* (MSG)
- (setvar "CMDECHO" CMD_OLD)
- (setvar "OSMODE" OS_OLD)
- (setq *ERROR* *OLDERR*)
- (if (= MSG "完美退出。谢谢使用。")
- (princ (strcat "\\n>>>" MSG))
- (princ "\n>>>虽然中途退出了,对象捕捉已经被恢复。")
- )
- (princ)
- )
- (setq *OLDERR* *ERROR*
- *ERROR* *MYERR*
- OS_OLD (getvar "OSMODE")
- CMD_OLD (getvar "CMDECHO")
- )
- (setvar "CMDECHO" 0);_关闭命令提示
- (Setq osmode_bak (getvar "osmode"));_记录捕捉
- (Setvar "osmode" 0);_关闭捕捉
- (Setq *Scale* 1000)
- (if *Scale* (setq d (getreal (strcat "\n偏距<" (rtos *Scale* 2 2) ">:") ) ) (setq d (getreal "\n偏
- 距:")))
- (if (null d) (setq d *Scale*) (setq *Scale* d ))
- (setq ss (ssget))
- (repeat (setq i (sslength ss))
- (vla-getboundingbox
- (vlax-ename->vla-object (ssname ss (setq i (1- i))))
- 'll
- 'ur
- )
- (setq l1 (cons (vlax-safearray->list ll) l1)
- l2 (cons (vlax-safearray->list ur) l2)
- )
- )
- (mapcar 'set
- (list 'll 'ur)
- (mapcar '(lambda (a b) (apply 'mapcar (cons a b)))
- '(min max)
- (list l1 l2)
- )
- )
- (command
- "rectang"
- (trans (polar ll (* pi 1.25) (setq d (sqrt (+ (* d d) (* d d)))))
- 0
- 1
- )
- (trans (polar ur (* pi 0.25) d) 0 1)
- )
- (command "CHPROP" "L" "" "LA" "0" "");指定图层
- (Setvar "osmode" osmode_bak);_还原捕捉
- (setvar "CMDECHO" 1);_打开命令提示
- (princ)
- )
|