Oh dear, my mistake. I didn't think it through. It's obvious that objects cant be frozen or turned off so I rewrote and shortened my functions to this:
; Freeze and turn off layers with -PT suffix
(defun c:zOff ()
(command-s "_-layer" "_freeze" "*-PT" "")
(command-s "_-layer" "_off" "*-PT" "")
(princ)
)
; Thaw and turn on layers with -PT suffix
(defun c:zOn ()
(command-s "_-layer" "_thaw" "*-PT" "")
(command-s "_-layer" "_on" "*-PT" "")
(princ)
)
Now they do exactly what I need them to, but is that foolproof?
I tested the function in a drawing that contains at least one of the above mentioned layers and on a drawing that doesn't. No issues, only a message like "no matching layers found".
That should be fine.
I've read that VL(A(X))-functions are faster, but the code code would be bulky.
Do you recommend something different from my code?
Best regards