Display full version of the post: Audit Blocks

ISElation
31.03.2009, 21:59
Is there a way to find out exactly what blocks are in a drawing and how many of each block there are?

msplcdykee69
31.03.2009, 22:12
Easiest way is to select one of the blocks right click your mouse select similar and then look at your properties window and it will tell you how many selected.

ISElation
31.03.2009, 22:27
I do not have that "similar selection" option. Running the "ssx" command is way faster, but then i have the problems with the blocks being on different layers and having to add them up. I was just wondering if there is a way to export all the block names in a dwg and give me the number of each? AS QUICK AS POSSIBLE

msplcdykee69
01.04.2009, 04:25
here is a lisp program use this to count your blocks.  when you type BLK in the command prompt select one of the blocks you wish to know the number of, then window over the area it will give you a count of total number of that particular block in that dwg.
 
 
(defun c:BLK ()  (SETQ LAY (CDR (ASSOC 2 (ENTGET (CAR (ENTSEL))))))  (setq sel (ssget (list (cons 0 "insert") (cons 2 lay))))  (setq sle (itoa (sslength sel)))  (alert (strcat LAY " : " sle)))

ISElation
01.04.2009, 16:27
That lsp works great, but it would be nice to be able to select all the blocks in a drawing and display how many their are. With this lsp i dont really know if i get every block unless i get a list of all the blocks in the drawing first, and if i am doing this i might as well use the quick select command to find out the total for each. Thanks for all the help.

msplcdykee69
01.04.2009, 16:43
You can try to do a web search for lisp routines. someone out there may have written one to do exactly what your looking for.  If I should happen to find one I will post it here.

ISElation
01.04.2009, 18:01
I found this to work perfect.
(defun c:blkcount (/ ss lst itm result)  (and (setq ss (ssget "x" (list (cons 0 "INSERT"))))       (setq lst (mapcar '(lambda (x) (cdr (assoc 2 (entget x))))                         (mapcar 'cadr (ssnamex ss)))       )       (setq lst (vl-sort lst '>))       (while (setq itm (car lst))         (setq len (length lst))         (setq lst    (vl-remove itm lst)               cnt    (- len (length lst))               result (cons (cons itm cnt) result)         )       )  )  result)

zhb7
06.04.2009, 16:22
try  the comand "bcount"

msplcdykee69
07.04.2009, 04:27
I never new about bcount.. Works great Thanks i will know for next time and i have added that to my Company standards.

ISElation
07.04.2009, 15:30
bcount works great. Thanks for all the help