 ; Chg - change entity data directly. 
 ; Copyright 1990, 2002 by Rocket Software Ltd.
 ; Caution: Do not let this program fall into the wrong hands. (Eat the disk.)
 (DEFUN C:CHG ( / aa as au zz xx rr)
  (command "undo" "mark")
  (setq aa (entget (car (entsel "Pick entity to change:"))))
  (print aa)
  (setq as (getint "\nAssociation number to replace: "))
  (cond ((>= 9 as)
         (setq au (getstring T "New (string) value: ")))
        ((and (<= 10 as) (>= 37 as))
         (setq au (getpoint "New point: ")))
        ((and (<= 38 as) (>= 59 as))
         (setq au (getreal "New (real number) value: ")))
        ((and (<= 60 as) (>= 79 as))
         (setq au (getint "New (integer) value: ")))
        ((and (<= 210 as) (>= 239 as))
         (setq au (getpoint "New point: ")))
        ((= 999 as)
         (setq au (getstring T "New (string) value: ")))
        (t
         (setq au (getstring T "New value: "))))
  (if au
      (progn
           (setq zz (cons as au))
           (if (setq xx (assoc as aa))
               (setq rr (entmod (subst zz xx aa)))
               (setq rr (entmod (append aa (list zz)))))
           (if rr (write-line "Modification successful. ")
                  (write-line "Unable to make such a change."))))
 (princ))