Tom_D Posted October 21, 2014 Share Posted October 21, 2014 Anyone have a Lisp routine that will turn off all layers marked as not plottable? Thanks, Tom Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 21, 2014 Share Posted October 21, 2014 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) ) Quote Link to comment Share on other sites More sharing options...
Tom_D Posted October 21, 2014 Author Share Posted October 21, 2014 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 Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted October 21, 2014 Share Posted October 21, 2014 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)) ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 21, 2014 Share Posted October 21, 2014 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 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:npon nil (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) ) Quote Link to comment Share on other sites More sharing options...
Tom_D Posted October 21, 2014 Author Share Posted October 21, 2014 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.