-
Controlling the Machine is no longer being updated. Don't worry, though, you can still follow Nate Holt at his new blog, AutoCAD Electrical Etcetera. You'll find it at http://nateholt.wordpress.com. Or you can subscribe to his feed to get latest words of wisdom automatically: http://nateholt.wordpress.com/feed/. You also can continue to view the Controlling Machine archives for Nate's AutoCAD Electrical tips and tricks.
-
User-post to import component descriptions into Wire From/To reports - AutoCAD Electrical
October 21, 2008, 12:05 PM Nate HoltThis request popped up this morning. User wants to include the connected component descriptions in the Wire From/To report. Currently this is not an option. But we can fill in the gap with a "User Post" !
Here is the main addition to the user-post utility wirefrm2.lsp:
(if (= user_5 "1") ; pull in component DESC1-3 values
(progn
; "nil"=get current proj mdb file name
(if (setq scratch_fnam (c:wd_mdb_get_proj_scratch_dbnam nil))
(progn ; have active project's scratch database filename.
; Now do a query on the COMP table to get a list of all
; component desc data
(setq complst (wd_oledb_select scratch_fnam (strcat
"SELECT HDL,DWGIX,DESC1,DESC2,DESC3 FROM [COMP]"
" WHERE DWGIX <> ''")))
(setq rtrn nil)
(foreach xx wd_rdata
; process CMP1. Get its handle and DWGIX value
(setq hdl (nth 39 xx))
(setq dwgix (nth 41 xx))
; Now search for this component in the query data
; from the scratch database
(setq hit nil)
(foreach x complst
(if (AND (= hdl (car x))(= dwgix (cadr x)))
(setq hit x)
) )
(if hit
(progn ; found match. Push three desc values into
; fields normally reserved for "from"
; component's panel XYZ coordinates
; PNLX1, PNLY1, and PNLZ1
(setq xx (wd_nth_subst 52 (nth 2 hit) xx)) ; DESC1
(setq xx (wd_nth_subst 53 (nth 3 hit) xx)) ; DESC2
(setq xx (wd_nth_subst 54 (nth 4 hit) xx)) ; DESC3
(princ hit)
) )
; process CMP2. Get its handle and DWGIX value
(setq hdl (nth 40 xx))
(setq dwgix (nth 42 xx))
; Now search for this component in the query data
; from the scratch database
(setq hit nil)
(foreach x complst
(if (AND (= hdl (car x))(= dwgix (cadr x)))
(setq hit x)
) )
(if hit
(progn ; found match. Push three desc values into
; fields normally reserved for "to"
; component's panel XYZ coordinates
; PNLX2, PNLY2, and PNLZ2
(setq xx (wd_nth_subst 56 (nth 2 hit) xx)) ; DESC1
(setq xx (wd_nth_subst 57 (nth 3 hit) xx)) ; DESC2
(setq xx (wd_nth_subst 58 (nth 4 hit) xx)) ; DESC3
) )
(setq rtrn (cons xx rtrn))
)
(setq rtrn (reverse rtrn))
(setq wd_rdata rtrn)
) ) )
)The key thing above is the query of the COMP table (about eight lines down) to read in all component handles and drawing index numbers along with DESC1-3 values. These handle/drawing index numbers are then used to find the matching connected component in each line of the report. The corresponding DESC1-3 values are then substituted into rarely used fields in the report.
... and here is the addition to the dialog defintion support file wirefrm2.dcl shown in bold text below:
:toggle{key="user1";
label=/*wirefrm2_dcl_007*/"Substitute wire color/gauge label text for LAYER names";
}
:toggle{key="user2";
label=/*wirefrm2_dcl_012*/"Report only selected INST values";
}
:toggle{key="user3";
label=/*wirefrm2_dcl_009*/"Report only non-cable connections";
}
:toggle{key="user4";
label=/*wirefrm2_dcl_013*/"Report only selected wire types";
}
:toggle{key="user5";
label="Include component DESC1-3 desc (into PNLX1-2,PNLY1-2,PNLZ1-2 fields)";
}If you want to get this a try, download these two files:
files/22201_22300/22273/file_22273.lsp - rename to wirefrm2.lsp
files/22201_22300/22274/file_22274.dcl - rename to wirefrm2.dcl
... and overwrite existing versions on your system (probably in folder "c:\documents and settings\all users\documents\autodesk\acade 2009\support\")
Then run your Wire From/To report. Select "User Post" and you should see a new option #5. Select it. Then hit "Change Report Format" and add in fields PNLX1-PNLZ1 and PNLX2-PNLZ2 to see the component descriptions from the "From" and "To" connected components respectively.
You must be logged in to post a comment.