Turn off non-plottable layers
Anyone have a Lisp routine that will turn off all layers marked as not plottable?Thanks, Tom Try the following:
(defun c:nonplotoff ( / a e ) (while (setq a (tblnext "layer" (null a))) (setq e (entget (tblobjname "layer" (cdr (assoc 2 a))))) (if (zerop (cdr (assoc 290 e))) (entmod (subst (cons 62 (- (abs (cdr (assoc 62 e))))) (assoc 62 e) e)) ) ) (princ)) Excellent! even works with that pesky layer Defpoints...I see that changing "(cons 62 (- " to "(cons 62 (+ " turns the non-plot layers on.
Thank you Lee for all your generous Lisp help.
Tom ActiveX
(vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (if (= (vla-get-plottable layer) :vlax-false) (vla-put-layeron layer :vlax-false) ) )Vanila
(while (setq layer (tblnext "layer" (not layer))) (if (= 0 (cdr (assoc 290 (setq lst (entget (tblobjname "layer" (cdr (assoc 2 layer)))))))) (entmod (subst (cons 62 (- (abs (cdr (setq old (assoc 62 lst)))))) old lst)) ) )
You're welcome Tom
If you were after both options, the code could be written more concisely as:
(defun c:npoff nil (nonplot -))(defun c:nponnil (nonplot +))(defun nonplot ( f / a e ) (while (setq a (tblnext "layer" (null a))) (if (zerop (cdr (assoc 290 (setq e (entget (tblobjname "layer" (cdr (assoc 2 a)))))))) (entmod (subst (cons 62 (f (abs (cdr (assoc 62 e))))) (assoc 62 e) e)) ) ) (princ)) Efficiency is good... I do use both to quickly "isolate" layers (I hate that term). I use many routines to turn on/off various layers by wildcard: LO___ for off and LON__ for on.
Thanks again to London and Baia Mare (I visited Baia Mare in 1981 with my dance company...).
Tom
页:
[1]