IN THIS CHAPTER
Understanding local and global variables
Working with Visual LISP ActiveX functions
Using the Error Trace window
Using the Watch window
This chapter builds on the previous two chapters and introduces you to a few advanced AutoLISP topics, including local and global variables, ActiveX, and debugging.
AutoCAD LT does not support AutoLISP, and so this entire chapter is for AutoCAD only.
In this section, you read how local and global variables are accessed within a function, as well as some common syntax. You also discover what can happen when global variables are not properly documented.
Chapter 35 explained that a variable is a symbolic name that can be operated on in a given program. An important part of using variables is being able to assign values to them. There are two types of variables, global and local.
A global variable is exposed, or available, to all AutoLISP functions that you've loaded into your drawing. A global variable retains its value after the program that defined it is finished. You use a global variable when you want its value to be available across an entire project, as opposed to just one function within a project. This allows you to retain a fixed value that might be used and assigned by different functions, or for debugging. Any variable that you don't specifically define as a local variable is a global variable.
A local variable is temporarily assigned ...