- Oh no! An error has occurred!
- You need to be logged in to do that.
- You need to be logged in to do that.
-
Coinciding with the acquisition of VIA Development, Nate joined Autodesk in March of 2003 after a decade stint as an entrepreneur following a two-decade stint as a controls engineer and software applications developer at Owens-Corning. Nate is now the lead product architect for AutoCAD Electrical. He loves this stuff.
-
Block Instance Lister utility - AutoCAD Electrical
March 7, 2008, 07:59 AM Nate HoltThis is a variation on the previous post. Instead of dealing with layers, we'll deal with block instances. But this will go another step and allow the output spreadsheet to list blocks used across all drawings in the active AutoCAD Electrical project.
We need to make this work in MDI (multi-document interface) mode, so will need to have a few changes in how the program is launched and how data is saved.
Here is the lisp program. It has some similarities with the "layer lister" program in the previous post - like the call to tblnext to cycle through the drawing's internal tables. In this case it is cycling through the "BLOCK" table instead of the "LAYER" table.

One of the differences is that the output file name is being saved in the "blackboard" namespace area. This allows AutoLISP variable values to be visible across multiple drawings when in MDI mode. In our sample program here, we're saving the output file name here with a call to (vl-bb-set...) and retrieving it for each new drawing processed with a call to (vl-bb-ref...).
There are multiple ways to load and launch this utility to have it operate on an AutoCAD Electrical project drawing set. One way is shown here. A two-line script file is created.

The first line "loads" the program (same idea as APPLOAD) and the second line launches it. Note: make sure that block_accum.lsp is located somewhere in your ACAD support path!
We then call this script from the normal AutoCAD Electrical "Project Utilities" command.


This two-line script file gets processed against each drawing in the project. The end result is that our little utility runs on each drawing and accumulates block names and instance counts.
Finally, when finished, the results can be called up in Excel and displayed!

Download here and rename the file block_accum.lsp
You must be logged in to post a comment.