I'm trying to develop a lisp that allows one to set all objects in a selection set to colour and linetype bylayer, and that recurses to fix nested blocks. any help as to where I'm going wrong would be appreciated. Thanks! (defun c:fixblock (/ ss1 temp ent1 looper looper1 entdat bnm ctr ctr1 enttyp bl_list) (arctvsav) (defun jddfixablock (bname / enam1) (setq enam1 (tblobjname "block" bname)) (while (setq enam1 (entnext enam1)) (setq end1 (entget enam1) end1 (subst (cons 62 256)(assoc 62 end1) end1) end1 (subst (cons 6 "Bylayer")(assoc 6 end1) end1) end1 (subst (cons 8 "0")(assoc 8 end1) end1) ) (entmod end1) (if (= (cdr (assoc 0 (entget enam1))) "INSERT")(setq bl_list (append bl_list (list (cdr (assoc 2 (entget ent1))))))) ) ) (command ".layer" "t" "0" "un" "*" "s" "0" "") (setq ss1 (ssadd) looper T ctr 0) (while looper (prompt " Select Entities to set to Bylayer for Colour and Linetype: ") (setq ss1 (ssget)) (if ss1 (setq looper nil)) ) (repeat (sslength ss1) (setq ent1 (ssname ss1 ctr) entdat (entget ent1) enttyp (cdr (assoc 0 entdat)) entdat (subst (cons 62 256)(assoc 62 entdat) entdat) entdat (subst (cons 6 "Bylayer")(assoc 6 entdat) entdat) ) (entmod entdat)(entupd ent1) (if (= enttyp "INSERT") (progn (setq bl_list nil bl_list (list (cdr (assoc 2 entdat))) ctr1 0 looper1 T) (while looper1 ;;; I originally wanted to a foreach here but that won't work (setq bnm (nth ctr1 bl_list) ctr1 (+ 1 ctr1)) (jddfixablock bnm) (if (>= ctr1 (length bl_list))(setq looper1 nil)) ) ) ) (setq ctr (+ ctr 1)) ) (arctvrst) (princ) ) PJ