AutoCAD Electrical General Discussion

AutoCAD Electrical General Discussion

Reply
*Wayne Gatlin
Message 1 of 2 (99 Views)

the use of %D (DWG no. in reports)

99 Views, 1 Replies
07-07-2004 01:27 PM
Does anyone have a solution? When running reports we often find it nessecary to include the Drawing Number in the report. For example when running a Wire To/From report we may wish to include the Drawing Number that a wire comes from as well as the one it goes to. The report manager allows this by selecting the "DWGNAM1" and the "DWGNAM2" fields in the "Data Fields to Report" dialogue. Now I believe that the values placed in these fields are derived from the %D field of the "Drawing Config & Defaults". I am able to auto update the %S (Sheet No.) value to the "Drawing Config & Defaults" by simply doing a Title Block update and "Resequencing" the sheet numbers. However, if I want the value to be filled into the %D this is a manual process that has to be done in each drawing's configuration or by editing the WD_M block's tag SHTDWGNAME in each drawing. For some this may not be an issue but it would certainly be nice to be able to set that tag = to another one say for example the the FILENAME. If there was a way to do this one could auto update the SHTDWGNAME attribute across the entire project and never have to fill it in manually...of course saving time. Does anyone have any suggestions on how we could do this? My guess would be a lisp routine that allows one to set the SHTDWGNAME value = to another value and then run this lisp through a script and use the AutoCAD Electrical Utilities to launch that script across the project. Then the resulting value could be used for whatever one chooses. Any suggections would be greatly appreciated... Wayne Gatlin
*Nate Holt
Message 2 of 2 (99 Views)

Re: the use of %D (DWG no. in reports)

07-07-2004 06:36 PM in reply to: *Wayne Gatlin
You can give this a try. It uses a couple calls from AcadE's "API". Cut and paste the program below into a file with a ".lsp" extension (ex: populate_percent_dee.lsp). APPLOAD it one time. Then create a one-line AutoCAD script file with just this in it: populate_percent_dee Now run AcadE's "Project-wide Utilities" command and reference your script file name in the "For each drawing... Run command script file" edit box. Select OK and then select all dwgs in your current project. That should do it. Nate. (defun c:smileytongue:opulate_percent_dee ( / ss en dwgnam ) (setq ss (ssget "_X" '((-4 . "")))) (if (/= ss nil) (progn (setq en (ssname ss 0)) ; get first or only instance of WD_M found on this drawing (if (setq oldval (c:wd_getattrval en "SHEETDWGNAME")) (progn ; see if it matches current drawing name. (if (setq dwgnam (getvar "DWGNAME")) (progn ; strip off any ".dwg" extension (setq slen (strlen dwgnam)) (if (AND (> slen 4)(= (strcase (substr dwgnam (- slen 3))) ".DWG")) (progn (setq dwgnam (substr dwgnam 1 (- slen 4))) (if (/= dwgnam oldval) (progn ; update (c:wd_modattrval en "SHEETDWGNAME" dwgnam nil) (princ "\n updated ") (princ oldval) (princ " --> ") (princ dwgnam) ) ) ) ) ) ) ) ) (setq ss nil) ) ) (princ) ) "Wayne Gatlin" wrote in message news:40ec5d8b$1_1@newsprd01... > Does anyone have a solution? > When running reports we often find it nessecary to include the Drawing > Number in the report. For example when running a Wire To/From report we may > wish to include the Drawing Number that a wire comes from as well as the one > it goes to. The report manager allows this by selecting the "DWGNAM1" and > the "DWGNAM2" fields in the "Data Fields to Report" dialogue. Now I believe > that the values placed in these fields are derived from the %D field of the > "Drawing Config & Defaults". > > I am able to auto update the %S (Sheet No.) value to the "Drawing Config & > Defaults" by simply doing a Title Block update and "Resequencing" the sheet > numbers. However, if I want the value to be filled into the %D this is a > manual process that has to be done in each drawing's configuration or by > editing the WD_M block's tag SHTDWGNAME in each drawing. For some this may > not be an issue but it would certainly be nice to be able to set that tag = > to another one say for example the the FILENAME. If there was a way to do > this one could auto update the SHTDWGNAME attribute across the entire > project and never have to fill it in manually...of course saving time. Does > anyone have any suggestions on how we could do this? My guess would be a > lisp routine that allows one to set the SHTDWGNAME value = to another value > and then run this lisp through a script and use the AutoCAD Electrical > Utilities to launch that script across the project. Then the resulting > value could be used for whatever one chooses. > > Any suggections would be greatly appreciated... > Wayne Gatlin > >
Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.
Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Electrical Category!

The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.