Creating Objects in AutoCAD

This section describes creating a line, circle, layer, and group in AutoCADand shows how AutoCAD adds these objects to the database. First, suppose the user creates a line in model space with the following command:

line 4,2 10,7

In the database, AutoCAD creates an instance of class AcDbLine and then stores it in the model space block table record as shown in the following illustration:

When you first invoke AutoCAD and the database is in its default state, entities are added to model space, the main space in AutoCAD, which is used for model geometry and graphics. Paper space is intended to support “documentation” geometry and graphics, such as drafting sheet outlines, title blocks, and annotational text. The entity creation commands in AutoCAD (LINE, in this case) cause the entity to be added to the current database as well as to the model space block. You can ask any entity which database and which block it belongs to.

Next, suppose the user creates a circle with this command:

circle 9,3 2

Again, AutoCAD creates an instance of the appropriate entity—here, AcDbCircle—and adds it to the model space block table record.

Next, the user creates a layer:

layer _make mylayer

AutoCAD creates a new layer table record to hold the layer and then adds it to the layer table.

Finally, the user groups all the entities together:

group 3,2 9,3

AutoCAD creates a new group object and adds it to the GROUP dictionary, which is contained in the named object dictionary. The new group contains a list of the object IDs of the objects that compose the group.