Drawings SDK Developer Guide > Working with .dwg Files > Working with Databases > Database Structure
Database Structure

The database is a repository for various graphical and non-graphical objects. Programmatically, the database can be represented as a container of various objects subdivided into collections. Each collection contains and manipulates objects of a specific type. The database provides two mechanisms for storing and working with objects in collections:

  • Predefined tables of named records — Predefined tables are a fixed set of collections with a fixed structure of specific objects that have fixed types and a fixed set of accessible operations. This mechanism requires hard typification of classes for working with objects and uses a predefined set of classes for each pair: <record object – table object>. The record object stores the definition and properties of one specific object. The table object stores all record objects of the same type and can be used to manipulate them. The table object can store only record objects of its own type. Each record has a specific class type and each table also has a specific class type. The database stores the following objects as tables of records: blocks, layers, linetypes, dimension styles, text styles, user coordinate systems, registered applications, views, and viewports. For more details, see Working with Predefined Tables of Named Records.
  • Dictionaries of objects — Dictionaries are a unified collection that can store and manipulate objects of various types, including itself. This mechanism requires one class that implements the collection and a set of classes that implements specific objects. An object of any class can be added in the collection, and a collection can store both objects of the same class and objects of different classes. The collection can store other collections, forming a tree-shaped hierarchical structure of objects. The hierarchical structure of collections provides the ability to dynamically modify and extend the database without restructuring its internal format. The database stores the following objects as dictionaries: layouts, plot settings, materials, multiline styles, multileader styles, visual styles, table styles, place holders (plot style names), groups, colors, scales, and custom objects. The database also uses dictionaries for attaching various custom data to the stored objects. For more details, see Working with Dictionaries of Objects.

Both mechanisms provide a standard interface for adding, identifying, renaming, searching, getting, and iterating objects in collections. Objects contained in collections have their own interfaces for modifying their properties.

The general collection structure of the database is the following:

The database has two general instances of block objects: model space that is used to access the main geometry of a drawing using the model layout and paper space that is used to access geometry of the current paper layout.

See Also

Working with Databases

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.