;;
(defun c:YGS (/ 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)
(setq po (getpoint "input point----:"))
(command "text" po "2" "" FS"")
;(setq wz1 (entlast))
;(command "DDEDIT" wz1 "" "")
)
)
(setvar 'dimzin gv)
(princ)
);