System and Environment Variables
 
 
 

With the getvar and setvar functions, AutoLISP applications can inspect and change the value of AutoCAD system variables. These functions use a string to specify the variable name. The setvar function specifies a value of the type that the system variable expects. AutoCAD system variables come in various types: integers, real values, strings, 2D points, and 3D points. Values supplied as arguments to setvar must be of the expected type. If an invalid type is supplied, an AutoLISP error is generated.

The following code fragment ensures that subsequent FILLET commands use a radius of at least 1:

(if (< (getvar "filletrad") 1)
  (setvar "filletrad" 1)
)

See the Command Reference for a list of AutoCAD system variables and their descriptions.

An additional function, getenv, provides AutoLISP routines with access to the currently defined operating system environment variables.