;;;Vplayer freeze layers, or set to a layer by selecting an entity or entities IN THE CURRENT VIEWPORT. ;;; ;;; ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 2-5-96 ;;;> EDITED: 04-09-1997 ;;; (defun c:vplbent ( / loper lnlen xrnm lmsg) (initget 0 "Freeze Set") (setq loper (getkword "\nFreeze\\Set ")) (if (or(eq loper "Set")(eq loper nil)) (progn (setq loper "Make") (setq nent (nentsel)) (if (and (eq(type(car nent))(read "ENAME")) ; (eq(type(car(nth 3 nent)))(read "ENAME")) (>(length nent)2) );and (if (eq (substr(cdr(assoc 2(entget(car(nth 3 nent)))))1 1) "*" ) (setq nentl (cdr(assoc 8(entget(car(nth 3 nent))))) lnlen (strlen nentl)) (progn (princ(cdr(assoc 2(entget(car(nth 3 nent)))))) (setq nentl (cdr(assoc 8(entget(car nent)))) lnlen (strlen nentl)) );progn );if (setq nentl (cdr(assoc 8(entget(car nent)))) lnlen (strlen nentl) );setq );if (while (> lnlen 0) (if(eq(substr nentl lnlen 1)"|") (setq nentl (substr nentl (1+ lnlen));(cdr(assoc 8(entget(car(nth 3 nent))))) lmsg (strcat "\nSet current layer to " nentl ". ") lnlen 0 );setq (setq lnlen (1- lnlen)) );if );while (if lmsg nil (setq lmsg (strcat "\nLayer " nentl " has been made the current layer. "))) (if loper nil (setq loper "Make")) (if c:mklayr nil (load"mklayr")) (setq clayr nentl) (if clnmstd nil (load"mklayr" "\nMKLAYR.LSP w/ (clnmstd) not found. ")) (if (clnmstd) (setq mjrg (substr nentl 1 1) llt (substr nentl 2 1) prod (substr nentl 3 4) colr nil colra nil colri nil );setq );if (if (>=(strlen nentl)8) (setq modf (substr nentl 8)) );if (c:mklayr) );progn (progn (while (and(setq nent (nentsel))(not(if lstr (>(strlen lstr)220)))) (if (>(length nent)2) (if (eq (substr(cdr(assoc 2(entget(car(nth 3 nent)))))1 1) "*" ) (setq nentl (cdr(assoc 8(entget(car(nth 3 nent))))) lnlen (strlen nentl)) (progn (princ(cdr(assoc 2(entget(car(nth 3 nent)))))) (setq nentl (cdr(assoc 8(entget(car nent)))) lnlen (strlen nentl)) );progn );if (if (and (assoc 2(entget(nth 0 nent))) (eq (substr(cdr(assoc 2(entget(nth 0 nent))))1 1) "*" ) );and (setq nentl (cdr(assoc 8(entget(nth 0 nent)))) lnlen (strlen nentl)) (progn ; (princ(cdr(assoc 2(entget(nth 0 nent))))) (setq nentl (cdr(assoc 8(entget(car nent)))) lnlen (strlen nentl)) );progn );if );if (cond ((eq loper "Freeze") (if (eq(getvar"clayer")nentl) (setq lmsg (strcat "\nCannot freeze current layer " nentl)) (setq lmsg (strcat "\nLayer " nentl " selected for freezing. ") lstr (strcat nentl (if lstr (strcat "," lstr) "")))) (princ lmsg)) );cond );while (if lstr (setq nentl lstr) );if (setq lmsg nil) );progn );if (if (eq loper "Set") (command "_layer" loper nentl "") (command "_vplayer" loper nentl "c" "") );if (princ lmsg) (princ) );defun