- (defun qbc (pts / b h)
- (setq b (distance (car pts) (cadddr pts)))
- (setq h (distance (car pts) (cadr pts)))
- (cons (max b h) (min b h))
- );结束qbc
- (defun c:tg ( / bclst pts ss el bc_new i p2 p3 m x1 x2)
- (princ "\n请框选矩形:")
- (setq ss (ssget '((0 . "LWPOLYLINE") (90 . 4))))
- (setq i 0 bclst nil pts nil)
- (repeat (sslength ss)
- (setq el (entget (ssname ss i)))
- (setq pts nil)
- (foreach pt el (if (= (car pt) 10) (setq pts (cons (cdr pt) pts))))
- (setq bclst (cons (qbc pts) bclst))
- (setq i (1+ i))
- );repeat
- (setq bc_new nil)
- (while bclst
- (setq m (car bclst) x1 (length bclst))
- (setq bclst (vl-remove m bclst))
- (setq x2 (length bclst))
- (setq n (- x1 x2))
- (setq bc_new (cons (list m n) bc_new))
- )
- (setq p2 (getpoint "\起始位置"))
- (setq p3 (polar p2 0 400))
- (command "_.TEXT" "c" (polar p2 (* pi 0.5) 140) "70" "0" "高*宽=数量");指定书写标题的位置
- (foreach bg bc_new ;设定重复次数为新表的长度
- (command "_.TEXT" "c" p2 "70" "0"
- (strcat (rtos (car (car bg)) 2)"*" (rtos (cdr (car bg)) 2) "=" (itoa (cadr bg))))
- (setq p2 (polar p2 (* pi 1.5) 140))
- (princ)
- )
|