(defun c:del ( / hms:LayerList* cla ech lay* laylst)
(defun hms:LayerList* (path / LayName TblName TblNameList)
(while (setq TblName (tblnext "Layer" (null TblName)))
(if (wcmatch (setq LayName (strcase (cdr (assoc 2 TblName)))) (strcase path))
(setq TblNameList (cons LayName TblNameList))
(acad_strlsort TblNameList)
);; hmsLayerList*
(if (and (setq lay* (getstring T "\n Enter Layer Names to Delete, Wild-Cards can be used: "))
(not (wcmatch (strcase lay*) "0*,DEFPOINTS*"))
(setq LayList (hms:LayerList* lay*))
(setq ech (getvar 'CMDECHO))
(setvar 'CMDECHO 0)
(command "_.undo" "G")
(command "_.-layer" "_U" lay* "_T" lay* "")
(setq cla (strcase (getvar 'CLAYER)))
(if (member cla LayList)
(command "_.-layer" "_U" "0" "_T" "0" "_S" "0" "")
(foreach l LayList
(command "_.-laydel" "_N" l "" "_Y")
(command "_.undo" "E")
(setvar 'CMDECHO ech)
(prompt "\n Layer Name not valid, or no matching layers... ")