Drawings SDK Developer Guide > Working with .dwg Files > Introduction > Drawing Database Overview > Entities and Blocks
Entities and Blocks

This topic introduces entities — objects with a graphical representation, and blocks — owner objects for entities.

Entities are objects that have a graphical representation. Examples of entities are lines, circles, text, etc. Entities can be simple (like lines and points) or complex (like text and multilines).

Each entity object has properties which are common for all entities and properties which are specific for particular entity types and stored in the entity class. Common properties contain the information about an entity's color, linetype, visibility, layer that contains the entity, lineweight, and so on. Specific properties define the parameters of separate kinds of entities. For example, center and radius for a circle, start and end points for a line, etc. A property can be accessed by the corresponding access method of the entity object so that you can get values of read-only properties and get or set values for read/write properties.

All entities are owned by blocks. A block is considered a composition of geometrical objects (entities) that has a unique name and processed as a single whole. This composition of entities is a self-contained object that can be used as an entity in another block. Blocks allow you to create composite geometrical objects from simple geometrical objects and use them as entities in the current drawing or any other drawing. You can use composite objects to create more composite objects by pasting one block into another block.

All blocks are stored in the block table as block table records; the block table is the container for blocks which are containers for entities:

Therefore, to create a database entity you need to do the following:

  1. Create the geometrical object.
  2. Open the block table.
  3. Open a block table record object which will be used to store the entity within the block table.
  4. Call the appending method of the block table record object to append the entity to the block.

Then the geometrical object is an entity object in the database.

Block definitions and Block references

The blocks mechanism allows inserting once defined block in the drawing for multiple times by creating references to the block in the specific position.

Collection of one or more entities that are the geometry of a block and represented by a record in the block table is a Block Definition object.

A Block Reference is an object that specifies a block instance in the entities collection of another block and represents the geometry of a block in a drawing.

The following example demonstrates a drawing in which the scheme of an apparatus can be divided into conditional modules: (1) — branch, (2) — cap with branch, (3) — valve, and case. Except case, each module is represented by a block that contains entities plotting it.

See Also

Overview of Blocks

Overview of Entities

 

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