How would I get LAYISO to freeze not turn off layers I do not want to see?
I did this in AutoCAD 2006 but recently upgraded to 2014 and do not remember how I did it.
Thanks
Here's mine:
;; LayFreezeAllBut.lsp [command name: LFAB] ;; Freeze all Layers except those of selected objects. ;; Kent Cooper, November 2009 ; (defun C:LFAB (/ *error* FrzLay AddLay LeaveItem ItemLay LeaveLay) (defun *error* (errmsg) (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break")) (princ (strcat "\nError: " errmsg)) ); end if (command) (command "_.undo" "_end") ); end defun (command ".undo" "begin") (setq FrzLay (list (cdr (assoc 2 (tblnext "layer" T))))) (while (setq AddLay (cdr (assoc 2 (tblnext "layer")))) (setq FrzLay (cons AddLay FrzLay)) ); end while -- list of all Layers in drawing (while (setq LeaveItem (nentsel "\nSelect item on Layer to leave thawed: ") ItemLay (if LeaveItem (cdr (assoc 8 (entget (car LeaveItem))))) ); end setq (if (not (member ItemLay LeaveLay)) (setq LeaveLay (cons ItemLay LeaveLay)) ); end if ); end while -- list of Layers to leave thawed (command "_.layer" "_set" (car LeaveLay) "") ; in case current Layer is to be frozen, set to one to be left thawed (foreach LayNm LeaveLay (setq FrzLay (vl-remove LayNm FrzLay))) (foreach LayNm FrzLay (command "_.layer" "_freeze" LayNm "")) (command "_.undo" "_end") (princ) ); end defun (prompt "\nType LFAB to Freeze All Layers But those of selected objects.")
It doesn't have an equivalent to LAYUNISO, but such a thing could presumably be built.
(defun c:IL ( / d1 ) (if (setq d1 (cdr (assoc 8 (entget (car (entsel "Isolate a Layer \nSelect an object: ")))))) (progn (setvar "cmdecho" 0) (command ".layer" "s" d1 "f" "*" "") (setvar "cmdecho" 1) (princ (strcat "\n Layer " d1 " isolated. ")) );progn );if (princ) );endIL
Isolate Layer.
Stripped (no OSMODE "nea") and simplified (no layer 0 and Defpoints as part of isolation) for your use.
No unisolate provided.
From 1998.
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
Here's another option:
(defun c:layfiso ( / e l ) (setvar 'errno 0) (while (not (or (= 52 (getvar 'errno)) (and (setq e (car (entsel))) (setq l (cdr (assoc 8 (entget e)))) (vl-cmdf "_.-layer" "_s" l "_f" (strcat "~" l) "") ) ) ) (princ "\nMissed, try again.") ) (princ) )
@scot-65: be careful if the user does not select an object as (entget nil) will error.
Lee
@RChalmers2 wrote:
How would I get LAYISO to freeze not turn off layers I do not want to see?
....
As no doubt you've discovered if you've tried them out, scot-65's and Lee_Mac's routines freeze all Layers other than that of a single selected object. That's not the way LAYISO works in the On/Off realm; it lets you pick multiple objects, keeping all of their Layer(s) on and turning off all others. My earlier Reply here works that way for freezing, but forget that one and use the attached LayerIsolateFreezeThaw.lsp [you'll have to get it out of the .zip file] with its LIT and LUT commands.
A while back, I made an improved pair of commands similar to AutoCAD's LAYISO and LAYUNISO, to overcome some issues I had with them. They're available here, where you can read my comment for a more detailed explanation of the issues and the improvements made. Those are about On/Off condition, as LAYISO/LAYUNISO are, but it wasn't hard to adjust it [and make some other little improvements] to develop the attached, which instead of turning off the Layers not containing any of the selected objects, freezes them instead. That command is called LIT, which stands for "Layer Isolate as to Thaw/freeze condition" [using T rather than F because the selected objects' Layers remain Thawed, and all others are frozen]. The corresponding Un-isolation command is called LUT.
As with LIO and LUO in that link, they work to multiple levels. You can isolate some Layers with LIT, then if you want additional Layers frozen, isolate a smaller group, as many levels down as you want to go, and step back out of the isolations one at a time in reverse order with LUT. That's one of the main improvements over the operation of LAYISO/LAYUNISO; you can use LAYISO multiple times, but LAYUNISO can un-isolate only the one latest group.
Google gave me this thread while I was trying to figure out how to make LAYISO lock, not freeze. So a tangentially-related response for anyone else who got here that way:
Having LAYISO lock layers is great. It allows you to CTRL+A to select and move (or whatever) your isolated objects. Either this was the default in r2014 or I accidentally changed it somehow, because I was very disappointed to install r2015 and find that LAYISO now simply hid layers, which I found quite a bit less useful.
Well, good news: the replies above about custom LISP and all that only applies to making LAYISO freeze. All you have to do to get LAYISO lock is click Isolate (or type LAYISO), type S for settings, and select Lock And Fade.
Thanks! Well written, small code is good! I also wish they would add Freeze to LAYISO settings, working on a small part of drawing when all else is frozen is way less taxing on the graphics vs turning layers off, why is that hard for so many here to understand?