Customization Using ACAD.LSP – Part 2

In part 1 of this series, we discussed how to customize AutoCAD using an ACAD.LSP file.  We started with a simple example where we used an ACAD.LSP file to set an AutoCAD variable – FILEDIA.  Next, we’ll extend the ACAD.LSP to set the set the path and number of minutes between saves for automatic save files:Before I get into it, I want you to be aware that AutoCAD profiles are another method for delivering customizations to your users.  The functionality of an ACAD.LSP and profile can actually overlap.  Either method could be used to set the time and path for automatic save files.  (I’m not a big fan of automatic save files, by the way.  Qsave should become second nature for any AutoCAD user.)

Which option should you choose?  Do you want to preset a value and then allow the user to change it?  Or do you want to reset the value every time the user opens AutoCAD?  If you want to allow the user to change it, use an AutoCAD profile.  If you want to enforce a set value, use ACAD.LSP.  Trying to make this decision can be far more daunting then any technical challenge!  If you’re going to tell a curmudgeonly, veteran AutoCAD user that you are going to reset their SAVETIME variable whenever they start AutoCAD, you might as well join the witness protection program.

I digress.  Our goal is to use an ACAD.LSP to set the SAVETIME variable and additionally, to set the location where the autosave file will be stored.  Here you go:For the SAVETIME variable, we do the same thing as we did for the FILEDIA variable – use the setvar command.  To set the path for the automatic save files, use setenv.  Note the need for the double backslashes in the path.  Also note that lines starting with a semicolon are comments and do not run..

How do you know whether you should use setvar or setenv?  If the setting is controlled by a variable, meaning that you can type that variable directly into the command line and change the value, then you can use setvar.  In this case for SaveFilePath you could use either setvar or setenv.  This is not always the case, for example if you wanted to hide or show the model/layout tabs, then you can use the following:

(setenv “ShowTabs” “1”)

Setvar will not work for this however.  The best way ensure that a line in your lisp file such as this will work it to is to type it directly into the AutoCAD command line.  Make sure that you include the open and closing parentheses.

No Comments Yet

Leave a Reply

Your email address will not be published.

Back to blog

Copyright ©2017, CAD Masters, Inc.. All Rights Reserved.