entmod
 
 
 

Modifies the definition data of an object (entity)

(entmod elist)

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.

Arguments

elist

A list of 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

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

Examples

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:

Command: (setq en1 (entnext))

<Entity name: 2c90520>

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

Command: (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:

Command: (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:

Command: (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))

Restrictions on Using entmod

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

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.
See Also