- Oh no! An error has occurred!
- You need to be logged in to do that.
- You need to be logged in to do that.
-
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.
-
Quick, Project-wide SYSVAR report - AutoCAD Electrical
December 17, 2008, 08:17 AM Nate HoltYou're ready to ship out the 500-page drawing set. You forgot that you need to confirm that certain key AutoCAD system variables are preset to the customer's requirements. Are you looking at hours or minutes?
With AutoCAD Electrical, you might be able to use the AutoLISP utility (below) to generate a report on all drawings in a selected folder. I tested this on AutoCAD Electrical 2008 and 2009 and it seems to give good results. You can download the sample utility here:
files/23001_23100/23061/file_23061.lsp - rename it to lib_sysvar_list.lsp
To test:
1. APPLOAD above file
2. Type lib_sysvar_list.lsp [Enter] at command line.
3. This dialog appears. Browse to the target folder to report on.

4. Then, in the command window, enter a semi-colon delimited list of the SYSVARS you want to report on. Let's say you want to list the drawing's current selected layout tab, current layer name, OSnap setting, and current text style:
Command: LIB_SYSVAR_LIST [Enter]
File count:9
Enter SYSTEM VARIABLES to extract. Enter ";" delimited, no spaces.
Sysvars:CTAB;CLAYER;OSMODE;TEXTSTYLE [Enter]5. That should do it. The utility processes each drawing (without opening it in AutoCAD) and spits out the information to the command window and to an ASCII text file report.

There it is... looks like drawings "demo04" and "demo02" need some attention. All the other drawings are set per customer's requirements.
How does this thing work?
Here is the utility's code. There are a couple API calls in there specific to AutoCAD Electrical, so this thing will not work "as is" if the product is not present. A key call is shown highlighted. It attempts to read the AutoCAD drawing without opening it in the graphics window.
; 16-Dec-08 NEHolt created
(defun c:lib_sysvar_list ( / sysvar_lst x path str ff val dlst
dnam sysvar fout)
(setq sysvar_lst nil)
(setq x GBL_WD_BASELIBS) ; point at AutoCAD Electrical base symbol library
(if (not x)(setq x ""))
; Allow user to browse to target library folder
(setq path (c:wd_pview_folder "Select symbol lib folder to process" x))
; Make sure all slashes are "back slashes"
(if path (setq path (wd_4_all_slashes_backward (strcase path T))))
(if (AND path (/= path "")) ; user select some folder & no "Cancel"
(progn ; get list of all ".dwg" files in this folder
(if (not (setq dlst (wd_1a_dir_filelist path "*.dwg" nil 1)))
(princ "\nNo files found in this folder.")
; ELSE
(progn ; okay to continue
(princ "\nFile count:")(princ (length dlst))(princ "\n")
(princ (strcat
"Enter SYSTEM VARIABLES to extract. "
"Enter \";\" delimited, no spaces.\n"))
(setq str (getstring "Sysvars:" T))
(if (AND str (/= str ""))
(setq sysvar_lst (c:wd_delim_str_to_lst str ";"))
)
(if sysvar_lst
(progn ; okay to continue
; Open a text file to save results
(setq fout (open "c:/sysvar.rep" "w"))
(write-line path fout) ; output the "path" to the report file
(foreach dnam dlst
; Process each drawing
(princ "\n")
; Open dwg file using AutoCAD Electrical special function
(setq ff (wd_dbx_open dnam "r"))
(if ff
(progn
(foreach sysvar sysvar_lst
; Read the target system variable name
(setq val (wd_dbx_getvar ff sysvar))
(princ sysvar)(princ "=")(princ val)(princ " ")
; push out to the output file
(princ sysvar fout)
(princ "=" fout)
(princ val fout)
(princ " " fout)
)
; Attach drawing name to end of each line of display
(princ " Dwg=")(princ (cadr (c:wd_split_fnam dnam)))
; put out to the output file
(princ " Dwg=" fout)
(princ (cadr (c:wd_split_fnam dnam)) fout)
(princ "\n" fout)
(wd_dbx_close ff)
(setq ff nil)
) ) ) ) ) ) ) ) )
(if fout
(progn
(close fout) ; close the report file
(setq fout nil)
(princ "\nReport file= c:\\sysvar.rep")
) )
(princ)
)Disclaimer: this seems to work okay in AutoCAD Electrical 2008 and 2009, but suggest you run it against a COPY of your drawing set. I did not try it in earlier versions.
You must be logged in to post a comment.