cadman6735 Posted July 25, 2011 Share Posted July 25, 2011 I stumbled across environment variables. (getenv) (setenv) I was able to find a list of environment variables from HyperPics and AfraLisp, where can I find the environment variables in the Developer Guide (Help Menu) of AutoCAD itself? I want to find an up to date list that comes with AutoCAD 2012. Thanks Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 26, 2011 Share Posted July 26, 2011 Express Sytem variable editor oops sorry this is for vars getvar setvar Quote Link to comment Share on other sites More sharing options...
irneb Posted July 26, 2011 Share Posted July 26, 2011 Uhmm ... do you mean the system variables: http://docs.autodesk.com/ACD/2011/ENU/filesACR/WSfacf1429558a55de6d0beb1006696e53b-6076.htm If you mean the lisp functions: http://docs.autodesk.com/ACD/2011/ENU/filesALR/WSfacf1429558a55de1a7524c1004e616f8b-5913.htm If you mean the environment variables, you can see them all in the registry. Open RegEdit (type RegEdit into the search box on Vist/Win7's start menu, or type RegEdit into XP's Run.. dialog). Then browse to the registry key: HKEY_CURRENT_USER\Software\Autodesk\AutoCAD ... under which would be listed all the versions installed on your PC (including Verticals). E.g. my ACA 2011's is: HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.1\ACAD-9004:409, while my Vanilla 2011 is HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.1\ACAD-9001:409. For 2012 it would be under the R18.2 folder and then a similar code for the vertical. Under this, most of the standard environment variables are contained in: HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.1\ACAD-9001:409\Profiles\>\General There are some others under: HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.1\ACAD-9001:409\FixedProfile\General. Which is also where any custome environment variables you create will get saved. E.g. issuing this at AutoCad's command line: (setenv "MyOwn\\EnvSet" "testing setenv") Will create a new folder under the FixedProfile folder named MyOwn and a value in there named EnvSet with its contents as "testing setenv". See this screen capture: As a sample (the one most commonly used): (getenv "ACAD") gets the support folders. This is actually the ACAD value under: HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.1\ACAD-9001:409\Profiles\>\General Quote Link to comment Share on other sites More sharing options...
cadman6735 Posted July 27, 2011 Author Share Posted July 27, 2011 Irneb, Thank you very much for your detailed post the regedit was the part I was after (getenv "ACAD") Thank you Quote Link to comment Share on other sites More sharing options...
cadman6735 Posted July 27, 2011 Author Share Posted July 27, 2011 There are some others under: HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.1\ ACAD-9001:409\FixedProfile\General. Which is also where any custome environment variables you create will get saved. E.g. issuing this at AutoCad's command line: Code: (setenv "MyOwn\\EnvSet" "testing setenv") What is an example I can do with this? I can make my own folder, what would I put there and use it for? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 27, 2011 Share Posted July 27, 2011 What is an example I can do with this? I can make my own folder, what would I put there and use it for? Saving program settings between drawing sessions? But I prefer to save such settings to a txt/ini/cfg file as these are easier/safer for the user to remove. Quote Link to comment Share on other sites More sharing options...
irneb Posted July 27, 2011 Share Posted July 27, 2011 Anything you'd like. It's a "quick" way to save settings for your own addons to acad, so it remembers those even after acad closes. Useful when you've got some command which has default values for user entry. Same as with the Offset command, but say you want to have acad remember that same offset tomorrow as well (not just for this one drawing in this one session) ... you'd need to save it either to a file to be opened and read each time, or you'd save it to the registry using vl-registry-write and have a specific folder for yourself, or just use the setenv to have such value saved under acad's registry entries. Say you've got several of these commands, you'd like to group them into one folder so you can more easily export them. That's why you'd want a folder of your own instead of simply mixed in between acad's normal settings. Edit: But as Lee's pointed out, using a file is the most "portable" method. It's a bit difficult to get registry stuff moved between PC's and/or other versions of ACad. My seeing of this is everything which changes quite often (such as these default values) should be set in registry as it's generally more efficient to read & write to them than opening and closing files. Things which only change seldom (like settings) are better left for files, since these you'd probably want to copy to other PC's / Versions as well. Quote Link to comment Share on other sites More sharing options...
cadman6735 Posted July 27, 2011 Author Share Posted July 27, 2011 I see. it is mainly local to one machine vs. a file that can be sent to many machines. I read a post on afralisp where he was using an example of how to modify a profile for users out side of his local office with a lisp routine that modified the "ACAD" env to append profile settings to the users current profile. Got me curiouse. http://www.afralisp.net/archive/vl/acadset.htm I understand the regestry is a dangours place to play but it is better to play with education than with ignorance, thanks guy. Quote Link to comment Share on other sites More sharing options...
irneb Posted July 28, 2011 Share Posted July 28, 2011 You've got the idea about files! The registry shouldn't be a "dangerous place" it's meant to be used for settings (that's why Microsoft put it there). Prior to the registry each program in Win3 (and before) had to save all it's settings into various INI files. The registry is basically like a common INI file for everything. It's just that some programs (and even portions of Windows itself) relies on some values therein - their own settings. So you must be careful in deleting / modifying existing values. Officially you should make your own folder under the HK**/Software folder to store all your settings. That's why it would be preferable to use the vl-registry-* functions instead of setenv/getenv with some custom keyname/folder - it can be very easy to overwrite some setting in ACad inadvertently with that. The setenv is like a lazy-man's registry function. Say you have a setting only for one version of acad, but it needs to be different for another. If you go the recommended route of using the vl-registry-write, you'll need to somehow account for what version the setting is meant for (e.g. create sub-folders for each version). But with the setenv it's saved direct to that acad's version without you needing to even find out any info about it. Quote Link to comment Share on other sites More sharing options...
cadman6735 Posted July 28, 2011 Author Share Posted July 28, 2011 Thanks irneb you word it very well, thank you for helping me understand Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.