Dunno how fast it is but quickly coded and posted for fun / your consideration:
Did blind, absolutely painful edit on an iPad, hopefully works.
(defun _ThawLayers ( filter invert_filter / @Match @Main )
;; Thaw and turn on layers that match the filter,
;; otherwise freeze and turn off, with special
;; treatment of layer "0" and "Defpoints".
;;
;; Syntax:
;;
;; Thaw layers matching the filter:
;;
;; (_ThawLayers "*support*,*e" nil)
;;
;; Thaw layers NOT matching the filter (read another
;; way -- freeze layers matching the filter):
;;
;; (_thawlayers "*weld*,*gaskets*,*bolts*" t)
(vl-load-com)
(if invert_filter
(defun @Match ( x ) (not (wcmatch x filter))) ;; filter is a
(defun @Match ( x ) (wcmatch x filter)) ;; lexical global
)
(defun @Main ( doc filter clayer / name off frozen)
;; group existing states etc ...
(vlax-for layer (vla-get-layers doc)
(cond
( (eq clayer
(setq
off (eq :vlax-false (vla-get-layeron layer))
frozen (eq :vlax-true (vla-get-freeze layer))
name (strcase (vla-get-name layer))
)
)
(if (@Match name)
;; you can only feck the on state
;; for the active layer -- try to
;; change the freeze state and kaboom
(vla-put-layeron layer :vlax-true)
)
)
( (member name '("0" "DEFPOINTS"))
(vla-put-freeze layer :vlax-false)
(vla-put-layeron layer :vlax-true)
)
( off
(if frozen
(if (@Match name)
(progn
(vla-put-layeron layer :vlax-true)
(vla-put-freeze layer :vlax-false)
)
)
(if (@Match name)
(vla-put-layeron layer :vlax-true)
(vla-put-freeze layer :vlax-true)
)
)
)
( (if frozen
(if (@Match name)
(vla-put-freeze layer :vlax-false)
(vla-put-layeron layer :vlax-false)
)
(if (not (@Match name))
(progn
(vla-put-layeron layer :vlax-false)
(vla-put-freeze layer :vlax-true)
)
)
)
)
)
)
(princ)
)
(@Main
(vla-get-activedocument (vlax-get-acad-object))
(strcase filter)
(strcase (getvar 'clayer))
)
)
Cheers.