(defun c:Blocks->Layers ( / SubstDXFUpdate Layer ApplyFootoSelSet )
;; © Lee Mac 2010
(defun SubstDXFUpdate ( code value elist )
(if
(setq elist
(entmod
(subst
(cons code value) (assoc code elist) elist
)
)
)
(entupd (cdr (assoc -1 elist)))
)
)
(defun Layer ( Name )
(entmake
(list
(cons 0 "LAYER")
(cons 100 "AcDbSymbolTableRecord")
(cons 100 "AcDbLayerTableRecord")
(cons 2 Name)
(cons 70 0)
)
)
)
(defun ApplyFooToSelSet ( foo SelSet )
(
(lambda ( i / e )
(if SelSet
(while (setq e (ssname SelSet (setq i (1+ i))))
(foo e)
)
)
)
-1
)
)
(ApplyFooToSelSet
(lambda ( e / l )
(or (tblsearch "LAYER" (setq l (cdr (assoc 2 (entget e)))))
(Layer l)
)
(SubstDXFUpdate 8 l (entget e))
)
(ssget "_:L" '((0 . "INSERT")))
)
(princ)
)
Ronjonp,Glad to help :-)
I loaded the readcsv lisp by Lee, ran your code after that. worked great!!!
Thanks so much! :)
Jd