Would you like to switch ON or OFF a list of
Layers?
Then look no further :
;CODING STARTS HERE
;Switch OFF a list of Layers
(defun mlayoff ( LLST / BOB RT)
(foreach L LLST
(setq BOB (entget(tblobjname "layer" L)))
(setq rt (- (cdr(assoc 62 BOB))))
(setq BOB
(subst (cons 62 rt)
(assoc 62 BOB)
BOB)
)
(entmod BOB)
)
(princ)
)
;--------------------------------------
;Switch ON a list of Layers
(defun mlayon ( LLST / BOB RT)
(foreach L LLST
(setq BOB (entget(tblobjname "layer" L)))
;reset next line
(setq rt (abs (cdr(assoc 62 BOB))))
(setq BOB
(subst (cons 62 rt)
(assoc 62 BOB)
BOB)
)
(entmod BOB)
)
(princ)
)
(princ)
;---------------------
Usage :
(setq a '("2" "3"))
(mlayoff a)
Switches OFF Layers "2" and
"3"
(mlayon a)
Switches ON Layers "2" and
"3"
;CODING ENDS HERE
|