 ; QEB - wblock an existing block.
 ; Copyright 1995, 2013 by Rocket Software Ltd.
 ; One gets tired of self-referencing blocks.
 (DEFUN C:QEB (/ entt namm path pnam overwr found)
  (setvar "cmdecho" 0)
  (setq entt (entget (car (entsel "Block to wblock: "))))
  (if (= (cdr (assoc 0 entt)) "INSERT")
      (progn
           (setq namm (cdr (assoc 2 entt)))
           (setq path (getvar "dwgprefix"))
           (setq pnam (strcat path namm ".dwg"))
           (princ namm)
           (if (findfile pnam)
               (progn
                    (prompt (strcat "\nFile " pnam " already exists."))
                    (initget 0 "Yes No")
                    (Setq overwr (getkword "\nOverwrite it? <Y>: "))
                    (if (/= overwr "No")
                        (command "wblock" pnam "Y" namm)))
               (command "wblock" pnam namm))
           (if (setq found (findfile pnam))
               (write-line (strcat "\n" found))
               (write-line "** Block Write Failed. **")))
      (prompt "\nThat was not a block."))
 (princ))