Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

gpcattaneo
en respuesta a: MikeKovacik4928

Try this... (press F2 to display results)

 

(defun c:dbcount ( / blks n blk bL bL+)

    (vl-load-com)

    (if (setq blks (ssget "_X" '((0 . "INSERT"))))
        (progn
            (repeat (setq n (sslength blks))
                (if (eq :vlax-true (vla-get-isdynamicblock (setq blk (vlax-ename->vla-object (ssname blks (setq n (1- n)))))))
                    (setq bL (acad_strlsort (cons (vla-get-effectivename blk) bL)))
                )
            )
            (setq bL (reverse bL))
            (while bL
                (if bL+
                    (setq bL+ (cons (cons (car bL) (length (vl-remove-if-not '(lambda (b) (eq b (car bL))) bL))) bL+))
                    (setq bL+ (list (cons (car bL) (length (vl-remove-if-not '(lambda (b) (eq b (car bL))) bL)))))
                )
                (setq bL (vl-remove-if '(lambda (b) (eq b (car bL))) bL))
            )
            (princ "\n ") (princ "\n ")
            (foreach x bL+
                (princ (strcat "\n  " (itoa (cdr x)) "  Dynamic Block: " (car x) ))
            )
        )
    )
    (princ)
)