 ; Marmot - Multiple attribute squeezer or as the Romans used 
 ; to say "Carpe Attributum".
 ; Copyright 1996 by Rocket Software
 ; Do not remove this statement under penalty of law.
 (DEFUN C:MARMOT (/ texlst uplst nent curent enam entt typ outer ss cc nn)
  (setvar "cmdecho" 0)
  (command "undo" "mark")
  (setq ss (ssadd))
  (while (setq tex (nentsel "\nSelect pseudotext: "))
         (setq typ (cdr (assoc 0 (entget (car tex)))))
         (if (or (= "TEXT" typ) (= "ATTDEF" typ) (= "ATTRIB" typ))
             (progn
                  (setq pa (cadr tex))
                  (if (setq curent (ssget pa))
                      (progn
                          (setq curent (ssname curent 0))           
                          (if (and (= (cdr (assoc 0 (entget curent))) "INSERT")
                                   (not (member curent uplst))) 
                              (setq uplst (cons curent uplst))))) 
                  (princ (cdr (assoc 41 (entget (car tex)))))
                  (setq texlst (append texlst (list tex))))))
  (if texlst
     (progn
         (setq nuwid (getreal "\nNew width or <Return> to select: "))
         (if (null nuwid)
             (progn
                  (setq nn (nentsel "\nSelect example text: "))
                  (if nn (setq nuwid (assoc 41 (entget (car nn)))))
                  (if nuwid (setq nuwid (cdr nuwid)))
                  (princ nuwid)))     
         (while (and nuwid (setq next (car texlst)))
                        (setq texlst (cdr texlst))
                        (setq enam (car (setq nent next)))
                        (setq entt (entget enam))
                        (setq outer (car (reverse (car (reverse nent)))))
                        (entmod (subst (cons 41 nuwid) (assoc 41 entt) entt))
                        (if (= (type outer) 'ENAME) (entupd enam)))      
                 (if uplst
                        (while (setq enam (car uplst))
                               (entupd enam)
                               (setq uplst (cdr uplst)))))
     (write-line "\nNo suitable entities selected."))
 (princ))