本帖最后由 琴剑江山_10184 于 2015-6-3 14:01 编辑
- (defun c:tt (/ AS D DD DNS FS GET GV K KS LEN NN S ST)
- (princ "\n功能 [统计圆直径数量弹窗]")
- (setq gv (getvar "dimzin"))
- (setvar 'dimzin 8)
- (if (setq get (ssget '((0 . "CIRCLE"))))
- (progn
- (setq Len (sslength get) k 1)
- (repeat Len
- (setq nn (ssname get (setq Len (1- Len)))
- as (cdr (assoc 40 (entget nn)))
- as (atof (rtos as 2 2))
- )
- (if (null (setq dd (assoc as Dns)))
- (setq Dns (cons (list as k) Dns))
- (setq Dns (subst (list as (1+ (cadr dd))) (assoc as Dns) Dns))
- )
- )
- (foreach x Dns
- (setq d (car x)
- s (cadr x)
- st (strcat "直径"
- (rtos (* d 2) 2 2)
- ",数量"
- (rtos s 2 2)
- "\n"
- )
- ks (cons (list st) ks)
- )
- )
- (setq fs (apply 'strcat (mapcar 'car ks)))
- (alert fs)
- )
- )
- (setvar 'dimzin gv)
- (princ)
- )
|