How to get a list of all system variable names in current AutoCAD revision?

How to get a list of all system variable names in current AutoCAD revision?

sby0531
Enthusiast Enthusiast
4,810 Views
27 Replies
Message 1 of 28

How to get a list of all system variable names in current AutoCAD revision?

sby0531
Enthusiast
Enthusiast

Is it possible to get a list of all system variable names in current AutoCAD revision via AutoLISP codes? Thanks!

0 Likes
Accepted solutions (1)
4,811 Views
27 Replies
Replies (27)
Message 2 of 28

Moshe-A
Mentor
Mentor

@sby0531  hi,

 

i do not know if there is a way to retrieve all sysvars but have a idea 😀

dxfout one of our template drawing (one time action) then read in header section.

 

Moshe

 

Message 3 of 28

sby0531
Enthusiast
Enthusiast

Thank you, Moshe.

I have no idea on how to get information such as sysvars from such a dxf file. Do you know  where I can get help in this respect?  

0 Likes
Message 4 of 28

Moshe-A
Mentor
Mentor

@sby0531 

 

try this 🤣

to retrieve sysvars current values, use (getvar) function

 

Moshe

 

 

 

(defun c:insysvars (/ fname f rec lst)

 (cond
  ((not (setq fname (getfiled "Select dxf file" (getvar "dwgprefix") "dxf" 8)))) ; select existing file
  ((not
     (and
       (eq (vl-filename-directory fname) "")   
       (setq fname (strcat (getvar "dwgprefix") fname))
     )
   )
  ); case
  ((not (setq f (open fname "r")))); open file for read
  ( t
   (while (and
	    (setq rec (read-line f))
	    (/= rec "HEADER")
	  )
    nil
   ); while

   (if rec
    (while (and (setq rec (read-line f))
	       (/= rec "ENDSEC")
	  )
     (if (eq (substr rec 1 1) "$")
      (setq lst (cons (substr rec 2) lst))
     )
    )
   ); if
   
   (setq f (close f))
  )
 ); cond

 (if lst 
  (princ (reverse lst))
  (prompt "\nNo sysvars found in dxf file.")
 )
  
 (princ)
); c:insysvars

 

 

 

 

Message 5 of 28

sby0531
Enthusiast
Enthusiast

Thank you very much for your big help. The program you wrote works very well. But did you noted that the quantity of sysvars retrieved from the dxf file is only 253, much less than that of all the sysvars in AutoCAD ? You know there are 674  sysvars in AutoCAD 2015. 

0 Likes
Message 6 of 28

ВeekeeCZ
Consultant
Consultant

FYI, you can get a list from the SYSVDLG command.

 

BeekeeCZ_0-1678270464821.png

 

Message 7 of 28

Moshe-A
Mentor
Mentor

What is your goal?

 

 

0 Likes
Message 8 of 28

sby0531
Enthusiast
Enthusiast

My goal is to record all the sysvars and theirs values in AutoCAD being used so as to find the differences via comparing them with those recorded in a txt file.

0 Likes
Message 9 of 28

ВeekeeCZ
Consultant
Consultant

@ВeekeeCZ wrote:

FYI, you can get a list from the SYSDLG command.

 


 

Or get a list from its sysvdlg.dat.

0 Likes
Message 10 of 28

sby0531
Enthusiast
Enthusiast

I didn't find SYSDLG command in AutoCAD  2023. Is anything wrong?

0 Likes
Message 11 of 28

sby0531
Enthusiast
Enthusiast
Yes, SYSVDLG command.
0 Likes
Message 12 of 28

dbroad
Mentor
Mentor

Note: some sysvars are stored in the registry. Others are stored in the drawing.  While the actual variable names stay the same within each version, the values change moment by moment as the user works on the drawing,  with the user profile, with the toolkit being used (such as ACA, MEP, or CIV3D), and as Lisp programs make changes. Storing values of "All" the variables will accomplish very little except as an academic study.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 13 of 28

sby0531
Enthusiast
Enthusiast

Unfortunately, the version of AutoCAD that I am using is 2015.

0 Likes
Message 14 of 28

pendean
Community Legend
Community Legend
Accepted solution

@sby0531 wrote:

...I didn't find SYSDLG command in AutoCAD  2023. Is anything wrong?...

...Unfortunately, the version of AutoCAD that I am using is 2015....


It appears you don't know about a few important things, but here is one easy fix, you forgot to install Express Tools in your AutoCAD version (whichever it is)

pendean_0-1678284042553.png

 

 

OR... YOU DON'T KNOW THAT YOU ARE ACTUALLY USING AUTOCADLT VERSION IN WHICH CASE SYSVDLG COMMAND IS NEVER GOING TO BE AN OPTION.

Message 15 of 28

sby0531
Enthusiast
Enthusiast

You are right. The problem I want to solve is to find the differences of sysvars values between those in two different drawings since some command behaves differently in the two drawings.

0 Likes
Message 16 of 28

dbroad
Mentor
Mentor

If SYSVDLG, doesn't work for you, I would open each drawing.  Then LOGFILEON.  Then SYSVAR ?.  Hit return between 20 and 50 times until the list ends.  Then LOGFILEOFF.  Use OPTIONS, Files tab to locate the log files and compare them.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 17 of 28

john.kaulB9QW2
Advocate
Advocate

I had to do this once or twice. I found it easier to use a predefined list of "common problem variables" to dump/check against (-i.e. there are so many variables/problem areas you'll drive yourself crazy trying to DIFF them). Your list of variables will differ but here is an example of a simple dump function I would make for quick checks for my end-users problems. The more detailed dump I would have a .DAT file to host the variables (I do not have that DAT file with the variables anymore).

 

I had this in a file and if they had a weird setting I would have them load this lisp and it would save the dump to a shared directory where I could access it. 

 

Good luck.

( (lambda ()
   (setq sys-var-list
         '("ACAD" "ANSIHatch" "ANSILinetype" "ISOHatch" "ISOLinetype"
           "StartUpType" "Measureinit" "InsertUnitsDefSource"
           "InsertUnitsDefTarget" "LastTemplate" "Pickstyle" "Coords"
           "ShowProxyDialog" "Osmode" "EdgeMode" "PAPERUPDATE" "ACADPLCMD"
           "ImageHighlight" "Attdia" "Attreq" "Delobj" "Dragmode" "UseMRUConfig"
           "PLSPOOLALERT" "PLOTLEGACY" "PSTYLEPOLICY" "OLEQUALITY" "Anyport"
           "Validation Policy" "Validation Strategy" "CommandDialogs"
           "TempDirectory" "PlotSpoolerDirectory" "DefaultLoginName" "MenuFile"
           "NetLocation" "ACADDRV" "ACADHELP" "PrinterConfigDir"
           "PrinterStyleSheetDir" "PrinterDescDir" "NewStyleSheet"
           "DefaultFormatForSave" "DefaultConfig" "LastModifiedConfig"
           "MRUConfig" "ACADLOGFILE" "MaxDwg" "AVEMAPS" "TemplatePath"
           "DatabaseWorkSpacePath" "DefaultPlotStyle" "DefaultLayerZeroPlotStyle"
           "LineWeightUnits" "LWDEFAULT" "CustomColors" "Blipmode" "ToolTips"
           "acet-Enable" "acet-MenuLoad" "AcetRText:type" "CmdVisLines"
           "MaxHatch" "AutoSnapColor" "AutomaticSaveMinutes"
           "SDF_AttributeExtractTemplateFile" "AutoSnapPolarAng"
           "AutoSnapPolarDistance" "AutoSnapPolarAddAng" "AutoSnapControl"
           "AutoSnapTrackPath" "PickBox" "AutoSnapSize" "PickFirst" "PickAuto"
           "MenuOptionFlags" "FontMappingFile" "LogFilePath"
           "PSOUT_PrologFileName" "MainDictionary" "CustomDictionary"
           "MTextEditor" "XrefLoadPath" "SaveFilePath" "AcadLspAsDoc"
           "Background" "Layout background" "XhairPickboxEtc"
           "LayoutXhairPickboxEtc" "Autotracking vector" "MonoVectors" "FontFace"
           "FontHeight" "FontWeight" "FontItalic" "FontPitchAndFamily"
           "CursorSize" "HideWarningDialogs" "SDIMode" "CmdLine.ForeColor"
           "CmdLine.BackColor" "TextWindow.ForeColor" "TextWindow.BackColor"
           "CmdLine.FontFace" "CmdLine.FontHeight" "CmdLine.FontWeight"
           "CmdLine.FontItalic" "CmdLine.FontPitchAndFamily"
           "TextWindow.FontFace" "TextWindow.FontHeight" "TextWindow.FontWeight"
           "TextWindow.FontItalic" "TextWindow.FontPitchAndFamily"))
   (setq fp (open (strcat "C:\\temp\\" (getvar "LOGINNAME") "--Settings.txt") "A"))
   (mapcar 
     '(lambda (x) 
        (setq y (eval (list 'getenv x)))
        (write-line
          (strcat x "  ::  " (if (not y) "nil" y) ) fp)) 
     sys-var-list)
   (close fp)) )

 

another swamper
Message 18 of 28

Kent1Cooper
Consultant
Consultant

....

Kent Cooper, AIA
0 Likes
Message 19 of 28

sby0531
Enthusiast
Enthusiast
Very good. Thank you!
0 Likes
Message 20 of 28

sby0531
Enthusiast
Enthusiast

I've been trying to get the whole list of environment variables in AutoCAD and finally got it here. I wonder how or where did you get it? 

0 Likes