@Kent1Cooper wrote:
.... I could pretty easily imagine a couple of menu buttons or command definitions that would be for Zooming in and out with this Layer-control enhancement, but you would still be left with the possibility of using regular Zoom without any effect on Layer settings, when you want to.
A very rough framework for such a pair of commands:
(defun C:ZIL (); = Zoom In with Layer effect
(command
"_.zoom" "11/10x"
"_.layer" "_on"
(cond
((< (getvar 'viewsize) 3) "2,3,4")
((< (getvar 'viewsize) 5) "2,3")
((< (getvar 'viewsize) 7) "2")
(""); nothing if none of the above
); cond
"" ; end Layer
); command
(princ)
); defun
(defun C:ZOL (); = Zoom Out with Layer effect
(command
"_.zoom" "10/11x"
"_.layer" "_off"
(cond
((>= (getvar 'viewsize) 7) "2,3,4")
((>= (getvar 'viewsize) 5) "3,4")
((>= (getvar 'viewsize) 3) "4")
("")
); cond
""
); command
(princ)
); defun
Set up a drawing using AutoCAD's default template for a 12x9 drawing area, so the VIEWSIZE System Variable value is initially 9. Make Layers 1 through 4 and draw some things in each, and turn off 2, 3 & 4 -- 1 is the Layer that would stay on at Zoomed-out level. As you use ZIL successively to Zoom in, when the Zoom level passes the 7-unit VIEWSIZE, Layer 2 is turned on; when it passes 5, 3 is turned on also; etc. [I included the multiple Layer names in case you might start at some other-than-9 VIEWSIZE value -- by whatever means and whatever starting point you are coming from, when you get in to the last stage, it turns all three Layers on, not just the "innermost" one, otherwise you could get some peculiar combinations.] Then ZOL-ing back out, the Layers are turned back off in reverse order as the thresholds are passed.
They work only in Zooming in/out by scale factor, about the center of view, not with Window, etc., and the Layer changes happen only when using these commands, not in [for example] mouse-wheel Zooming. So you can Zoom however you like without affecting Layer settings when you want to, by using the mouse wheel or the regular Zoom command.
You would have to play around with the percentage of Zooming in/out [I made them reciprocal and used fractions so they'd be exactly reciprocal, so if you use some ZIL's and then the same number of ZOL's, it takes you back to the same Zoom level], and the threshold values of VIEWSIZE at which changes are made, and of course the Layer names, and how many Layers you want affected, and so on. With appropriate Drawing Limits, it could be made to judge proportionally to them for any size drawing, rather than being purpose-built for a specific drawing size as these are.
Not the ultimate solution yet, but at least it demonstrates an approach.
Kent Cooper, AIA