Set default system variables in acaddoc.lsp

We covered about acaddoc.lsp in AutoLISP tutorial. Acaddoc.lsp will execute commands defined in it, every time AutoCAD open a file.

acaddoc

What can we do with acaddoc.lsp?

Now if you know you can run commands automatically when you open a file, what would you do?

  1. You can load AutoLISP file automatically.
  2. You can define new command. In the tutorial, we redefine PLOT command to update datalink before AutoCAD starts to plot.
  3. You can run commands before you start working with your file.
  4. You can set system variable before you start working.

In this article, we are going to focus to the last one. I found that there are many users confused why their AutoCAD doesn’t work as usual. And they become regular questions. These are some samples of changed system variables.

Common unexpected system variables change

These are several common system variables that change regularly.

  1. File dialog box is missing. You have to type file path and file name from command line. It’s because FILEDIA system variable has changed.
  2. AutoCAD default noun-verb selection becomes verb-noun selection. It’s because PICKFIRST system variable has changed.
  3. Single document interface is activated. It’s controlled by SDI system variable.
  4. And more…

There is a debate why they changed. Most people think that it was because routines in AutoLISP or other 3rd party applications. I used to be agree with it, until I saw this problem also happens in AutoCAD LT. So it remains a mystery to me.

We can force to set the variables in acaddoc.lsp

Harold Reuvers reminds me that we can set those variables in acaddoc.lsp. I prefer to backup my system variables and restore them when I have problem. We can’t remember all the variables, right?

However, if you have specific system variable that changes often, this is a good solution.

All you need is to create an acaddoc.lsp using notepad or visual LISP editor.

Just type these code:

(SETVAR "PICKFIRST" 1)

Feel free to add more lines or change system variables and values as you preferred.

If you want to learn how to use Visual LISP editor, see this basic AutoLISP tutorial.

What system variables do you find change often?

Do you find system variables in your AutoCAD change often? What are they?

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *