entmod (AutoLISP)


Modifies the definition data of an object (entity)

Supported Platforms: Windows and Mac OS


(entmod elist)

Type: List

Entity definition data in a format similar to that returned by the entget function.

For entity fields with floating-point values (such as thickness), entmod accepts integer values and converts them to floating point. Similarly, if you supply a floating-point value for an integer entity field (such as color number), entmod truncates it and converts it to an integer.

Return Values

Type: List or nil

If successful, entmod returns the elist supplied to it. If entmod is unable to modify the specified entity, the function returns nil.


The entmod function updates database information for the entity name specified by the -1 group in elist. The primary mechanism through which AutoLISP updates the database is by retrieving entities with entget, modifying the list defining an entity, and updating the entity in the database with entmod. The entmod function can modify both graphical and nongraphical objects.

There are restrictions on the changes the entmod function can make:

  • An entity's type and handle cannot be changed. If you want to do this, use entdel to delete the entity, and then make a new entity with the command or entmake function.
  • The entmod function cannot change internal fields, such as the entity name in the -2 group of a seqend entity. Attempts to change such fields are ignored.
  • You cannot use the entmod function to modify a viewport entity.

You can change an entity's space visibility field to 0 or 1 (except for viewport objects). If you use entmod to modify an entity within a block definition, the modification affects all instances of the block in the drawing.

Before performing an entmod on vertex entities, you should read or write the polyline entity's header. If the most recently processed polyline entity is different from the one to which the vertex belongs, width information (the 40 and 41 groups) can be lost.

WarningYou can use entmod to modify entities within a block definition, but doing so can create a self-referencing block, which will cause AutoCAD to stop.
NoteIn AutoCAD 2004 and later releases, the entmod function has a new behavior in color operations. DXF group code 62 holds AutoCAD Color Index (ACI) values, but code 420 holds true color values. If the true color value and ACI value conflict, AutoCAD uses the 420 value, so the code 420 value should be removed before attempting to use the code 62 value.


The following sequence of commands obtains the properties of an entity, and then modifies the entity.

Set the en1 variable to the name of the first entity in the drawing:

(setq en1 (entnext))
<Entity name: 2c90520>

Set a variable named ed to the entity data of entity en1:

(setq ed (entget en1))
((-1 . <Entity name: 2c90520>) (0 . "CIRCLE") (5 . "4C") (100 . "AcDbEntity") (67 . 0) (8 . "0")
(100 . "AcDbCircle") (10 3.45373 6.21635 0.0) (40 . 2.94827) (210 0.0 0.0 1.0))

Changes the layer group in ed from layer 0 to layer 1:

(setq ed (subst (cons 8 "1") (assoc 8 ed) ed ))
((-1 . <Entity name: 2c90520>) (0 . "CIRCLE") (5 . "4C") (100 . "AcDbEntity") (67 . 0) (8 . "1")
(100 . "AcDbCircle") (10 3.45373 6.21635 0.0) (40 . 2.94827) (210 0.0 0.0 1.0))

Modify the layer of the en1 entity in the drawing:

(entmod ed)((-1 . <Entity name: 2c90520>) (0 . "CIRCLE") (5 . "4C")
(100 . "AcDbEntity") (67 . 0) (8 . "1") (100 . "AcDbCircle") (10 3.45373 6.21635 0.0) (40 . 2.94827) (210 0.0 0.0 1.0))