Nate Holt's Blog

June 25, 2010

User-post: import component descriptions into Cable From/To reports – AutoCAD Electrical

Filed under: Electrical, Tutorials — nateholt @ 7:24 am

Customize existing report to include assigned description text of devices at each end of the cable.

About 18 months ago we blogged here  about how to modify the “Wire From/To” report to include the three lines of description text carried by the connected component found at each end of the reported wires. This is not an option in shrink-wrap AutoCAD Electrical, but is possible by enhancing an existing “user post” utility for the wire from/to report.

The way this all works is:  AutoCAD Electrical extracts and formats the report data. It then displays a copy of this data in its report dialog. User can massage the report a bit by sorting on a data column or adding or removing pre-defined data columns from the report. But if the user wants to go beyond what is provided in the stock report, he can opt to invoke a “user post” utility specific to the displayed report type.

The “user post” is an AutoLisp program that is called from the “User Post” button on the report dialog. It is designed to take the original data, re-format it in some custom way, and then push the data back to the report dialog.

Neither the stock “Wire From/To” report nor the “Cable From/To” report includes an option to have the “From” and “To” connected component description text show up in the report. But the previous posting described how to appropriately modify the two existing AutoLisp program files that drive the “user post” utility for the Wire From/To report (files wirefrm2.lsp and wirefrm2.dcl). The idea was to extract the thee lines of description text for the component at both ends and then push this extra data into six unused fields (i.e. rarely-used fields) of the existing Wire From/To report – report column names PNLX1, PNLY1, PNLZ1 for the three lines of description text for the “From” component connection and PNLX2, PLNY2, and PNLZ2 for the “To” component connection.

But the enhancement described in this previous posting only applies to the Wire From/To report type.

This morning a user asked about modifying the Cable From/To report to do the same thing. The steps below describe how to do this by making similar additions to the cable from/to report “user post” files: cablecon.lsp and cablecon.dcl.

Enhanced User Post for Cable From/To report

We’ll find and modify the Cable From/To user post “.lsp” file and its dialog “.dcl” file. The full path/file name of the “.lsp” user post file is displayed in the command window when you display the report and then pick on the “User Post” button. The separate “.dcl” file that defines the utility’s small opening dialog will be in this same folder. Alternately, type this at the “Command:” prompt to get the path (ignore the doubled-up backslashes in the returned path):

         (c:ace_find_file “cablecon.lsp” 3) [Enter]

Step 1: Find the folder where these files reside (above) and make backup copies of each, just in case (files cablecon.lsp and cablecon.dcl)

Step 2: Edit the dialog source file “cablecon.dcl”

We open this file with any ASCII text editor or with the standard AutoCAD Visual Lisp editor tool (type VLIDE [Enter] at the AutoCAD command prompt). Add these lines to the file and then save it.

Step 3: Program the 4th new option into the cablecon.lsp utility. We open with any ASCII text editor or with the standard AutoCAD Visual Lisp editor tool as described in the previous step. Scroll down just a bit and find this part of the existing program. We add in two lines to interact with the new option we defined in the small opening dialog (in Step 2).

Step 4: Next we have to figure out where individual report fields are located in each line of report data. Each line is a long list of concatenated data elements. This layout is documented in a comments section of the cablecon.lsp file. It is reproduced here:

It looks like the key elements of each data line are these:  the “From” component’s handle and drawing index (which drawing the component is on) are element index numbers 47 and 49. The “To” component’s are 48 and 50. And the rarely used, existing fields we want to push the description into are at index offsets 60-62 and 64-66.

Now scroll down to near the end of the cablecon.lsp file. Here is where we push in a new chunk of AutoLISP code (highlighted in yellow below).

Save the edited file… or, just download from here and here and push into the appropriate folder so AutoCAD Electrical finds these new versions instead of the stock versions.


Run the Cable From/To report normally. When the report displays in the report dialog, hit the “User Post” button. You should now see a new option at the bottom of the dialog. Select it and hit OK.

The report displays as before. But the component descriptions should now be available in the rarely-used report fields PNLX1-PNLZ1 for the “From” component and PNLX2-PNLZ2 for the “To” component. Hit the “Change Report Format” button and add these fields to the report display. Rename them if you’d like.

After making these changes, AutoCAD Electrical will “remember” these and make them the default the next time the report is invoked (report settings are saved in the cablecon.set file held in the “USER” folder).

UPDATE (03-Jan-2011): Found that in some cases the “DWGIX” value is RJT and may have a leading blank space attached to it. This will cause a failure to find a match on the list of COMP components. Modify utility as shown below:



  1. What if not all component descriptions do not come through ?
    Irregular results.

    Comment by Jim Malik — December 20, 2010 @ 6:10 pm

    • You are correct. There was an issue with the “user post” sometimes failing to find a component match because the drawing index “DWGIX” value may have a leading blank space. I modified the sample code to strip off leading/trailing blanks and seems to work now.

      Comment by nateholt — January 5, 2011 @ 12:01 pm

  2. Nate,

    I have Autocad Electrical 2018 and am having trouble implementing this routine… It seems the cablecon.lsp files have changed over the years. Is there a working fix or any others that may be able to help?

    Thank you.

    Comment by Greg Allamon — January 24, 2018 @ 3:28 pm

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 )

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

Blog at

%d bloggers like this: