Chapters 23 and 24. Data in the Drawing/Tables

Chapter 23. Associating information to Graphic Objects

Although this book focuses on the management of graphical entities, we will refer briefly to an aspect of unquestionable relevance as is the association of alphanumeric information to drawing objects. Computer aided design applications have evolved into sophisticated systems providing intelligent solutions in a number of highly specialized fields. A special mention is deserved by those related to the automated generation of thematic maps, facilities management and georeferenced databases, usually identified by the well-known acronyms AM (Automated Mapping) FM (Facilities Management) and GIS (Geographic Information Systems). The key to all these developments is the possibility of linking additional information fields to the data that defines the entity in a strictly graphical sense.
Chronologically ordered, the features AutoCAD has been adding for associating alphanumeric information to graphic objects are:
  • Block Attributes
  • Extended Entity Data (XDATA)
  • XRECORD objects and Dictionaries
  • LDATA Dictionaries.

When storing non-graphic information in the drawing itself we should take into account issues such as the increase of the drawing’s size it implies and most of all the difficulties for maintaining the data integrity, which in any case must be ensured by the programmer whose application will make use of such data.
Large volumes of information are more conveniently stored it in external databases. This is a topic to which a whole book can be devoted. But this chapter must not be concluded without having at least indicated the way to follow for those interested in the subject.
Access to external databases is done in AutoCAD 2000 and subsequent releases through the ActiveX Data Objects (ADO) provided by Microsoft. AutoCAD’s Connectivity Automation Objects (CAO) are used to establish links between AutoCAD objects and external databases. In both cases these are ActiveX component libraries that must be imported before its methods and properties are available as Visual LISP functions.
Our purpose is not to describe the procedures for external database access and linking. Once the necessary components have been imported the programmer will be working in an area that is out of the scope of this book. As a programming language, Visual LISP provides many resources, but to understand the behavior of these new functions we must refer to these libraries specific documentation. For ADO it may be found in Microsoft’s ado210.chm Help file. The information on CAO components can be found in the online Help, under the Connectivity Automation (CAO) heading. For more information about ADO, you can search the Microsoft Website.
This chapter outlines the different ways in which Visual LISP ban be used to assign, retain and retrieve alphanumeric information within the drawing. The different ways to do this reflect the application’s development from its origins to the present day. We have seen that the information can be stored in three ways:
  • As part of the entity, assigning it to block attributes or as extended entity data (XDATA).
  • In autonomous containers within the drawing, which can be linked or not to entities: XRECORD objects, Dictionaries and LDATA Dictionaries.
  • In external databases, linked or not to the drawing’s entities.
Some applications built on AutoCAD incorporate their own variants for data management built on the features offered by these basic procedures. As an example we can point to the Object Data used by Autodesk MAP, implemented with a combination of Dictionaries and XDATA.
Although we do not delve into the topic of external databases, one of the applications included in this book (Chapter 25) shows how to extract the data in block attributes and export it to an Excel spreadsheet.

This Chapter includes the following sections:

23.1. Blocks with attributes.
23.2. Extended Entity Data (XDATA).
23.3. XRECORD objects and Dictionaries.
23.4. Sample Program: Data in Dictionaries.
23.5. LDATA Dictionaries.
23.6. Access to external databases.
23.7. Summary.
Your questions or comments about this Chapter's contents are welcome!

Chapter 24. Tables.

Since AutoCAD 2005 a new kind of object, the AcadTable can be used to automate the creation of tables in the drawing. This is a compound object containing data structured in a variable number of rows and columns. The AutoCAD 2012/2013 user interface is highly effective for managing tables using the commands described in Table 24.1.
Table 24.1. Commands for creating tables.
Command:Description:
_TABLECreates an empty table object for which style, number and height of rows and number and width of columns can be specified.
_TABLEDITEdits the text in a table cell.
_TABLESTYLECreates, modifies, or specifies table styles.

To create tables from Visual LISP we have the methods and properties exposed by the AcadTable object. These reproduce the effects of these commands from a Visual LISP application. The AcadTable class is the one which more specific methods (181) and properties (28) exposes, so addressing this topic in an exhaustive way in a book like this is not possible. However, for the usual applications just a very small subset of these methods and properties is necessary. To them we dedicate this chapter.
We will show how to program a Table with drawing data, in this case block attributes, but easily extensible to any type of data as those described in Chapter 23. We have only explained in this chapter the Table’s essential features, which in most cases may be enough. To create tables more elaborate in their format the AcadTable class exposed methods and properties may be used, but in many cases it will be easier to use one or more custom Table Styles.

This Chapter includes the following sections:

24.1. Fundamental Methods for working with TABLES.
24.2. Sample Program: Block attributes Table.
24.3. Summary.
Your questions or comments about this Chapter's contents are welcome!

Buy this book from CreateSpace eStore

No comments:

Post a Comment