[Search tip detail and code files using keywords, tip number, author name, etc ]
 
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Improved Layer Isolate/Unisolate
Tip# 3779 By Kent Cooper On 16-Nov-2011
5
Rated By 1 users Downloaded : 336
Categories : Layer Properties, Layer States
Software type : AutoCAD 2012
Rename File To : LayerIsolateOnOff.lsp
This version allows for nesting and manual layer control, and ignores layer property changes.

This LISP routine from Kent Cooper improves on AutoCAD's built-in Layer Isolate and Layer Unisolate commands. The built-in commands are generally designed to work as a set: You isolate certain layers, make changes to geometry, then unisolate the layers. Nesting of the layer isolation states is not supported, and older versions of Layer Unisolate would even undo layer property changes that were made while layers were isolated.

Kent's version allows for nesting, allows for manual layer control while in the isolated state, and ignores layer property changes when restoring the layers. It also reports what it is doing at the Command line — another feature lacking in the built-in commands. Great job, Kent.

 

Average Rating:
5


User comments
Comment by Cooper,Kent
Posted on 2011-11-17 08:35:16
A more detailed description of what it does, if you're interested: If you ever use LAYISO [‘Layer Isolate’ in the Layer subsection of Express Tools] to isolate some Layer(s) and turn off the rest, and LAYUNISO to turn back on the ones that were turned off, you may have noticed some shortcomings. [These apply back in my 2004; some have been fixed in later versions.] 1. If, while in the layer-isolated condition, you change something about a Layer like its color or linetype, when you later use LAYUNISO, those qualities revert back to what they were when you used LAYISO; 2. If, while in the layer-isolated condition, you manually turn off some additional Layers, LAYUNISO does not leave them that way; it does not turn back on only those that LAYISO turned off, but all those that were on at the time LAYISO was used. 3. If you use LAYISO once, and then decide you want still fewer Layers on, and use it again, you can use LAYUNISO only to step back from the latest isolation—it won’t go further to turn back on Layers that were turned off by earlier LAYISO commands. But NOT ANY MORE. To isolate Layers, affecting only their on-off condition, and turn back on the ones that were turned off, without reversing anything like changes in colors or linetypes of Layers that may have happened in between, and to as many levels deep as you care to go, there are two commands in LayerIsolateOnOff.lsp: Type LIO [which stands for Layer Isolate – On/off only] to isolate the Layers of objects you will be asked to select; and Type LUO [which stands for Layer Unisolate – On/off only] to turn back on those that were turned off by using LIO. You can “stack” it multiple times, and each LUO will turn back on those Layers that were turned off by the latest LIO (and only those Layers); do LUO repeatedly to turn back on successive sets of Layers in reverse order of the LIO sequence. Like LAYISO/LAYUNISO: 1. LIO reports how many Layers it has isolated (kept on). 2. LIO changes the current Layer to one that’s still on, if you didn’t select anything on the Layer that was current at the time. 3. LIO tells you the name of the current Layer, but only if it has had to change it [see 2.]. (LAYISO tells you the current Layer even if it didn’t change it). 4. LUO makes current again the Layer that was current at the time of the corresponding LIO, even if it’s been renamed since (provided it hasn’t been purged). Beyond what LAYISO/LAYUNISO tell you, LIO & LUO also report more about what they’ve done: 1. LIO tells you not only how many Layers it isolated (kept on), but how many it turned off. 2. LAYUNISO doesn’t report anything at all, but LUO tells you: a. how many Layers it turned back on; b. how many Layers (if any) no longer exist and therefore were not turned back on; c. if the Layer that was current at the time of LIO was turned off and another made current, it tells you that original Layer has been made current again. d. if that Layer has been purged, it reports that.
Comment by Foakes,Simon
Posted on 2012-08-09 07:23:25
Thanks Kent for composing this AutoLISP routine - very useful. It solved the problem I wanted it to solve, which was this: the native Isolate/Unisolate command in AutoCAD 2012 is written* so that if Unisolate is used in an active viewport (i.e. in modelspace within a paperspace layout), it will only restore layers that are VP-thawed in that viewport. Any layers turned off during the Isolate operation that were VP-frozen were not restoring during the Unisolate operation. Your new LISP has solved this for me! Thanks again. *or so it seems on my installation/deployment/version/build
Comment by Foakes,Simon
Posted on 2012-08-09 07:23:34
Thanks Kent for composing this AutoLISP routine - very useful. It solved the problem I wanted it to solve, which was this: the native Isolate/Unisolate command in AutoCAD 2012 is written* so that if Unisolate is used in an active viewport (i.e. in modelspace within a paperspace layout), it will only restore layers that are VP-thawed in that viewport. Any layers turned off during the Isolate operation that were VP-frozen were not restoring during the Unisolate operation. Your new LISP has solved this for me! Thanks again. *or so it seems on my installation/deployment/version/build
Comment by Cooper,Kent
Posted on 2014-10-03 10:29:22
For a version that Freezes and Thaws rather than turns Off and On, see Tip #4291, "Layer Isolate/Unisolate Using Freeze and Thaw."


Log In