Nate Holt's Blog

January 30, 2016

Project-wide block lister & where used

Filed under: Electrical — nateholt @ 1:56 pm

Big AcadE conversion project led to duplicated symbols with different names used here and there throughout the drawing set. Needed a way to identify these so they could be cleaned up and then a master library symbol set pulled together.

Here’s a quick tool that helped… it generates a spreadsheet showing all the unique blocks used in a selected AcadE project drawing set. It outputs a “.csv” text file that can be displayed with Excel. The resulting spreadsheet lists block name and total usage count along with each block’s “where used” drawing list. Seems to work…

blocks_used04

Here’s the lisp program. Just LOAD or APPLOAD it and type “blocks_used” at the AutoCAD “Command:” prompt. You are instructed to browse to your AcadE project’s “.wdp” file. Hit OK and off it goes. When finished it prompts for a “.csv” file name. Enter something, then open Excel, switch to “Text Files” as shown below. Browse to your csv file. It pops open in Excel.

blocks_used02

Customizing

You can customize this tool to your liking. Let’s say you want to filter out certain block names from the spreadsheet display — like title block or wire number blocks or the “dot” blocks. Open up the blocks_used.lsp file with AutoCAD’s VLIDE lisp editor or any text editor (make back up copy first!) and adjust as shown below. Save the file. Now the next time you load and run… the tool should follow your adjustments!

blocks_used03

Update: Note: this tool is set up to report only the blocks that are actually used in the drawings. It ignores those that are defined but nowhere used in the DWG file (i.e. does not track and report a drawing’s UNPURGED blocks). If you want to modify the tool to process and list all blocks defined in your drawings, you would need to replace the section of code starting with “(setq ss (wd_dbx_ssget ff “_X” ‘((0 . “INSERT”))))” above with some code that makes repeated calls to standard AutoLISP function “(tblnext “BLOCK”)” and extract each defined (i.e. not necessarily used!) block name that this function finds in the drawing.

 

Advertisements

Blog at WordPress.com.