AutoCAD supports a multiple document interface, and ObjectARX applications running within AutoCAD must operate properly in the MDI environment. Three principles must be observed for an ObjectARX application to provide MDI support:
- An application must maintain document-specific state on the stack, in a database, or in a structure that can be indexed through the corresponding document pointer.
- All documents must be locked to be modified. Basic document locking is handled automatically for AutoCAD commands, ObjectARX commands, and AutoLISP
®
functions. Modeless dialog and toolbar code, and any commands that need to work outside the active document must manually perform document locking.
- The application must maintain the relationships between documents and databases. The AutoCAD database library (AcDb) is unaware of documents and MDI, and should remain so.
Several architectural features of ObjectARX make supporting the MDI possible. These include separate execution contexts, data instances, document locking, and the document management classes. The following sections discuss these topics in more detail.