Layer isolate routine

The commands are liso and luisoHope it works for you

;;;++--;;;++ LISP COMMANDS LISO & LUISO --;;;++ © 2008 DANIEL MARCOTTE --;;;++ COMMAND LISO ISOLATE LAYER(S) DERIVED FROM SELECTED OBJECT(S) --;;;++ OTHER "ON" LAYER(S) WILL BE TURNED OFF AND LOCKED. --;;;++ COMMAND LUISO RETURNS LAYERS BACK TO THEIR PREVIUS STATE --;;;++ GLOBALS *DRAWINGISINFLUX* *MYGLOBALLAYERLIST* --;;;++ FOR BRICSCAD 8.2.6 OR NEWER;;;++ todo add fade code :);;;++--(DEFUN CRP:TABLE (S / D R);MP (WHILE (SETQ D (TBLNEXT S (NULL D))) (SETQ R (CONS (CDR (ASSOC 2 D)) R)) ));;;++--(DEFUN CRP:ISON (NAME) (IF (EQ :VLAX-TRUE (VLAX-GET-PROPERTY (VLAX-ENAME->VLA-OBJECT (TBLOBJNAME "LAYER" NAME)) 'LAYERON)) 1 0 ));;;++--(DEFUN CRP:ISLOCKED (NAME) (IF (EQ :VLAX-TRUE (VLAX-GET-PROPERTY (VLAX-ENAME->VLA-OBJECT (TBLOBJNAME "LAYER" NAME)) 'LOCK)) 1 0 ));;;++--(DEFUN CRP:TURNOFF (NAME) (VLAX-PUT-PROPERTY (VLAX-ENAME->VLA-OBJECT (TBLOBJNAME "LAYER" NAME)) 'LAYERON :VLAX-FALSE));;;++--(DEFUN CRP:TURNON (NAME) (VLAX-PUT-PROPERTY (VLAX-ENAME->VLA-OBJECT (TBLOBJNAME "LAYER" NAME)) 'LAYERON :VLAX-TRUE));;;++--(DEFUN CRP:UNLOCK (NAME) (VLAX-PUT-PROPERTY (VLAX-ENAME->VLA-OBJECT (TBLOBJNAME "LAYER" NAME)) 'LOCK :VLAX-FALSE));;;++--(DEFUN CRP:LOCK (NAME) (VLAX-PUT-PROPERTY (VLAX-ENAME->VLA-OBJECT (TBLOBJNAME "LAYER" NAME)) 'LOCK :VLAX-TRUE));;;++(DEFUN CRP:GETONLIST (/ L) (SETQ L '()) (FOREACH E (CRP:TABLE "LAYER") (IF (= 1 (CRP:ISON E)) (SETQ L (CONS (CONS E (CRP:ISLOCKED E)) L)) ) ) L);;;++--(DEFUN CRP:GETSELECTIONLIST (/ C L LAYERNAME S) (PRINC "Select object(s) on the layer(s) to be isolated") (SETQ L '() S (SSGET) ) (IF S (PROGN (SETQ C 0) (WHILE (< C (SSLENGTH S)) (SETQ LAYERNAME (VLAX-GET-PROPERTY (VLAX-ENAME->VLA-OBJECT (CDR (CAR (ENTGET (SSNAME S C))))) 'LAYER) L (CONS (CONS LAYERNAME (CRP:ISLOCKED LAYERNAME)) L) C (1+ C) ) ) ) ) L);;;++--(DEFUN CRP:REMOVEITEMS (L1 L2) (FOREACH E L2 (SETQ L1 (VL-REMOVE E L1)) ) L1);;;++--(DEFUN CRP:REGEN() (VLA-REGEN (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)) AcACTIVEVIEWPORT));;;++--(DEFUN C:LISO (/ LAYERNAME SELECTIONLIST) (VL-LOAD-COM) (IF (EQ *DRAWINGISINFLUX* NIL) (PROGN (SETQ SELECTIONLIST (CRP:GETSELECTIONLIST)) (IF (> (LENGTH SELECTIONLIST) 0) (PROGN (SETQ *DRAWINGISINFLUX* T *MYGLOBALLAYERLIST* (CRP:REMOVEITEMS (CRP:GETONLIST) SELECTIONLIST)) (SETVAR "CLAYER" (CAR (CAR SELECTIONLIST))) (FOREACH E *MYGLOBALLAYERLIST* (CRP:TURNOFF (CAR E)) (CRP:LOCK (CAR E)) ) (CRP:REGEN) ) ) ) (PRINC "\nDoh! run luiso first") ) (PRINC));;;++--(DEFUN C:LUISO () (VL-LOAD-COM) (IF (EQ *DRAWINGISINFLUX* T) (PROGN (SETQ *DRAWINGISINFLUX* NIL) (FOREACH E *MYGLOBALLAYERLIST* (CRP:TURNON (CAR E)) (IF (= (CDR E) 0) (CRP:UNLOCK (CAR E)) ) ) (CRP:REGEN) ) (PRINC "\nDoh! run liso first") ) (PRINC));;;++EOF--

Comments

This discussion has been closed.