;;;Save, Restore and Make layer utilities. (uses modified CLG format) ;;; ;;; This function is to save layer settings before running a utility ;;; that sets its own layer so that the previous condition can be ;;; restored. ;;; ;;; AUTHOR: HENRY C. FRANCIS ;;; 425 N. ASHE ST. ;;; SOUTHERN PINES, NC 28387 ;;; ;;; All rights reserved without prejudice. ;;; ;;; Copyright: 5-18-95 ;;; Edited: 8-18-95 ;;; (DEFUN c:svlayr () (SETQ clayr (GETVAR "clayer")) (SETQ ntwang (- 0 (* (/ (GETVAR "viewtwist") PI) 180))) (SETQ cmjrg mjrg ccolr colr ccolra colra ccolri colri cprod prod cllt llt cltyp ltyp cmodf modf cusdf usdf ) ;_ end of setq ) ;_ end of defun ;;; ;;; ;;; This function is to restore layer settings after running a utility ;;; that sets its own layer so that the previous condition is restored. ;;; ;;; AUTHOR: HENRY C. FRANCIS ;;; 425 N. ASHE ST. ;;; SOUTHERN PINES, NC 28387 ;;; ;;; All rights reserved without prejudice. ;;; ;;; Copyright: 5-18-95 ;;; Edited: 8-18-95 ;;; (DEFUN c:rslayr () (IF (AND clayr (TBLSEARCH "LAYER" clayr) (EQ (CDR (ASSOC 70 (TBLSEARCH "LAYER" clayr))) 0) ) ;_ end of AND (PROGN (SETVAR "clayer" clayr) (SETQ mjrg cmjrg colr ccolr colra ccolra colri ccolri prod cprod llt cllt ltyp cltyp modf cmodf usdf cusdf ) ;_ end of setq ) ;_ end of PROGN (IF (AND clayr (EQ (TYPE clayr) 'STR) ) ;_ end of AND (PRINC (STRCAT "\nUnable to set current layer to " clayr ) ;_ end of STRCAT ) ;_ end of PRINC ) ;_ end of IF ) ;_ end of IF ) ;_ end of defun ;;; ;;; This function is to make layers that conform (*) to the CAD Layer ;;; Guidelines published by the AIA. ;;; * The CLG have been modified to accomodate both color and linetype ;;; specifications. Since only one character is used for each they ;;; are necessarily restricted in number to as many unique characters ;;; that are valid in layer names. ;;; ;;; AUTHOR: HENRY C. FRANCIS ;;; 425 N. ASHE ST. ;;; SOUTHERN PINES, NC 28387 ;;; ;;; All rights reserved without prejudice. ;;; ;;; Copyright: 8-11-94 ;;; Edited: 9-12-96 ;;; (DEFUN c:mklayr (/ usdf al_msg vp_msg lo_msg of_msg) (SETQ cmde (GETVAR "cmdecho")) (SETVAR "cmdecho" 0) (SETQ vwtwst (GETVAR "viewtwist") ntwang (- 0 (* (/ vwtwst PI) 180)) ) ;_ end of setq (IF colra (COND ((= (STRCASE colra) "A") (SETQ colri "10")) ((= (STRCASE colra) "B") (SETQ colri "11")) ((= (STRCASE colra) "C") (SETQ colri "12")) ((= (STRCASE colra) "D") (SETQ colri "13")) ((= (STRCASE colra) "E") (SETQ colri "14")) ((= (STRCASE colra) "F") (SETQ colri "15")) ((= (STRCASE colra) "G") (SETQ colri "16")) ((= (STRCASE colra) "H") (SETQ colri "17")) ((= (STRCASE colra) "I") (SETQ colri "18")) ) ;_ end of cond ) ;_ end of if (IF clayr nil (SETQ clayr (GETVAR "clayer")) ) ;_ end of if (IF (AND (OR (clnmstd) (AND mjrg llt prod (OR colr colra))) ) ;_ end of and (PROGN (IF prod nil (SETQ prod (SUBSTR clayr 3 4)) ) ;_ end of if (IF mjrg nil (SETQ mjrg (SUBSTR clayr 1 1)) ) ;_ end of if (COND (colr nil) ((= (STRCASE (SUBSTR clayr 7 1)) "-") (IF modf (SETQ colr "1") (SETQ colr nil) ) ;_ end of if ) ((= (STRCASE (SUBSTR clayr 7 1)) "1") (SETQ colr "1")) ((= (STRCASE (SUBSTR clayr 7 1)) "2") (SETQ colr "2")) ((= (STRCASE (SUBSTR clayr 7 1)) "3") (SETQ colr "3")) ((= (STRCASE (SUBSTR clayr 7 1)) "4") (SETQ colr "4")) ((= (STRCASE (SUBSTR clayr 7 1)) "5") (SETQ colr "5")) ((= (STRCASE (SUBSTR clayr 7 1)) "6") (SETQ colr "6")) ((= (STRCASE (SUBSTR clayr 7 1)) "7") (SETQ colr "7")) ((= (STRCASE (SUBSTR clayr 7 1)) "8") (SETQ colr "8")) ((= (STRCASE (SUBSTR clayr 7 1)) "9") (SETQ colr "9")) ((AND colra (> (STRLEN clayr) 6)) (COND ((= (STRCASE colra) "A") (SETQ colri "10")) ((= (STRCASE colra) "B") (SETQ colri "11")) ((= (STRCASE colra) "C") (SETQ colri "12")) ((= (STRCASE colra) "D") (SETQ colri "13")) ((= (STRCASE colra) "E") (SETQ colri "14")) ((= (STRCASE colra) "F") (SETQ colri "15")) ((= (STRCASE colra) "G") (SETQ colri "16")) ((= (STRCASE colra) "H") (SETQ colri "17")) ((= (STRCASE colra) "I") (SETQ colri "18")) ) ;_ end of cond ) ((= (STRCASE (SUBSTR clayr 7 1)) "A") (SETQ colra "A" colri "10" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "B") (SETQ colra "B" colri "11" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "C") (SETQ colra "C" colri "12" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "D") (SETQ colra "D" colri "13" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "E") (SETQ colra "E" colri "14" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "F") (SETQ colra "F" colri "15" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "G") (SETQ colra "G" colri "16" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "H") (SETQ colra "H" colri "17" ) ;_ end of setq ) ((= (STRCASE (SUBSTR clayr 7 1)) "I") (SETQ colra "I" colri "18" ) ;_ end of setq ) ) ;_ end of cond (cond (llt (cond ((= llt "-") (setq ltyp "continuous")) ((= (strcase llt) "B") (setq ltyp "border")) ((= (strcase llt) "C") (setq ltyp "center")) ((= (strcase llt) "A") (setq ltyp "dashdot")) ((= (strcase llt) "D") (setq ltyp "dashed")) ((= (strcase llt) "N") (setq ltyp "center2")) ((= (strcase llt) "T") (setq ltyp "dashdot")) ((= (strcase llt) "V") (setq ltyp "divide")) ((= (strcase llt) "O") (setq ltyp "dot")) ((= (strcase llt) "H") (setq ltyp "hidden")) ((= (strcase llt) "P") (setq ltyp "phantom")) ((= (strcase llt) "M") (setq ltyp "match")) ((= (strcase llt) "Q") (setq ltyp "phantom2")) ((= (strcase llt) "S") (setq ltyp "streamd")) ) ;cond ) ;llt ((AND (= (SUBSTR clayr 2 1) "-") (clnmstd)) (SETQ llt "-") (SETQ ltyp "continuous") ) ((AND (= (SUBSTR clayr 2 1) "B") (clnmstd)) (SETQ llt "B") (SETQ ltyp "border") ) ((AND (= (SUBSTR clayr 2 1) "C") (clnmstd)) (SETQ llt "C") (SETQ ltyp "center") ) ((AND (= (SUBSTR clayr 2 1) "A") (clnmstd)) (SETQ llt "A") (SETQ ltyp "dashdot") ) ((AND (= (SUBSTR clayr 2 1) "D") (clnmstd)) (SETQ llt "D") (SETQ ltyp "dashed") ) ((AND (= (SUBSTR clayr 2 1) "N") (clnmstd)) (SETQ llt "N") (SETQ ltyp "center2") ) ((AND (= (SUBSTR clayr 2 1) "T") (clnmstd)) (SETQ llt "T") (SETQ ltyp "dashdot") ) ((AND (= (SUBSTR clayr 2 1) "V") (clnmstd)) (SETQ llt "V") (SETQ ltyp "divide") ) ((AND (= (SUBSTR clayr 2 1) "O") (clnmstd)) (SETQ llt "O") (SETQ ltyp "dot") ) ((AND (= (SUBSTR clayr 2 1) "H") (clnmstd)) (SETQ llt "H") (SETQ ltyp "hidden") ) ((AND (= (SUBSTR clayr 2 1) "P") (clnmstd)) (SETQ llt "P") (SETQ ltyp "phantom") ) ((AND (= (SUBSTR clayr 2 1) "M") (clnmstd)) (SETQ llt "M") (SETQ ltyp "match") ) ((AND (= (SUBSTR clayr 2 1) "Q") (clnmstd)) (SETQ llt "Q") (SETQ ltyp "phantom2") ) ((AND (= (SUBSTR clayr 2 1) "S") (clnmstd)) (SETQ llt "S") (SETQ ltyp "streamd") ) ((AND (= (SUBSTR clayr 2 1) "E") (clnmstd)) (SETQ llt "E") (SETQ ltyp "continuous") ) ((AND (= (SUBSTR clayr 2 1) "X") (clnmstd)) (SETQ llt "X") (SETQ ltyp "continuous") ) ((AND (= (SUBSTR clayr 2 1) "F") (clnmstd)) (SETQ llt "F") (SETQ ltyp "phantom") ) ) ;_ end of cond (COND (modf nil) ((>= (STRLEN clayr) 8) (SETQ modf (SUBSTR clayr 8))) ) ;_ end of cond (SETQ new_ln (STRCAT mjrg (IF (AND llt (NOT (WCMATCH llt "* *"))) llt "-" ) ;_ end of if prod (IF colra colra (IF (AND colr (/= colr "-")) colr (IF modf "-" "" ) ;_ end of if ) ;_ end of if ) ;_ end of if (IF (AND modf (NOT (WCMATCH modf "* *"))) modf "" ) ;_ end of if ) ;_ end of strcat ) ;_ end of setq (SETQ tbl_le (TBLSEARCH "layer" new_ln)) (IF (AND tbl_le (OR (AND (EQ (ABS (CDR (ASSOC 62 tbl_le))) colr) (EQ colr (SUBSTR new_ln 7 1)) ) ;_ end of AND (AND (EQ (ABS (CDR (ASSOC 62 tbl_le))) colra) (EQ colra (SUBSTR new_ln 7 1)) ) ;_ end of AND ) ;_ end of or ) ;_ end of and (SETVAR "clayer" new_ln) (PROGN (IF (= colr "-") (hycolr) ) ;_ end of if ;;;(princ "\nnew_ln = ") ;;;(princ new_ln) ;;;(princ "\ncolr = ") ;;;(princ colr) ;;;(princ "\ncolra = ") ;;;(princ colra) ;;;(princ "\ncolri = ") ;;;(princ colri) ;;;(princ "\nlaycol = ") ;;;(princ laycol) ;;;(princ "\nltyp = ") ;;;(princ ltyp) (COND ((AND colr (EQ (TYPE colr) 'STR) (/= (TYPE (READ (SUBSTR new_ln 7 1))) 'SYM) ) ;_ end of and (SETQ use_pcolor colr) ) ((AND colra (EQ (TYPE colra) 'STR) (= (TYPE (READ (SUBSTR new_ln 7 1))) 'SYM) ) ;_ end of and (COND ((EQ colra "A") (SETQ use_pcolor "10")) ((EQ colra "B") (SETQ use_pcolor "11")) ((EQ colra "C") (SETQ use_pcolor "12")) ((EQ colra "D") (SETQ use_pcolor "13")) ((EQ colra "E") (SETQ use_pcolor "14")) ((EQ colra "F") (SETQ use_pcolor "15")) ((EQ colra "G") (SETQ use_pcolor "16")) ((EQ colra "H") (SETQ use_pcolor "17")) ((EQ colra "I") (SETQ use_pcolor "18")) ) ;_ end of COND ) ((AND laycol (EQ (TYPE laycol) 'STR)) (SETQ use_pcolor laycol) ) (T (SETQ use_pcolor "1")) ) ;_ end of COND (COMMAND ".-layer" "make" new_ln "color" use_pcolor new_ln "ltype" (IF ltyp ltyp "continuous" ) ;_ end of if new_ln "" ) ;_ end of command ) ;_ end of progn ) ;_ end of if ) ;_ end of progn (IF (AND mjrg prod) (PROGN (SETQ new_ln (STRCAT mjrg (IF llt llt "-" ) ;_ end of if prod (IF colra colra (IF (AND colr (/= colr "-")) colr (IF modf "-" "" ) ;_ end of if ) ;_ end of if ) ;_ end of if (IF (AND modf (NOT (WCMATCH modf "* *"))) modf "" ) ;_ end of if ) ;_ end of strcat ) ;_ end of setq (SETQ tbl_le (TBLSEARCH "layer" new_ln)) (IF (AND tbl_le (OR (AND (EQ (ABS (CDR (ASSOC 62 tbl_le))) colr) (EQ colr (SUBSTR new_ln 7 1)) ) ;_ end of AND (AND (EQ (ABS (CDR (ASSOC 62 tbl_le))) colra) (EQ colra (SUBSTR new_ln 7 1)) ) ;_ end of AND ) ;_ end of or ) ;_ end of and (SETVAR "clayer" new_ln) (PROGN (IF (= colr "-") (hycolr) ) ;_ end of if (COND ((AND colr (EQ (TYPE colr) 'STR) (/= (TYPE (READ (SUBSTR new_ln 7 1))) 'SYM) ) ;_ end of and (SETQ use_pcolor colr) ) ((AND colra (EQ (TYPE colra) 'STR) (= (TYPE (READ (SUBSTR new_ln 7 1))) 'SYM) ) ;_ end of and (COND ((EQ colra "A") (SETQ use_pcolor "10")) ((EQ colra "B") (SETQ use_pcolor "11")) ((EQ colra "C") (SETQ use_pcolor "12")) ((EQ colra "D") (SETQ use_pcolor "13")) ((EQ colra "E") (SETQ use_pcolor "14")) ((EQ colra "F") (SETQ use_pcolor "15")) ((EQ colra "G") (SETQ use_pcolor "16")) ((EQ colra "H") (SETQ use_pcolor "17")) ((EQ colra "I") (SETQ use_pcolor "18")) ) ;_ end of COND ) ((AND laycol (EQ (TYPE laycol) 'STR)) (SETQ use_pcolor laycol) ) (T (SETQ use_pcolor "1")) ) ;_ end of COND (COMMAND ".layer" "make" new_ln "color" use_pcolor "" "ltype" (IF ltyp ltyp "" ) ;_ end of if "" "" ) ;_ end of command ) ;_ end of progn ) ;_ end of if ) ;_ end of progn (PROMPT "\nSet CLG Layer Name first! ") ) ;_ end of if ) ;_ end of if (SETQ curvno (GETVAR "cvport")) (IF (AND (> curvno 1) (EQ (GETVAR "tilemode") 0)) (PROGN (SETQ prvss (SSGET "P")) (SETQ cvpss (SSGET "X" (LIST (CONS 69 curvno)))) (SETQ cvpent (ENTGET (SSNAME cvpss 0) (LIST "ACAD"))) (SETQ acad_eed (MEMBER "ACAD" (CADR (ASSOC -3 cvpent)))) (IF (MEMBER (CONS 1003 (GETVAR "clayer")) acad_eed) (SETQ vp_msg "Current layer is frozen in this Viewport") (SETQ vp_msg "") ) ;_ end of if (COMMAND ".select" prvss "") (COMMAND) ) ;_ end of progn ) ;_ end of if (SETQ cur_le (TBLSEARCH "layer" (GETVAR "clayer"))) (IF (EQ (BOOLE 1 4 (CDR (ASSOC 70 cur_le))) 4) (SETQ lo_msg "Current layer is Locked") (SETQ lo_msg "") ) ;_ end of if (IF (< (CDR (ASSOC 62 cur_le)) 0) (SETQ of_msg "Current layer is Off") (SETQ of_msg "") ) ;_ end of if (IF (AND vp_msg (/= vp_msg "")) (IF (AND lo_msg (/= lo_msg "")) (IF (AND of_msg (/= of_msg "")) (SETQ al_msg (STRCAT vp_msg "\n" lo_msg "\n" of_msg)) (SETQ al_msg (STRCAT vp_msg "\n" lo_msg)) ) ;_ end of if (IF (AND of_msg (/= of_msg "")) (SETQ al_msg (STRCAT vp_msg "\n" of_msg)) (SETQ al_msg vp_msg) ) ;_ end of if ) ;_ end of if (IF (AND lo_msg (/= lo_msg "")) (IF (AND of_msg (/= of_msg "")) (SETQ al_msg (STRCAT lo_msg "\n" of_msg)) (SETQ al_msg lo_msg) ) ;_ end of if (IF (AND of_msg (/= of_msg "")) (SETQ al_msg of_msg) (SETQ al_msg nil) ) ;_ end of if ) ;_ end of if ) ;_ end of if (IF (AND al_msg (/= (GETVAR "cmdactive") 4)) (ALERT al_msg) ) ;_ end of if (SETVAR "cmdecho" cmde) (PRINC) ) ;_ end of defun (DEFUN clmgxst () ;does current layer major group exist? (IF (NOT clayr) (SETQ clayr (GETVAR "clayer")) ) ;_ end of IF (MEMBER (SUBSTR clayr 1 1) (LIST "G" "C" "L" "A" "S" "M" "P" "F" "E" "I" "O" "Q" "T" "Z") ;_ end of LIST ;_ end of list ;_ end of list ;_ end of list ;_ end of list ) ;_ end of member ) ;_ end of defun (DEFUN clltxst () ;does current layer linetype exist? (IF (NOT clayr) (SETQ clayr (GETVAR "clayer")) ) ;_ end of IF (MEMBER (SUBSTR clayr 2 1) (LIST "-" "B" "C" "A" "D" "N" "T" "V" "O" "H" "P" "M" "Q" "S" "E" "X" "F") ;_ end of LIST ;_ end of list ;_ end of list ;_ end of list ;_ end of list ) ;_ end of member ) ;_ end of defun (DEFUN clcoxst () ;does current layer color exist (IF (NOT clayr) (SETQ clayr (GETVAR "clayer")) ) ;_ end of IF (MEMBER (SUBSTR clayr 7 1) (LIST "-" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F" "G" "H" "I" ) ;_ end of LIST ;_ end of list ;_ end of list ;_ end of list ;_ end of list ) ;_ end of member ) ;_ end of defun (DEFUN clnmstd () ;is current layer name standard? (IF (NOT clayr) (SETQ clayr (GETVAR "clayer")) ) ;_ end of IF (OR (AND (> (STRLEN clayr) 6) (MEMBER (SUBSTR clayr 1 1) (LIST "G" "C" "L" "A" "S" "M" "P" "F" "E" "I" "O" "Q" "T" "Z") ;_ end of LIST ;_ end of list ;_ end of list ;_ end of list ;_ end of list ) ;_ end of member (MEMBER (SUBSTR clayr 2 1) (LIST "-" "B" "C" "A" "D" "N" "T" "V" "O" "H" "P" "M" "Q" "S" "E" "X" "F") ;_ end of LIST ;_ end of list ;_ end of list ;_ end of list ;_ end of list ) ;_ end of member (MEMBER (SUBSTR clayr 7 1) (LIST "-" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F" "G" "H" "I" ) ;_ end of LIST ;_ end of list ;_ end of list ;_ end of list ;_ end of list ) ;_ end of member ) ;_ end of and (WCMATCH clayr "*|*") (EQ (SUBSTR clayr 2 1) "|") (EQ (SUBSTR clayr 3 1) "|") (EQ (SUBSTR clayr 4 1) "|") (EQ (SUBSTR clayr 5 1) "|") (EQ (SUBSTR clayr 6 1) "|") (EQ (SUBSTR clayr 7 1) "|") (EQ (SUBSTR clayr 8 1) "|") (EQ (SUBSTR clayr 9 1) "|") ) ;_ end of or ) ;_ end of defun (DEFUN hycolr () (SETQ laycol (ITOA (uint 0 "" "Enter color number for this layer" (IF laycol (ATOI laycol) nil ) ;_ end of if ) ;_ end of uint ) ;_ end of itoa colr nil colra nil ) ;_ end of setq ) ;_ end of defun (PRINC) (DEFUN get_lt () (IF nentl (PROGN (SETQ lentd (TBLSEARCH "layer" nentl)) (SETQ tltyp (CDR (ASSOC 6 lentd))) ) ;_ end of progn ) ;_ end of if (SETQ ltyp (ustr 1 "Linetype: " (IF tltyp tltyp "continuous" ) ;_ end of if nil ) ;_ end of ustr ) ;_ end of setq (PRINC) ) ;_ end of defun ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 2 0 0 T T nil T) ***Don't add text below the comment!***|;