Share this Page URL
Help

Part V: Becoming a Master of AutoCAD > A Primer for AutoLISP and VBA - Pg. 525

525 Chapter 21. A Primer for AutoLISP and VBA In this chapter Getting Started with AutoLISP Using the Auto LISP Editor Interacting with the AutoCAD Drawing Database Adding a Dialog Box in AutoLISP Overview of the VBA Model Exploring the VBA Integrated Development Environment Starting a New VBA Project Running and Debugging Your VBA Program Using More Objects, Methods, and Properties Creating a Form in VBA Event-Driven Programming Running VBA Programs Using VBA and AutoLISP With AutoCAD 2000, the range of programming options available to the CAD user has been signif- icantly extended. Historically, AutoLISP was the engine that drove AutoCAD. Until Release 13, AutoLISP was integrated into the core code of AutoCAD. The world of software has since gone through a revolution known as object-oriented programming, and AutoCAD has kept pace with this revolution. With AutoCAD 2000, the conversion of AutoCAD to a fully object-oriented program is complete. The AutoCAD 2000 model enables multiple interfaces with a range of programming lan- guages, including Visual Basic for Applications (VBA). Although AutoLISP still retains its popularity, VBA is being increasingly used as a programming environment for AutoCAD customization. This chapter takes a look at the basic features of these two application programming interfaces (API's): AutoLISP and VBA. Whether you are experienced in AutoLISP or are a new developer, you will want to take a look at both of these environments in AutoCAD 2000. In this chapter, you will develop a set of programs in the AutoLISP environment; then you will review the same programs in the VBA environment. This approach is designed to give you a direct feel for the possible strengths and limitations of each programming environment. At the end of this chapter, you should be able to decide which environment is best suited to your purposes. All the programs you work with in this chapter are available on the CD that comes with this book. You should make yourself a folder for your programming exercises (for example, create one called "My Programs") and copy all the programs that begin with CH21 into that folder. You should then add this folder to the AutoCAD search path, using the Options command. If you want to learn more about the AutoCAD search path, see the section "Adding a Folder to the AutoCAD Search Path," later in this chapter.