Here's an old one...
(defun C:BB ( / *error* @Anonymous |e |e0 |ent |etyp |done |bname |ans |flag)
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;* *
;* BB.LSP by John F. Uhden *
;* 2 Village Road *
;* Sea Girt, NJ 08750 *
;* *
;* * * * * * * * * * * * Do not delete this heading! * * * * * * * * * * * *
; Program redefines all entities in a block definition to color BYBLOCK.
; v2.1 (10-24-97) corrected (redraw) and (chr 7)
; v15.00 (04-07-00) for R15
; Revised (11-17-16) for freeware
(gc)
(prompt "\nBB v15.00 (c)1994-2000, John F. Uhden, Cadlantic")
(prompt "\nThis routine will redefine all entities in a block to color BYBLOCK.")
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
(vla-endundomark *doc*)
(vla-startundomark *doc*)
(defun *error* (|err)
(@reset)
(if (wcmatch (strcase |err) "*CANCEL*,*QUIT*")
(vl-exit-with-error "\r ")
(vl-exit-with-error (strcat "\r*ERROR*: " |err))
)
)
(defun @Anonymous ()
(vla-endundomark *doc*)
(if (= (type |e0) 'ENAME) (redraw |e0 4))
(vl-doc-set '$cv_cmdname "")
(princ)
)
(if (setq |e0 (entsel "\nPick a block to redefine: "))
(progn
(setq |e0 (car |e0)
|ent (entget |e0)
|etyp (cdr (assoc 0 |ent))
|flag (cdr (assoc 70 |ent))
)
(redraw |e0 3)
(if (and (= |etyp "INSERT")(= (logand |flag 4) 4))
(setq |etyp "Xref")
)
(if (= |etyp "INSERT")
(progn
(setq |bname (cdr (assoc 2 |ent))
|e (tblsearch "block" |bname)
|e (cdr (assoc -2 |e)) |done nil
)
(prompt (strcat "\nBlock name is " |bname "."))
(initget "Yes No")
(setq |ans (getkword "\nAre you sure you want to redefine it? Yes/<No>: "))
(if (= |ans "Yes")
(progn
(while (not |done)
(setq |ent (entget |e))
(if (assoc 62 |ent)
(setq |ent (subst (cons 62 0)(assoc 62 |ent) |ent))
(setq |ent (append |ent (list (cons 62 0))))
)
(entmod |ent)(entupd |e)
(if (not (setq |e (entnext |e)))(setq |done 1))
)
(prompt "\nDisplay will be correct after next regen.\n")
)
)
)
(prompt (strcat "\nEntity selected is a(n) " |etyp "."))
)
(setq |e0 (redraw |e0 4))
)
)
(@reset)
)
Make nothing of the pipe symbol prefix "|." It's just a style I used before local variables were really local.