Have you also allowed for Purging CIV3D styles it is separate to the normal purge command and should be ran before running normal PURGE. I am trying to remember I think its purgestylesandsettings. Like purge run at least twice, same with purge.
(defun c:FOO ( / oldlst newlst resultlst oldlayer getlst newlayer gatom j glen)
(setq oldlst (list "Door" "Win-1" "Win-2" "Text" "ttt"))
(setq newlst (list "G-DOOR" "G-WINDOW" "G-TEXT" "WD-TEXT"))
(setq resultlst '())
(foreach oldlayer oldlst
(setq getlst '())
(foreach newlayer newlst
(if (wcmatch (strcase newlayer) (strcat "*" (strcase (substr oldlayer 1 3)) "*"))
(progn
(setq getlst (cons newlayer getlst))
)
(progn)
)
)
(setq getlst (reverse getlst))
(cond
((= getlst nil) (setq getlst (list "no result")))
((> (setq glen (length getlst)) 1)
(princ "\n You have ")
(princ glen)
(princ (strcat " options for this keyword : " oldlayer ))
(setq i 0)
(repeat glen
(setq gatom (nth i getlst))
(princ "\n ")
(princ (+ i 1))
(princ " > ")
(princ gatom)
(setq i (+ i 1))
)
(initget 7)
(setq j (getint "\n Enter the number you want : "))
(if (> j glen)
(progn
(princ "\n That number is greater than the lists. It is automatically adjusted to the maximum number.")
(setq j glen)
)
)
(setq getlst (list (nth (- j 1) getlst)))
)
)
(setq resultlst (cons (list oldlayer (car getlst)) resultlst))
)
(setq resultlst (reverse resultlst))
(princ "\n")
(princ resultlst)
(princ)
)
Command : FOO
You have 2 options for this keyword : Text
1 > G-TEXT
2 > WD-TEXT
Enter the number you want : 1
result pair list - ((Door G-DOOR) (Win-1 G-WINDOW) (Win-2 G-WINDOW) (Text G-TEXT) (ttt no result))
Command : foo
You have 2 options for this keyword : Text
1 > G-TEXT
2 > WD-TEXT
Enter the number you want : 2
result pair list - ((Door G-DOOR) (Win-1 G-WINDOW) (Win-2 G-WINDOW) (Text WD-TEXT) (ttt no result))
Command : foo
You have 2 options for this keyword : Text
1 > G-TEXT
2 > WD-TEXT
Enter the number you want : 3
That number is greater than the lists. It is automatically adjusted to the maximum number.
result pair list - ((Door G-DOOR) (Win-1 G-WINDOW) (Win-2 G-WINDOW) (Text WD-TEXT) (ttt no result))