Adding an Entity to a Drawing

An application can add an entity to the drawing database by calling the entmake function. Like that of entmod, the argument to entmake is a list whose format is similar to that returned by entget. The new entity that the list describes is appended to the drawing database (it becomes the last entity in the drawing). If the entity is a complex entity (an old-style polyline or a block), it is not appended to the database until it is complete.

The following code fragment creates a circle on the MYLAYER layer:

(entmake '((0 . "CIRCLE")	 ; Object type 
		(8 . "MYLAYER")	 ; Layer 
		(10 5.0 7.0 0.0)	; Center point 
		(40 . 1.0)			; Radius 
) )

The following entmake restrictions apply to all entities:

For entity types introduced in AutoCAD Release 13 and later releases, you must also specify subclass markers (DXF group code 100) when creating the entity. All AutoCAD entities have the AcDbEntity subclass marker, and this must be explicitly included in the entmake list. In addition, one or more subclass marker entries are required to identify the specific sub-entity type. These entries must follow group code 0 and must precede group codes that are specifically used to define entity properties in the entmake list. For example, the following is the minimum code required to entmake an MTEXT entity:

(entmake '(
 (0 . "MTEXT")
 (100 . "AcDbEntity")   ; Required for all post-R12 entities.
 (8 . "ALAYER")
 (100 . "AcDbMText")	; Identifies the entity as MTEXT.
 (10 4.0 4.0 0.0)
 (1 . "Some\\Ptext")

The following table identifies the entities that do not require subentity marker entries in the list passed to entmake:

DXF names of entities introduced

prior to AutoCAD Release 13










POLYLINE (old-style)









The entmake function verifies that a valid layer name, linetype name, and color are supplied. If a new layer name is introduced, entmake automatically creates the new layer. The entmake function also checks for block names, dimension style names, text style names, and shape names, if the entity type requires them. The function fails if it cannot create valid entities. Objects created on a frozen layer are not regenerated until the layer is thawed.