The block.counts are the number of entities hosted by each block. That is, If block A is comprised of 5 lines and 5 attributes the count is 10 even if there are 100 instances of same.
That said, try running this (will take awhile) --
(progn
(defun _AnalyzeThis ( this / _IndexThisEx _IndexThis _Main )
(defun _IndexThisEx ( this / objectname pair )
;; index is a lexical global declared in _Main
(setq index
(if
(setq pair
(assoc
(setq objectname
(vlax-get this 'Objectname)
)
index
)
)
(subst
(list
(car pair)
(1+ (cadr pair))
)
pair
index
)
(cons
(list objectname 1)
index
)
)
)
;; not strictly needed but
;; return the index to the caller
)
(defun _IndexThis ( this )
;; _IndexThis is a wrapper for IndexEx.
;; don't get it? Too bad, so sad.
(_IndexThisEx this)
;; this is not a robust example of programming,
;; but in the interests of time and ascii economy
;; I'm using a simplistic recursive sledge hammer
;; technique
(vl-catch-all-apply
'(lambda ( )
;; force an error if the 'this'
;; object is not a collection
(vlax-get this 'Count)
;; let 'em know we haven't died
(princ
(strcat
"Indexing "
(vl-prin1-to-string this)
" "
" "
" "
"\r"
)
)
;; 'kay, let's roll
(vlax-for object this
(_IndexThis object)
)
)
)
)
(defun _Main ( this / index )
;; variable 'index' is a lexical global accessed
;; by lexical global function _IndexEx.
(_IndexThis (vlax-get this 'Blocks))
;;(_IndexThis (vlax-get this 'ModelSpace))
(princ "\nOrdered by object type:\n")
(mapcar 'print
(vl-sort
index
'(lambda ( a b ) (< (car a) (car b)))
)
)
(princ "\n\nOrdered by object count (descending):\n")
(mapcar 'print
(vl-sort
index
'(lambda ( a b ) (> (cadr a) (cadr b)))
)
)
(princ "\n\nTotal object count: ")
(princ (apply '+ (mapcar 'cadr index)))
(princ)
)
(_Main this)
)
(defun C:AnalyzeThis ( )
(_AnalyzeThis (vla-get-activedocument (vlax-get-acad-object)))
(princ)
)
(c:AnalyzeThis)
)