|
|
AutoLISP has been enhanced with Visual LISP (VLISP), which offers an integrated development environment (IDE) that includes a compiler, debugger, and other development tools to increase productivity. VLISP adds more capabilities and extends the language to interact with objects using ActiveX. VLISP also enables AutoLISP to respond to events through object reactors.
Unlike in ObjectARX, or VBA, each document opened in the Multiple Design Environment (MDE) has its own Visual LISP namespace and environment. A namespace is an insulated environment keeping AutoLISP routines that are specific to one document from having symbol or variable name and value conflicts with those in another document. For example, the following line of code sets a different value to the symbol a for different documents.
(setq a (getvar "DWGNAME"))
Visual LISP provides mechanisms for loading symbols and variables from one namespace to another. More information about namespaces can be found in the AutoLISP Developer's Guide in the Help system. To display Developer Help, click Help menu Additional Resources Developer Help.
AutoLISP applications or routines can interact with AutoCAD in many ways. These routines can prompt the user for input, access built-in AutoCAD commands directly, and modify or create objects in the drawing database. By creating AutoLISP routines you can add discipline-specific commands to AutoCAD. Some of the standard AutoCAD commands are actually AutoLISP applications.
Visual LISP provides three file format options for AutoLISP applications:
- Reading an LSP file (.lsp)—an ASCII text file that contains AutoLISP program code.
- Reading an FAS file (.fas)—a binary, compiled version of a single LSP program file.
- Reading a VLX file (.vlx)—a compiled set of one or more LSP and/or dialog control language (DCL) files.
Because AutoCAD can read AutoLISP code directly, no compiling is required. While Visual LISP provides an IDE, you may choose to experiment by entering code at the command prompt, which allows you to see the results immediately. This makes AutoLISP an easy language to experiment with, regardless of your programming experience.
Even if you are not interested in writing AutoLISP applications, your AutoCAD package includes many useful routines. Routines are also available as shareware through third-party developers. Knowing how to load and use these routines can enhance your productivity.
For information about AutoLISP programming, see the AutoLISP Developer's Guide, and for information about AutoLISP and Visual LISP functions, see the AutoLISP Reference in the Help system. To display Developer Help, click Help menu Additional Resources Developer Help. AutoLISP programs can use dialog boxes with their applications. Programmable dialog boxes are described only in the AutoLISP Developer's Guide.