Share

entlast (AutoLISP)

Product Documentation
Intermediate

Returns the name of the last nondeleted main object (entity) in the drawing

(entlast)

The entlast function is frequently used to obtain the name of a new entity that has just been added with the command function. To be selected, the entity need not be on the screen or on a thawed layer.

Return Values

An entity name; otherwise nil, if there are no entities in the current drawing.

Examples

Set variable e1 to the name of the last entity added to the drawing:

Command: (setq e1 (entlast))

<Entity name: 2c90538>

If your application requires the name of the last nondeleted entity (main entity or subentity), define a function such as the following and call it instead of entlast .

(defun lastent (/ a b) 
  (if (setq a (entlast))         Gets last main entity
    (while (setq b (entnext a))  If subentities follow, loopsuntil there are no more 
      (setq a b)                 subentities 
    ) 
  ) 
  a                              Returns last main entity 
)                                or subentity

Was this information helpful?