Hi, I was wondering, how do I turn off all the layers in the active drawing using lisp? TIA Scott
(command "layer" "off" "*" "" "") Just remember to reset the current layer to "0" or whatever. -- AUTODESK Authorized Developer www.Cadentity.com MASi
And here's pure lisp that will not prompt about turning off the current layer. It's actually a toggle type, type in "alloff" to turn 'em off, "allon" to turn 'em back on. Jeff (defun onoffall (onoff /) (vl-load-com) (vlax-for lay (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (if (= onoff "on") (vla-put-layeron lay :vlax-true) (vla-put-layeron lay :vlax-false) ) ) ) (defun c:allon () (onoffall "on") (princ) ) (defun c:alloff () (onoffall nil) (princ) )
Here is one with a prompt: (DEFUN C:LRF () (Setvar "Cmdecho" 0) (Setq A (Entsel "\Touch entity to freeze: ")) (If A (Progn (Setq A (Cdr (Assoc 8 (Entget (Car A))))))) (Command "LAYER" "FREEZE" A "") (Princ) (PROMPT "LAYER FROZEN: ")(EVAL A) )
And here's a different variation. allon - turns all layers on alloff - turns all layers off allbut - turn all layersoff except the current layer (defun onoffall (onoff /) (vl-load-com) (vlax-for lay (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (cond ((= onoff "on")(vla-put-layeron lay :vlax-true)) (onoff (if (= (vla-get-name lay)(getvar "clayer")) (vla-put-layeron lay :vlax-true) (vla-put-layeron lay :vlax-false))) (t (vla-put-layeron lay :vlax-false)) ) ) ) (defun c:allon () (onoffall "on") (princ) ) (defun c:alloff () (onoffall nil) (princ) ) (defun c:allbut() (onoffall t) (princ) )
Hi, I am using a lisp routine to draw a symbol representing the end of a pipe, the one that looks like a ying yang without the two dots at the top and bottom. I want to turn all the layers off so that my hatching on the right hand side of the symbol is not "cut off" by other entities in the drawing like the centerlines for the pipe. Thank you all for helping me out with this, this is exactly what I need! Scott
I was wondering, how do I turn off all the layers in the active drawing hi, using lisp : you need to change color number for each layer throught layer table. when a color is negative : layer is off. Bruno Toniutti