Nate Holt's Blog

August 7, 2009

Quick-fix for blank line issue in PnlPurchBOM “User Post”

Filed under: Electrical, Tips — nateholt @ 2:02 pm

Doug McAlexander called about a customer issue with listing a repeating ITEM number in a purchase-list format panel bill of materials.

Here’s an example of the original issue… showing the BOM entry lists every occurrence of the tallied component as its own line in the BOM report.





The original fix was to select the “User Post” button and run the little utility to suppress the repeated ITEM numbers.









But, when the ITEM number column is shown but there is no “TAGS” or “HDL” or other parallel column shown, the report ends up with empty, blank lines for those suppress entries.

Doug needed the “User Post” utitility for this report type to be a bit more clever and somehow suppress these blank lines from the customer’s reports.





A simple work-around

purbom04N8 Consultants took a look and here’s a one-line fix that seemed to address the problem.

The first step was to find the AutoLISP utility that runs when the “User Post” button is selected from the Panel Purchase-list format BOM report. Just look at the Command window after picking the User Post button. The full file-name is shown…


 Next, make a backup copy of this file.


Modify the pur_pbom.lsp file – add one line

Now… open it with the AutoCAD Visual Lisp editor or any ASCII text editor. Down, near the bottom… add this line of code shown highlighted in red:

(if (= user_3 "1")
        (progn ; Suppress repeated numbers in ITEM column
          (setq newdatalst nil)
          (foreach lst combined_data
            ; Process the "ITEM" numbers list. Blank out adjacent repeats
            (setq itemlst (nth 22 lst))
            (setq new_itemlst nil) ; start with empty list
            (setq lastitem nil)
            (foreach x itemlst
              (if (= x lastitem) ; repeat of previous
                  (setq x "") ; blank it out
                  (setq blanked T)
              ; ELSE
                (setq lastitem x) ; save last non-blank item 
              (setq new_itemlst (cons x new_itemlst))
            (while (= (car new_itemlst) "")(setq new_itemlst (cdr new_itemlst))) ; ** 06-Aug-09 NEHolt
            ; Put back into original order
            (setq new_itemlst (reverse new_itemlst))
            (setq lst (wd_nth_subst 22 new_itemlst lst))
            (setq newdatalst (cons lst newdatalst))
          (setq combined_data (reverse newdatalst))
      ) )

Save the file. That’s it.


   Now Doug tries the report again…
















 …and confirms that the fix “works perfectly” for this reporting scenario.

Customer happy.

Doug McAlexander happy.




  1. Does this work for AutoCAD Electrical 2009? I’ve been having this issue for years and now it looks like there is a fix for it. But when I open up my pur_pbom.lsp file, it doesn’t match what is shown here. I am by no means an lisp writer. Just a drafter. Any help would be appriciated.

    Comment by Matthew Lucca — September 30, 2009 @ 3:48 pm

    • I suspect that it will work with ACE2009. Go ahead and test but first copy the existing file to a safe place. Then overwrite with the modified version. If you have trouble, please let me know.

      Comment by nateholt — September 30, 2009 @ 3:56 pm

  2. Need help with the bom_loc.lsp
    Two identical single pole fuse holders have two identical fuses.
    The BOM is generated in normal tallied (grouped inst/loc) format.
    The report has each fuse holder with its own fuse, so the fuse is repeated twice in the BOM report which is incorrect as each part number should be displayed only once.
    I posted a discussion topic at the Autodesk Community (
    Any help would be highly appreciated.

    Comment by evanj666 — October 22, 2009 @ 6:33 am

  3. Got it sorted out…just had to use the Tallied Purchase List Format.

    Comment by evanj666 — October 23, 2009 @ 2:33 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: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Blog at

%d bloggers like this: