layer conversion

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i am trying to convert layer numbers to layer name but many layers have a suffix (letter and number)
"1L21" in layername in drawing. my list is generic. i need all layer "1l22" "1H22" "1xl22" to all change to "G-Grid-Bubl"
how can i use a wcmatch to find all the sets and make them all change to one?
(setq lst
'( ("1" "G-Grid-Bubl")("2" "G-Grid-Line")("3" "G-Mlin")("4" "G-Schd")("5" "G-Kpln")("6" "G-Line")
(vlax-for lay (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
(setq nme (vla-get-name lay))
(setq layername nme);(vla-put-name lay new)
(vl-some
(function
(lambda ( str / new )
(if (wcmatch nme (car str))
(or (tblsearch "layer" (setq new (strcat (cadr str))))
(vla-put-name lay new)
(PRINC (strcat "\n" nme " converted"))(princ);(princ ".")
);or
)
(if (wcmatch nme (car str))
(or (tblsearch "layer" (setq new (strcat (cadr str))))
(vl-cmdf "_.-laymrg" "_n" lay "" "_n" NEW "_y");;(vla-put-name lay new)
);or
)
);lamda
);function
lst
)
)