I want to freeze and thaw layers within a routine. the layer names follow a simple format: ##-####
subroutine for getting the list of layer names:
(defun rak ( / lyr_lst)
(setq lyr_lst nil)
(setq lyr_lst (list (cdr (assoc 2 (tblnext "LAYER" T)))))
(while (setq it (cdr (assoc 2 (tblnext "LAYER"))))
(setq lyr_lst (append lyr_lst (list it)))
)
(setq lyr_lst (vl-sort lyr_lst (function (lambda (a b) (< a b)))))
(setq n_lst (list))
(foreach c lyr_lst
(if (wcmatch c "##-*")
(setq n_lst (append n_lst (list c))
)
)
)
)
that works.
freeze all the layers in that list:
(foreach z n_lst
(setq it (entget (tblobjname "layer" z)))
(setq it (subst (cons 70 1) (assoc 70 it) it))
(entmod it)
)
gets them frozen OK, but I switch back to (70 . 0) with the same code modified
(foreach z n_lst
(setq it (entget (tblobjname "layer" z)))
(setq it (subst (cons 70 0) (assoc 70 it) it))
(entmod it)
)
I get no joy.
HOWEVER, on the command line, if I invoke the LAYER command
-la thaw *
everything regens together, I UNDO on the command line and viola! my thawed layers have returned.
wassup?
PS - now I see the excess lines in the first bit of code, tightening that up now.
(defun rak ( / )
(setq n_lst nil)
(setq n_lst (list (cdr (assoc 2 (tblnext "LAYER" T)))))
(while (setq it (cdr (assoc 2 (tblnext "LAYER"))))
(if (wcmatch it "##-*")
(setq n_lst (append n_lst (list it)))
)
)
(setq n_lst (vl-sort n_lst (function (lambda (a b) (< a b)))))
)