Returns the name of the last nondeleted main object (entity) in the drawing
(entlast)
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.
TheReturn Values
nil, if there are no entities in the current drawing.
An entity name; otherwiseExamples
e1 to the name of the last entity added to the drawing:
Set variableCommand: (setq e1 (entlast))
<Entity name: 2c90538>
entlast.
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(defun lastent (/ a b)
(if (setq a (entlast)) Gets last main entity
(while (setq b (entnext a)) If subentities follow, loops
until there are no more
(setq a b) subentities
)
)
a Returns last main entity
) or subentity