;This lisp places a block with ATTs of "AREA" and "LAYER NAME" that are filled automatically and are related to an specific polyline or hatch defined by the user.
;
;NOTES: The block and its ATTs must be defined in the drawing prior to execute this routine.
;
;Definition of the lisp and its local variables
(defun c:prueba ()
;Requests the user to select a polyline or hatch and stores the selection into a variable.
(setq OBJ_REF (car (entsel "\n Selecciona una polilinea o un hatch: ")))
;Shows in the command line the entity name of the selected object.
(print OBJ_REF)(terpri)
;Shows in the command line the layer name of the selected object.
(princ (strcat "\n El layer del objeto es: "(cdr (assoc 8 (entget OBJ_REF)))))
;Requests the user to select the point where the block will be inserted and stores it into a variable.
(setq INS_PNT (getpoint "\n Indica el punto de insercion del bloque:"))
;Inserts the block in the position previously indicated by the user.