Results 1 to 5 of 5

Thread: Block Inventory

  1. #1
    Active Member
    Join Date
    2003-09
    Posts
    83
    Login to Give a bone
    0

    Default Block Inventory

    Hello all -

    Anyone have a program or link to one that will inventory all blocks and export that count by name to an Excel file? Something like the CB (count block) code that was here a while ago, but with the ability to export / save, and something like Attribute Extraction, but with the ability to give totals, not list every block including multiples. Any help?

    Thanks,
    Albert

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Block Inventory

    Hi

    Check out the following Submission # EX001167 by Debra Denton & EX001355 by Wes Stueve on the AUGI Exchange Page -

    AUGI Exchange Search Page

    Have a good one, Mike

  3. #3
    Active Member
    Join Date
    2002-07
    Posts
    64
    Login to Give a bone
    0

    Default Re: Block Inventory

    Does this help? It reports block names and # of instances of each. It only reports used blocks in a dwg, not unused definitions.

    (defun c:gbnms ( / i ssb bnl #ssb bn)
    (setq i -1 ssb (ssget "X" (list (cons 0 "INSERT"))) #ssb (sslength ssb))
    (princ "\t\t\t\t ")
    (while (itest #ssb)
    ; (
    (setq bn (cdr (assoc 2 (entget (ssname ssb i)))))
    (if (not (member bn bnl)) (setq bnl (acad_strlsort (append bnl (list bn)))))
    )
    (foreach x bnl
    (setq i -1 cnt 0)
    (while (itest #ssb)
    (if (wcmatch (cdr (assoc 2 (entget (ssname ssb i)))) x) (setq cnt (1+ cnt)))
    )
    (princ (strcat " \t " (itoa cnt)))
    )
    (print (strcat (itoa #ssb) " blocks "))
    bnl
    )

    If want a a complet list of block names then you could use

    ;'tnlist' copied from 'ac_bonus.lsp' (R14) to insure that
    ;routines calling this UNDOCUMENTED function continue to operate when
    ;using future versions of AutoCAD
    (defun tnlist ( tbna / a lst)
    (if (and (equal (type tbna) 'LIST) (equal (cadr tbna) 16))
    (progn
    (setq tbna (car tbna))
    (while (setq a (tblnext tbna (not a))); a acts as a rewind first time
    (if (not (equal 16 (logand 16 (cdr (assoc 70 a)))))
    (setq lst (append lst (list (cdr (assoc 2 a)))))
    );if
    );while
    );progn then local only
    (progn
    (while (setq a (tblnext tbna (not a))); a acts as a rewind first time
    (setq lst (append lst (list (cdr (assoc 2 a)))))
    );while
    );progn else
    );if
    lst
    )

  4. #4
    AUGI Addict
    Join Date
    2015-12
    Location
    Arizona
    Posts
    2,478
    Login to Give a bone
    0

    Default Re: Block Inventory

    Use the built-in attribute extract tool.
    No programming required.

  5. #5
    Active Member
    Join Date
    2003-09
    Posts
    83
    Login to Give a bone
    0

    Default Re: Block Inventory

    Hello -

    Thank you for your responses.
    msjca - I can't seem to get either of these programs to work. The first one, "gbnms", returns this error:

    ; error: no function definition: ITEST

    The second returns this error:

    ; error: too few arguments [But only if I insert c:tblist instead of tblist in the defun string]

    Can't seem to figure it out.

    And also - mjfarrell. What I'm looking for is an inventory, i.e. so many of each block. The attribute extraction tool only exports a list of each block, so instead of "Valve Qty 3", I get "Valve Qty 1 Valve Qty 1 Valve Qty 1".

    Thank you for your help,
    Albert

Similar Threads

  1. Archibus Groups Inventory
    By Wanderer in forum Facilities Management In Practice
    Replies: 1
    Last Post: 2015-09-02, 05:42 PM
  2. Link Schedule/Inventory
    By Brandon_Pike in forum Revit Architecture - General
    Replies: 4
    Last Post: 2009-07-07, 02:43 PM
  3. Autocad to product inventory
    By lfish in forum AutoCAD General
    Replies: 3
    Last Post: 2007-04-27, 03:33 PM
  4. Level (& Grid) Inventory
    By stilesj in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2006-08-25, 08:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •