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

2 Comments »

  1. Nate, I am so happy to find you writing and sharing with us about Autocad Electrical again. Your explanations are second to none, and the topics you choose excite the imagination. Thanks for sharing with us!!

    Comment by Rick Jordan — February 20, 2016 @ 7:20 am

    • Thanks Rick, you are very kind. It’s good to be back!
      Nate.

      Comment by nateholt — February 20, 2016 @ 9:47 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: