The AutoCADET's Guide to Visual LISP: Optimize and Customize Your AutoCAD Design Environment

AutoCAD drawings contain entities that you can manipulate using Visual LISP. Due to the legacy of Visual LISP, you can access these entity objects using two different strategies. These strategies differ based on how you address drawing objects such as lines and arcs. The older but still effective approach uses entity data types first introduced in AutoLISP. The newer approach uses the same object-oriented programming techniques as Visual BASIC and Visual C++ when interfacing with AutoCAD. You can use these approaches separately or can combine them in your programs.
This chapter introduces the Visual LISP subrs for entity manipulations. The subrs require either an entity name or an entity object ID that points to an entity in the drawing. The name or ID is obtained directly from the drawing, so the first topic in the chapter is how data is stored in a drawing.
You can access objects in a drawing database from three levels: entities, selections, and tables. Entity access involves entity names or object IDs obtained from the drawing as the result of a user selection on the screen, a sequential read of the drawing file, or a pointer stored in a selection or table entry.
A table is a collection of similar or related data. In the case of an AutoCAD drawing, a table is used to store layer specifics, line type details, and viewport data. Tables are used also to store block names, and block definitions are tables of entity objects. In...