please do NOT run this on a production dwg and thanks for any feedback.
;;; read and write extended entity data
;;; adds a user note to an entity and date stamp
;;; version 0.1 Tue May 04, 2004
(defun idate () (atoi (rtos (getvar 'cdate) 2 0)))
(defun make-lst (xname note)
(list
(list -3
(list xname (cons 1000 note) (cons 1040 (idate))))
)
)
(defun chk-for (xapp ent)
(assoc 1000 (cdr (cadr (assoc -3 (entget ent (list xapp))))))
)
(defun set-xdata (/ xapp ent kwd note new_ent)
(setq xapp "user_xnote")
(if (setq ent (car (entsel "\nSelect entity: ")))
(if (chk-for xapp ent)
(progn
(initget 1 "Yes No")
(setq
kwd (getkword
"\nEntity has note attached, overwrite? (Y/N): "
)
)
(if (= kwd "Yes")
(setq note (getstring T "\nEnter note: "))
)
)
(setq note (getstring T "\nEnter note: "))
)
)
(if (and note (/= note ""))
(progn
(setq new_ent
(append (entget ent) (make-lst xapp note))
)
(entmod new_ent)
)
)
(princ)
)
(defun read-xdata (/ xapp ent xd)
(setq xapp "user_xnote")
(regapp xapp)
(if (setq ent (car (entsel "\nSelect entity: ")))
(setq xd (assoc -3 (entget ent (list xapp))))
)
(if xd
(princ
(strcat
"\nNote: "
(cdr (assoc 1000 (cdr (cadr xd))))
"\nDate : "
(rtos (cdr (assoc 1040 (cdr (cadr xd)))) 2 0)
)
)
)
(princ)
)
(defun c:xNotes (/ kwd)
(regapp "user_xnote")
(initget "Add Read")
(setq kwd
(getkword "\nDo you want to Add or Read notes? (A/R) <Add>: ")
)
(cond ((or (= kwd nil)(= kwd "Add"))
(set-xdata))
((= kwd "Read")
(read-xdata))
)
)