AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wire From/To report

4 REPLIES 4
Reply
Message 1 of 5
cwhitaker
455 Views, 4 Replies

Wire From/To report

Does anyone know of an easy way to add the block DESC attributes to the to from list?
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: cwhitaker

The AcadE wire From/To report does not currently list the FROM and TO component's DESC1-3 attribute values as optional fields to include in the report. One way to add them is to modify the sample wirefrm2.lsp "User post-processing" utility so that it will query the project's COMP table where these attribute values are stored and merge them into the existing Wire From/To report. The standard "post-processing utility" code below has been slightly modifed to do the above. This is set up for AcadE 2005. If you want to apply this to AcadE 2004 then you'll need to cut and paste the modified code below into the AcadE 2004 version of c:\program files\autodesk\support\wirefrm2.lsp. To get the extra fields, run the From/To report. With the report displayed on screen, select the "User Post" button. Select the 2nd toggle. Now make sure that CMP:PIN1 and CMP:PIN2 fields are included in the report. You should see that the from and to component DESC attribute values are now sitting in these two report columns. If you have questions or problems with this approach, let me know! thanks, Nate. ; 16-Jul-04 NEHolt; demo for discussion group reply ; 10-May-04 LeeH; globalized replace of 'strcase' with 'ace_strcase' ; ** 28-Apr-04 LeeH; added support for localized 'wdw' file access messages. ; 01-Oct-03 Mauro Sist globalized ; ** 29-Sep-02 NEHolt adjusted for calling from either VIA-WD Add-on or Stand Alone. Stand ; Alone requires that only one overall routine is defined, must be called "_wd_post_main". ; Any subroutines defined in this file MUST be defined internal to this main routine. ; ** 01-Nov-01 NEHolt the layer name to gauge lookup was being thwarted ; if drawing's layer names were lower case. Fixed. ; ** 29-Jun-01 NEHolt N8 Solutions, Inc / VIA Development. Created ; as sample post-process util ; --------- W I R E F R M 2 . L S P ----------------------------- ; Post-process Wire from/to report. ; ; This routine is called from AutoCAD Electrical's "User post" button on the ; Wire From/To report dialog display. Report data is passed to this ; routine in AutoLISP variable called "wd_rdata". This utility can ; then operate on this report data, reformat it into a new list of ; report data "rtrn" and then pass it back to AutoCAD Electrical's report dialog ; through a call to (c:wd_rtrn_2wd rtrn) shown at the end of this file. ; ; -- Structure of the "wd_rdata" list of lists passed from AutoCAD Electrical: ; ; (list (list ) (list ) ... ) ; where each line data sublist consists of a list of the following: ; 0 = wire number ; 1 = LOC for "from" device ; 2 = TAG ID for "from" device ; 3 = terminal PIN number for "from" device connection ; 4 = LOC for "to" device ; 5 = TAG ID for "to" device ; 6 = terminal PIN number for "to" device connection ; 7 = WIRELAY for wire touching "from" device ; 8 = WIRELAY for wire touching "to" device ; 9 = line ref of "from" device ; 10= line ref of "to" device ; 11= SHEET number for "from" device ; 12= SHEET number for "to" device ; 13= cable marker - TAG ID (if cable marker present in wire) ; 14= cable marker - conductor color/number value ; 15= cable marker - LOC code ; 16= cable marker - MFG part number assignment ; 17= cable marker - CAT part number assignment ; 18= cable marker - ASSYCODE part number assignment ; 19= cable marker - DESC1 description value assignment ; 20= cable marker - DESC2 ; 21= cable marker - DESC3 ; 22= cable marker - 1=parent marker, 2=child marker ; 23= CMP:PIN1 - combined "from" device text consisting of TAG ID and PIN number ; 24= CMP:PIN2 - combined "to" device text consisting of TAG ID and PIN number ; 25= SEC assignment for drawing with "from" device ; 26= SUBSEC assignment for drawing with "from" device ; 27= SEC assignment for drawing with "to" device ; 28= SUBSEC assignment for drawing with "to" device ; 29= INST of "from" device ; 30= INST of "to" device ; 31= formatted IEC for "from" device ; 32= "to" device ; 33= TERMDESC value of "from" device wire connection point ; 34= TERMDESC value of "to" device wire connection point ; 35= wire connection sequence code for "from" device wire connection ; 36= wire connection sequence code for "to" device wire connection ; 37= PNLWDLEV1 ; 38= PNLWDLEV2 ; 39= HDL of "from" dev ; 40= HDL of "to" dev ; 41= DWGIX of "from" device's dwg ; 42= DWGIX of "to" ; 43= DWGNAM %D value of "from" dev dwg ; 44= DWGNAM %D value of "to" dev dwg (defun _wd_post_main ( / rtrn dclnam dcl_id user_1 user_2 user_3 cancel xx wlay1 lay_map_lst data wd_make_dcl wd_nth_subst x dwgix1 dwgix2 hdl1 hdl2 from_desc to_desc hdl fnam comp_table_lst rec rtrn2 wlay2) ; -- internal subroutines ; -- (defun wd_nth_subst ( n val lst / newlst ix slen x ) ; Substitute the nth member of a list "lst" with new value "val" ; If "n" is past end of existing list then blank positions "nil" padded (if (not lst) (setq slen 0) (setq slen (length lst)) ) (cond ((minusp n) ) ; rtrn orig list if pos is neg number ((zerop n) (setq lst (cons val (cdr lst)))) ; n=0, replace 1st item ((= n slen) (setq lst (append lst (list val)))) ; new last item ((< n slen) ; Insert item somewhere else in list (setq ix 0) (setq newlst '()) (foreach x lst (if (/= ix n) (setq newlst (cons x newlst)) ; reuse existing (setq newlst (cons val newlst)) ; substitute new ) (setq ix (1+ ix)) ) (setq lst (reverse newlst)) (setq newlst nil) ) ((> n slen) ; lengthen list, add "nil" pads as req'd (setq lst (reverse lst)) (while (< slen n) (setq lst (cons nil lst)) ; add pads (setq slen (1+ slen)) ) (setq lst (reverse (cons val lst))) ; tack new item on end ) ) lst ) ; -- (defun wirefrm2_process_list (doing_lst / rtn x ix ixlst) (setq rtn nil) (setq ixlst nil) (setq doing_lst (reverse doing_lst)) (setq wdlev1hit nil wdlev2hit nil wdlev1blank nil wdlev2blank nil) (setq orphan37lst nil orphan38lst nil) (setq cmp1_phantom_lst nil cmp2_phantom_lst nil cmp1_orphan_lst nil cmp2_orphan_lst nil) (setq ix 0) (if (OR (= (car (car doing_lst)) "") (<= (length doing_lst) 1)) (setq rtn doing_lst) ; no wire number for this group or just a single entry, don't bother doing anything else ; ELSE (progn (setq ix 0) (setq ixlst nil) (foreach x doing_lst (setq ref1_blank nil ref2_blank nil lev1_blank nil lev2_blank nil) (cond ((= (wd_1_rmv_leading_blnks (nth 37 x)) "") ; PNLWDLEV1 is blank (setq wdlev1blank 1) (setq lev1_blank 1) ) (T (if (/= (wd_1_rmv_leading_blnks (nth 37 x)) "")(setq wdlev1hit 1)) ; PNLWDLEV1 is not blank ) ) (cond ((= (wd_1_rmv_leading_blnks (nth 38 x)) "") (setq wdlev2blank 1) ; PNLWDLEV2 is blank (setq lev2_blank 1) ) (T (if (/= (wd_1_rmv_leading_blnks (nth 38 x)) "")(setq wdlev2hit 1)) ; PNLWDLEV2 is not blank ) ) (if (= (nth 9 x) "")(setq ref1_blank 1)) ; could be a phantom terminal connection (if (= (nth 10 x) "")(setq ref2_blank 1)) ; could be a phantom terminal connection (if (AND ref1_blank (not lev2_blank)) (progn (setq cmp1_phantom_lst (cons ix cmp1_phantom_lst)) ) ; ELSE (if (AND ref2_blank (not lev1_blank)) (progn (setq cmp2_phantom_lst (cons ix cmp2_phantom_lst)) ) ) ) (if (AND lev1_blank (not ref2_blank) (not ref1_blank) (not lev2_blank)) (progn ; the CMP1 entry is not LEV/SEQ but ties to CMP2 that is and CMP1 is not a phantom terminal. ; This is a candiate to be tied directly to the phantom term strip, if exists. (setq cmp1_orphan_lst (cons ix cmp1_orphan_lst)) ) ; ELSE (progn (if (AND lev2_blank (not ref2_blank) (not ref1_blank) (not lev1_blank)) (progn ; the CMP2 entry is not LEV/SEQ but ties to CMP1 that is and CMP2 is not a phantom terminal. ; This is a candidate to be tied directly to the phantom term strip, if exists. (setq cmp2_orphan_lst (cons ix cmp2_orphan_lst)) ) ) ) ) (setq ix (1+ ix)) ) (while (AND cmp2_phantom_lst cmp1_orphan_lst) (progn (setq new nil) (setq ixn 0) (foreach field (nth (car cmp1_orphan_lst) doing_lst) (if (member ixn (list 4 5 6 8 10 12 24 27 28 30 32 34 36 38 40 42 44)) (setq new (cons (nth ixn (nth (car cmp2_phantom_lst) doing_lst)) new)) ; ELSE (setq new (cons field new)) ) (setq ixn (1+ ixn)) ) (setq new (reverse new)) (setq doing_lst (wd_nth_subst (car cmp1_orphan_lst) new doing_lst)) (setq cmp2_phantom_lst (cdr cmp2_phantom_lst)) ; strip off first element (setq cmp1_orphan_lst (cdr cmp1_orphan_lst)) ; strip off first element ) ) (while (AND cmp1_phantom_lst cmp2_orphan_lst) (progn (setq new nil) (setq ixn 0) (foreach field (nth (car cmp2_orphan_lst) doing_lst) (if (member ixn (list 1 2 3 7 9 11 23 25 26 29 31 33 35 37 39 41 43)) (setq new (cons (nth ixn (nth (car cmp1_phantom_lst) doing_lst)) new)) ; ELSE (setq new (cons field new)) ) (setq ixn (1+ ixn)) ) (setq new (reverse new)) (setq doing_lst (wd_nth_subst (car cmp2_orphan_lst) new doing_lst)) (setq cmp1_phantom_lst (cdr cmp1_phantom_lst)) ; strip off first element (setq cmp2_orphan_lst (cdr cmp2_orphan_lst)) ; strip off first element ) ) (setq rtn doing_lst) ) ) rtn ) ; -- main routine -- (setq rtrn nil) ; AutoCAD Electrical passes the report displayed data as a list of lists of lists in variable ; called wd_rdata. The first element of this list is the list of lists ; report data. The 2nd element is future (at this time). (if (AND wd_rdata (car wd_rdata) (listp (car wd_rdata))) (setq wd_rdata (car wd_rdata))) ; just go with first list of lists (report data) ; Create and reference a ".dcl" file, on-the-fly (setq user_1 "0") ; default to 1st user entry toggled on (setq user_2 "1") (setq user_3 "0") ; Look for dcl file of same name, open if found. (setq cancel nil) (if (setq dclnam (c:ace_find_file "wirefrm2.dcl" 16)) ; 16=display error dialog if file not found (progn (setq dcl_id (load_dialog dclnam)) (if (new_dialog "main_select" dcl_id) (progn (set_tile "user1" user_1) ; set toggles per defaults above (set_tile "user2" user_2) (set_tile "user3" user_3) (action_tile "user1" "(setq user_1 $value)") (action_tile "user2" "(setq user_2 $value)") (action_tile "user3" "(setq user_3 $value)") (action_tile "cancel" "(setq cancel 1)") (start_dialog) (unload_dialog dcl_id) ) ) ) ) (if (AND wd_rdata (not cancel)) (progn ; user didn't cancel out of dialog, okay to continue (setq rtrn wd_rdata) (if (= user_1 "1") ; Do substitution of color/gauge labels for layer names (progn ; Read current Wire layer mapping file (".wdw" file) (setq x (c:wd_find_wdw)) (if (/= x nil)(princ (strcat "\n" (c:wd_msg "WLAY029" nil "Reading wdw") ": " x))) (setq lay_map_lst (c:wd_read_wdw x)) (if (not lay_map_lst) (princ (strcat "\n \".WDW\"" (c:wd_msg "WLAY030" nil "mapping file not found"))) ; ELSE (progn ; found it, continue processing the report data ; WIREFRM2 report data has wire layer fields as 8th and 9th elements of each ; sublist in the report data (0th element = first element in sublist) ; Now process each sublist in the report data list (i.e. each line of report data) (foreach xx wd_rdata ; Force layer names to upper case for the match check below (setq wlay1 (ace_strcase (nth 7 xx))) ; existing report wire layer name "WLAY1" (setq wlay2 (ace_strcase (nth 8 xx))) ; existing report wire layer name "WLAY2" ; Now look through mapping list and try to find a match on the layer name (foreach data lay_map_lst (if (= wlay1 (ace_strcase (nth 0 data))) ; Match found, grab new substitute text string to use (setq wlay1 (nth 1 data))) ; Check the other layer entry (if (= wlay2 (ace_strcase (nth 0 data))) ; Match found (setq wlay2 (nth 1 data))) ) ; Now check to see if match found for either entry. If so, substitute new ; value into the sublist (if (/= wlay1 (nth 7 xx)) (progn ; Yes, WLAY1 value needs to be updated (setq xx (wd_nth_subst 7 wlay1 xx)) ) ) (if (/= wlay2 (nth 8 xx)) (progn ; Yes, WLAY2 value needs to be updated (setq xx (wd_nth_subst 8 wlay2 xx)) ) ) ; Now added the sublist back into the new version of the list (setq rtrn (cons xx rtrn)) ) ; The new list will be reversed from original. Flip back. (setq rtrn (reverse rtrn)) ) ) ) ) (if (= user_2 "1") (progn ; First query the COMP table and get all DESC1-DESC3 attribute values on components (setq comp_table_lst nil) (if (setq fnam (c:wd_mdb_get_proj_scratch_dbnam nil)) ; "nil"=get current proj mdb file name (progn (setq hdl (wd_mdb_GetHandle 1)) ; get next handle, MDB format (if hdl (progn (if (wd_mdb_Open hdl fnam) ; open current project's mdb file (progn (setq comp_table_lst (wd_mdb_GetRecs hdl "COMP" "DWGIX,HDL,DESC1,DESC2,DESC3" ; fields to return "" ; query condition (all records) "")) ; no sort ) ) ) ) (wd_mdb_Close hdl) (setq hdl nil) ) ) (if comp_table_lst (progn ; some data returned from the COMP table, okay to continue (setq rtrn2 rtrn) (setq rtrn nil) ; Process each from/to data record. Look for match on DWGIX1/HDL1 and ; on DWGIX2/HDL2 field values. For each match retrieve the associated ; DESC1-DESC3 attribute values pulled from the COMP table. If found, ; concatenate and insert into the TAG:PIN1 and TAG:PIN2 fields. (foreach rec rtrn2 (setq dwgix1 (nth 41 rec)) (setq dwgix2 (nth 42 rec)) (setq hdl1 (nth 39 rec)) (setq hdl2 (nth 40 rec)) (setq from_desc "") (setq to_desc "") ; Look for matches (foreach x comp_table_lst (if (AND (= (cdr (car x)) dwgix1) (= (cdr (cadr x)) hdl1)) (progn ; found match for the FROM device (setq from_desc (strcat (cdr (caddr x)) " " (cdr (nth 3 x)) " " (cdr (nth 4 x)))) ; DESC1-DESC3 ) ) (if (AND (= (cdr (car x)) dwgix2) (= (cdr (cadr x)) hdl2)) (progn ; found match for the FROM device (setq to_desc (strcat (cdr (caddr x)) " " (cdr (nth 3 x)) " " (cdr (nth 4 x)))) ; DESC1-DESC3 ) ) ) ; Now substitute blank or found value into the TAG:PIN1 and TAG:PIN2 fields in report (setq rec (wd_nth_subst 23 from_desc rec)) (setq rec (wd_nth_subst 24 to_desc rec)) (setq rtrn (cons rec rtrn)) ) ) ) (setq rtrn (reverse rtrn)) ) ) (if (= user_3 "1") (progn (princ (strcat "\n " (c:wd_msg "WLAY031" (list "3" "wirefrm2.lsp") "Nothing defined for user%1 option (see %2)")) ) ) ) ) ) (c:wd_rtrn_2wd rtrn) ; return post-processed list back to AutoCAD Electrical's report dialog ) ; -- the following AUTO-STARTS when this file is "loaded" from within AutoCAD Electrical (i.e. ; user hits the "User post" button on a report display dialog) (_wd_post_main) ; run the above program (princ) ;; == this is the DCL file c:\program files\autodesk\support\wirefrm2.dcl main_select : dialog { label=/*wirefrm2_dcl_001*/"Report Data Post-processing Options"; :paragraph { :text_part{ label=/*wirefrm2_dcl_002*/"Select options(s) to apply to the report's data"; } :text_part{ label=/*wirefrm2_dcl_003*/"before passing it back to the report display dialog."; } :text_part{label="";} :text_part{ label=/*wirefrm2_dcl_004*/"(To modify these user options, edit the Post-process"; } :text_part{ label=/*wirefrm2_dcl_005*/" utility file listed in the AutoCAD command line window)"; } :text_part{label="";} } :toggle{key="user1"; label=/*wirefrm2_dcl_007*/"Substitute wire color/gauge label text for LAYER names"; } :toggle{key="user2"; label=/*wirefrm2_dcl_008*/"Substitute DESC1-3 for CMP:PIN1 and CMP:PIN2 fields"; } :toggle{key="user3"; label=/*wirefrm2_dcl_009*/"User function 3"; } ok_cancel; } "clw336" wrote in message news:6737259.1089925504857.JavaMail.jive@jiveforum1.autodesk.com... > Does anyone know of an easy way to add the block DESC attributes to the to from list?
Message 3 of 5
cwhitaker
in reply to: cwhitaker

Thank you, i will give that a try.
Message 4 of 5
rsriram
in reply to: cwhitaker

I needed to add the DESC1-3 on my wirelist and hence I tried copying the Lisp routine you have given completely and replaced it with the orginal wirefrm2.lsp file.
Whenever I try to hit the User Post button after generating a wire from - to report, the whole window displaying the wirelist closes and the mouse returns to the main autocad drawing window. (also I noted that whenever I do this....there is a message on my command prompt: Error : Misplaced Dot on Input). So I never am able to reach the menu for toggling the second option. Any help from you would be appreciated. I am running ACADE 2005. Thanks.
Message 5 of 5
Anonymous
in reply to: cwhitaker

All,

It was called to my attention that the lisp utility below does not work.
I've attached a corrected version that seems to work okay for 2006 and
2007beta. Put into your c:\program files\autodesk\acade 2006\support\"
folder and overwrite existing (good idea to back up before overwriting!).
Run the normal Wire From/To report. When report display, pick the "User
post" button. Then select option 2 on subdialog. Report re-displays. Include
fields CMP:PIN1 and CMP:PIN2 in your report display. These should now show
the destination component DESC1-3 values.

I apologize for causing this confusion.

Nate.


"Nate Holt" wrote in message
news:3950146@discussion.autodesk.com...
The AcadE wire From/To report does not currently list the FROM and TO
component's DESC1-3 attribute values as optional fields to include in the
report. One way to add them is to modify the sample wirefrm2.lsp "User
post-processing" utility so that it will query the project's COMP table
where these attribute values are stored and merge them into the existing
Wire From/To report.

The standard "post-processing utility" code below has been slightly modifed
to do the above. This is set up for AcadE 2005. If you want to apply this to
AcadE 2004 then you'll need to cut and paste the modified code below into
the AcadE 2004 version of c:\program files\autodesk\support\wirefrm2.lsp.

To get the extra fields, run the From/To report. With the report displayed
on screen, select the "User Post" button. Select the 2nd toggle. Now make
sure that CMP:PIN1 and CMP:PIN2 fields are included in the report. You
should see that the from and to component DESC attribute values are now
sitting in these two report columns.

If you have questions or problems with this approach, let me know!
thanks,
Nate.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost