 ; Repo - reinsert all blocks in a drawing (if they are in the search path).
 ; Copyright 1994, 2002 by Rocket Software Ltd.
 ; Plate of shrimp software.
 (DEFUN C:REPO (/ reg reww nnexb namm namp)
  (setvar "cmdecho" 0)
  (setq reg (getvar "regenmode"))
  (command "regenauto" "off")
  (setq reww T)
  (while (setq nnexb (tblnext "block" reww))
         (setq reww ())
         (setq namm (cdr (assoc 2 nnexb)))
         (setq namp ())
         (setq namp (findfile (strcat namm ".dwg")))
         (if namp
             (progn
                  (setq namp (substr namp 1 (- (strlen namp) 4)))
                  (command "insert" (strcat namm "=" namp))
                  (command)
                  (write-line (strcat (substr namm 1 1)
                                      (strcase (substr namm 2) t)
                                      " updated.")))
             (if (/= (substr namm 1 1) "*")
                 (write-line (strcat "Can't find "
                                      (substr namm 1 1)
                                      (strcase (substr namm 2) t) ".")))))
  (if (= reg 1)
      (command "regenauto" "on")
      (command "regen"))
  (command "resume")
 (princ))