-
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.
-
Drawing List report and 'user post' example - AutoCAD Electrical
February 19, 2008, 09:23 AM Nate HoltNearly all of AutoCAD Electrical's reports can be reformatted on-the-fly with a custom 'user post'. It requires some setup but can fill in the gap between what ACE supplies out-of-the-box and what your specific needs might be.
Here is a recent example. A user wanted to run the 'Drawing List' report but then insert a blank spacer line into the report whenever a specific field value changed from one line to the next. In the report display below, every time the "Section" value changes, we'd like a blank spacer line inserted into the report. So, a blank line to show up with each change in the "Contract x" number.

The key to making this work is to tie in to the 'User Post' function. The button is in the the lower right-hand corner of the display dialog:

This will search for and launch an AutoLISP utility that matches up with the report type being displayed. Hit the button and then look at your command window. The path to the AutoLISP utility should be there:

Now the hard(er) part
You need to open up the dwglst.lsp file with an ASCII text editor or the built-in Visual Lisp editor (make a back-up copy first!).
Right now, the file is just a blank template. It has three user options but none of them are set up to do anything. Here is the key part of the post-processing utility program. It is just a place-holder for where we will start to add our own custom code:

The report data comes across in variable "wd_rdata". The format of this data for this "Drawing List" report is this:
; -- Structure of the "wd_rdata" list of lists passed from AutoCAD Electrical:
;
; (list (list <report line1 data>) (list <report line2 data>) ... )
; where each line data sublist consists of a list of the following:
; 0 = drawing file name (no path, no extension)
; 1 = date stamp
; 2 = time stamp
; 3 = SHEET assignment (the %S value)
; 4 = SHDWGNAME assignment (the %D value)
; 5 = SEC assignment (the %A value)
; 6 = SUBSEC assignment (the %B value)
; 7 = Drawing desc line 1
; 8 = Full file name
; 9 = Drawing desc line 2
; 10 = Drawing desc line 3
; 11 = IEC-Project (the %P value)
; 12 = IEC-Installation (the %I value)
; 13 = IEC-Location (the %L value)
; 14-?? = other values defined in ".wdt" title block attribute mapping fileSince we're interested in tracking the value of the "Section" value from one drawing to the next, we need to focus in on the index 5 position of each line of data.
So, coding this up, we might end up with this new code inserted into the above place-holder:

Our code grabs the "Sec" value from the first line of report data. Then it cycles through all lines of the report. Whenever the "Sec" value changes, it pushes in a "blank" line into the report.
Here's our new report display after selecting the "User post" button and picking the first option on the user post subdialog:

Here's a copy of this sample user post utility and the companion "dcl" dialog file.
files/20801_20900/20884/file_20884.lsp (rename to dwglst.lsp)
files/20801_20900/20885/file_20885.dcl (rename to dwglst.dcl)
You must be logged in to post a comment.