Message 1 of 28
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is it possible to get a list of all system variable names in current AutoCAD revision via AutoLISP codes? Thanks!
Solved! Go to Solution.
Is it possible to get a list of all system variable names in current AutoCAD revision via AutoLISP codes? Thanks!
Solved! Go to Solution.
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?
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
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.
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.
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.
@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)
OR... YOU DON'T KNOW THAT YOU ARE ACTUALLY USING AUTOCADLT VERSION IN WHICH CASE SYSVDLG COMMAND IS NEVER GOING TO BE AN OPTION.
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.
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.
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)) )
....
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?