secret flag for use in "adding new layers"

I have a complex dwg with many layouts, many VPs and many many layers.

Whenever I create new layers they always appears in every single existing layout/vp as "turned on" I then have to go through every layout/vp deselecting "current VP freeeze" to "turn them off" which is very tiresome. I have tried all the implied hints in the help docs (using 0, setting current...) but what ever I do they always are defined as "turned on" in every single VP

Is there some SECRET FLAG that I have to RESET in order to default NEW LAYERS to be "TURNED OFF" in existing VPs? Thanks cc

Reply to
cc
Loading thread data ...

Sure, use this lisp routine instead of the layer command. It will create layers using the standard layer dialog box, then make sure the new layers are frozen in all viewports EXCEPT those in the current Tab.

Jeff

;| routine to make new layers and have them frozen in all viewports except viewports in the current Tab by Jeff Mishler - June 2003 |;

(defun c:mlvp (/ OLDECHO IDX LAYSTR NAMELST NEWNAMELST TEMPSS OLDERR) (vl-load-com) (setq olderr *error*)

(defun *error* (msg) (command "undo" "end") (if (/= nil msg) (princ msg) ) (setvar "cmdecho" oldecho) (setq *error* olderr) (princ) (vl-exit-with-value 1) )

(or *acad* (setq *acad* (vlax-get-acad-object))) (or *doc* (setq *doc* (vla-get-activedocument *acad*))) (setq *layers* (vla-get-layers *doc*)) (vlax-for x *layers* (setq namelst (cons (list (vla-get-name x)) namelst))) (setq oldecho (getvar "cmdecho")) (setvar "cmdecho" 0) (command "undo" "be") (initdia) (command ".layer") (cond ((= "Model" (getvar "ctab")) (alert "You created layers while in Model Space, no further action required.") ) ((= :vlax-false (vla-get-mspace *doc*)) (alert "You created layers while in Paper Space, no further action required.")) (t (setq *layers* (vla-get-layers *doc*)) (vlax-for x *layers* (setq newnamelst (cons (list (vla-get-name x)) newnamelst))) (if (/= (length namelst) (length newnamelst)) (progn (foreach x namelst (if (member x newnamelst) (setq newnamelst (vl-remove x newnamelst)) ) ) (setq laystr "") (foreach x newnamelst (setq laystr (strcat laystr (car x) ",") ) ) (setq laystr (substr laystr 1 (1- (strlen laystr)))) (setq tempss (ssget "x" (list '(0 . "VIEWPORT") '(-4 . "/=") '(69 . 1) (cons 410 (getvar "ctab"))))) (command "vplayer" "f" laystr "a" "t" laystr "s" tempss "" "") (princ "\nLayer(s) created and frozen in all Vports except those in the current Tab") ) ;progn ) ;if) ) ) (command "undo" "end") (setq *error* olderr) (setvar "cmdecho" oldecho) (princ) )

Reply to
Jeff Mishler

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.