;;;Change entity selection set color, linetype, and/or lineweight to BYLAYER. ;;; ;;; ;;; AUTHOR: Henry C. Francis ;;; 425 N. ASHE ST. ;;; SOUTHERN PINES, N.C. 28387 ;;; All rights reserved without prejudice. ;;; ;;; Copyright: 6-7-94 ;;; Edited: 1-8-2007 ;;; (DEFUN C:CE2B (/ eset ltype_lst color_lst) (SETVAR "cmdecho" 0) (SETQ ce_option (ukword 1 "Color LType LWeight CLT CLW LTLW All" "Entity Color, Linetype, Lineweight to BYLAYER options [Color LType LWeight CLT CLW LTLW All]" (IF ce_option ce_option "All" ) ;_ end of if ) ;_ end of ukword ) ;_ end of setq (SETQ eset (SSGET)) (IF eset (PROGN (SETQ cnt 0) (WHILE (< cnt (SSLENGTH eset)) (SETQ this_ent (ENTGET (SSNAME eset cnt))) (IF (OR (EQ (STRCASE ce_option) "LTYPE") (EQ (STRCASE ce_option) "CLT") (EQ (STRCASE ce_option) "LTLW") (EQ (STRCASE ce_option) "ALL") ) ;_ end of OR (IF (ASSOC 6 this_ent) (PROGN (IF ltype_lst (IF (ASSOC (CDR (ASSOC 8 this_ent)) ltype_lst) (IF (OR (EQ (CDR (ASSOC 6 this_ent)) (CDR (ASSOC (CDR (ASSOC 8 this_ent)) ltype_lst))) (AND (EQ (TYPE (CDR (ASSOC (CDR (ASSOC 8 this_ent)) ltype_lst))) 'LIST) (MEMBER (CDR (ASSOC 6 this_ent)) (CDR (ASSOC (CDR (ASSOC 8 this_ent)) ltype_lst))) ) ;_ end of AND ) ;_ end of OR NIL (IF (EQ (TYPE (CDR (ASSOC (CDR (ASSOC 8 this_ent)) ltype_lst))) 'LIST) (SETQ ltype_lst (SUBST (CONS (CDR (ASSOC 8 this_ent)) (APPEND (CDR (ASSOC (CDR (ASSOC 6 this_ent)) ltype_Lst)) (LIST (CDR (ASSOC 6 this_ent))) ) ;_ end of APPEND ) ;_ end of CONS (ASSOC (CDR (ASSOC 8 this_ent)) ltype_lst) ltype_lst ) ;_ end of SUBST ) ;_ end of SETQ (SETQ ltype_lst (SUBST (CONS (CDR (ASSOC 8 this_ent)) (LIST (CDR (ASSOC (CDR (ASSOC 8 this_ent)) ltype_Lst)) (CDR (ASSOC 6 this_ent))) ) ;_ end of CONS (ASSOC (CDR (ASSOC 8 this_ent)) ltype_lst) ltype_lst ) ;_ end of SUBST ) ;_ end of SETQ ) ;_ end of IF ) ;_ end of IF (SETQ ltype_lst (APPEND ltype_lst (LIST (CONS (CDR (ASSOC 8 this_ent)) (CDR (ASSOC 6 this_ent)))))) ) ;_ end of IF (SETQ ltype_lst (LIST (CONS (CDR (ASSOC 8 this_ent)) (CDR (ASSOC 6 this_ent))))) ) ;_ end of IF (SETQ this_ent (APPEND (REVERSE (CDR (MEMBER (ASSOC 6 this_ent) (REVERSE this_ent)))) (CDR (MEMBER (ASSOC 6 this_ent) this_ent)) ) ;_ end of append ) ;_ end of setq ) ;_ end of PROGN ) ;_ end of if ) ;_ end of IF (IF (OR (EQ (STRCASE ce_option) "COLOR") (EQ (STRCASE ce_option) "CLT") (EQ (STRCASE ce_option) "CLW") (EQ (STRCASE ce_option) "ALL") ) ;_ end of OR (PROGN (IF (ASSOC 62 this_ent) NIL (SETQ this_ent (APPEND this_ent (LIST (CONS 62 256)))) ) ;_ end of IF (IF (EQ (CDR (ASSOC 62 this_ent)) 256) NIL (PROGN (IF color_lst (IF (ASSOC (CDR (ASSOC 8 this_ent)) color_lst) (IF (OR (EQ (CDR (ASSOC 62 this_ent)) (CDR (ASSOC (CDR (ASSOC 8 this_ent)) color_lst))) (AND (EQ (TYPE (CDR (ASSOC (CDR (ASSOC 8 this_ent)) color_lst))) 'LIST) (MEMBER (CDR (ASSOC 62 this_ent)) (CDR (ASSOC (CDR (ASSOC 8 this_ent)) color_lst))) ) ;_ end of AND ) ;_ end of OR NIL (IF (EQ (TYPE (CDR (ASSOC (CDR (ASSOC 8 this_ent)) color_lst))) 'LIST) (SETQ color_lst (SUBST (CONS (CDR (ASSOC 8 this_ent)) (APPEND (CDR (ASSOC (CDR (ASSOC 62 this_ent)) color_lst)) (LIST (CDR (ASSOC 62 this_ent))) ) ;_ end of APPEND ) ;_ end of CONS (ASSOC (CDR (ASSOC 8 this_ent)) color_lst) color_lst ) ;_ end of SUBST ) ;_ end of SETQ (SETQ color_lst (SUBST (CONS (CDR (ASSOC 8 this_ent)) (LIST (CDR (ASSOC (CDR (ASSOC 8 this_ent)) color_lst)) (CDR (ASSOC 62 this_ent)) ) ;_ end of LIST ) ;_ end of CONS (ASSOC (CDR (ASSOC 8 this_ent)) color_lst) color_lst ) ;_ end of SUBST ) ;_ end of SETQ ) ;_ end of IF ) ;_ end of IF (SETQ color_lst (APPEND color_lst (LIST (CONS (CDR (ASSOC 8 this_ent)) (CDR (ASSOC 62 this_ent)))))) ) ;_ end of IF (SETQ color_lst (LIST (CONS (CDR (ASSOC 8 this_ent)) (CDR (ASSOC 62 this_ent))))) ) ;_ end of IF ) ;_ end of PROGN ) ;_ end of IF (SETQ this_ent (SUBST (CONS 62 256) (ASSOC 62 this_ent) this_ent)) ) ;_ end of PROGN ) ;_ end of IF ;;; (IF (OR (EQ (STRCASE ce_option) "LWEIGHT") ;;; (EQ (STRCASE ce_option) "CLW") ;;; (EQ (STRCASE ce_option) "LTLW") ;;; (EQ (STRCASE ce_option) "ALL") ;;; ) ;_ end of OR ;;; (SETQ this_ent (SUBST (CONS 370 -3) (ASSOC 370 this_ent) this_ent)); Sets Lineweight to "Default" ;;; ) ;_ end of IF ;;; (IF (OR (EQ (STRCASE ce_option) "LWEIGHT") ;;; (EQ (STRCASE ce_option) "CLW") ;;; (EQ (STRCASE ce_option) "LTLW") ;;; (EQ (STRCASE ce_option) "ALL") ;;; ) ;_ end of OR ;;; (IF (ASSOC 370 this_ent) ;;; (SETQ this_ent (APPEND (REVERSE (CDR (MEMBER (ASSOC 370 this_ent) (REVERSE this_ent)))) ;;; (CDR (MEMBER (ASSOC 370 this_ent) this_ent)); Should Set Lineweight to "BYLAYER" but doesn't ;;; ) ;_ end of append ;;; ) ;_ end of setq ;;; ) ;_ end of if ;;; ) (ENTMOD this_ent) (entupd(cdr(assoc -1 this_ent))) (SETQ cnt (1+ cnt)) ) ;_ end of while (IF (AND (OR (EQ (STRCASE ce_option) "LTYPE") (EQ (STRCASE ce_option) "CLT") (EQ (STRCASE ce_option) "LTLW") (EQ (STRCASE ce_option) "ALL") ) ;_ end of OR (EQ (SETQ setlayerltypes (ukword 1 "Yes No" "Set layer linetypes to an entity linetype found on the layer?" (IF setlayerltypes setlayerltypes "Yes" ) ;_ end of IF ) ;_ end of ukword ) ;_ end of SETQ "Yes" ) ;_ end of EQ ) ;_ end of AND (PROGN (FOREACH n ltype_lst (IF (AND (EQ (TYPE (CDR n)) 'LIST) (> (LENGTH (CDR n)) 1)) (PROGN (SETQ nooflayers (LENGTH (CDR n)) ce2b_cnt 0 kword_str nil ltypes_str nil this_lname (CAR n) ) ;_ end of setq (WHILE (< ce2b_cnt nooflayers) (IF kword_str (SETQ kword_str (STRCAT kword_str " " (ITOA (1+ ce2b_cnt)))) (SETQ kword_str (ITOA (1+ ce2b_cnt))) ) ;_ end of if (SETQ ce2b_cnt (1+ ce2b_cnt)) ) ;_ end of while (FOREACH o (CDR n) (IF ltypes_str (SETQ ltypes_str (STRCAT ltypes_str " \"" o "\"")) (SETQ ltypes_str (STRCAT "\"" o "\"")) ) ;_ end of if ) ;_ end of foreach (SETQ this_ltype (ukword 1 kword_str (STRCAT "Which Linetype to use for layer " (CAR n) "? [" ltypes_str "] (specify as " kword_str ")" ) ;_ end of strcat nil ) ;_ end of ukword ) ;_ end of setq (SETQ this_ltype_ndx (1- (READ this_ltype))) (SETQ this_ltype (NTH this_ltype_ndx (CDR n))) (SETQ this_layer_ent (ENTGET (TBLOBJNAME "layer" (CAR n)))) (SETQ this_layer_ent (SUBST (CONS 6 this_ltype) (ASSOC 6 this_layer_ent) this_layer_ent)) (ENTMOD this_layer_ent) ) ;_ end of progn (PROGN (SETQ this_ltype (IF (EQ (TYPE (CDR n)) 'LIST) (CADR n) (CDR n) ) ;_ end of IF ) ;_ end of SETQ (SETQ this_layer_ent (ENTGET (TBLOBJNAME "layer" (CAR n)))) (SETQ this_layer_ent (SUBST (CONS 6 this_ltype) (ASSOC 6 this_layer_ent) this_layer_ent)) (ENTMOD this_layer_ent) ) ;_ end of progn ) ;_ end of if ) ;_ end of foreach ) ;_ end of PROGN ) ;_ end of IF (IF (AND (OR (EQ (STRCASE ce_option) "COLOR") (EQ (STRCASE ce_option) "CLT") (EQ (STRCASE ce_option) "CLW") (EQ (STRCASE ce_option) "ALL") ) ;_ end of OR\ (EQ (SETQ setlayercolors (ukword 1 "Yes No" "Set layer colors to an entity color found on the layer?" (IF setlayercolors setlayercolors "Yes" ) ;_ end of IF ) ;_ end of ukword ) ;_ end of SETQ "Yes" ) ;_ end of EQ ) ;_ end of AND (PROGN (FOREACH n color_lst (IF (AND (EQ (TYPE (CDR n)) 'LIST) (> (LENGTH (CDR n)) 1)) (PROGN (SETQ noofcolors (LENGTH (CDR n)) ce2b_cnt 0 kword_str nil colors_str nil this_lname (CAR n) ) ;_ end of setq (WHILE (< ce2b_cnt noofcolors) (IF kword_str (SETQ kword_str (STRCAT kword_str " " (ITOA (1+ ce2b_cnt)))) (SETQ kword_str (ITOA (1+ ce2b_cnt))) ) ;_ end of if (SETQ ce2b_cnt (1+ ce2b_cnt)) ) ;_ end of while (FOREACH o (CDR n) (IF colors_str (SETQ colors_str (STRCAT colors_str " " (ITOA o))) (SETQ colors_str (ITOA o)) ) ;_ end of if ) ;_ end of foreach (SETQ this_color (ukword 1 colors_str (STRCAT "Which Color to use for layer " (CAR n) "? [" colors_str "]") ;_ end of strcat nil ) ;_ end of ukword ) ;_ end of setq (SETQ this_color (READ this_color)) (SETQ this_layer_ent (ENTGET (TBLOBJNAME "layer" (CAR n)))) (SETQ this_layer_ent (SUBST (CONS 62 this_color) (ASSOC 62 this_layer_ent) this_layer_ent)) (ENTMOD this_layer_ent) ) ;_ end of progn (PROGN (SETQ this_color (IF (EQ (TYPE (CDR n)) 'LIST) (CADR n) (CDR n) ) ;_ end of IF ) ;_ end of SETQ (SETQ this_layer_ent (ENTGET (TBLOBJNAME "layer" (CAR n)))) (SETQ this_layer_ent (SUBST (CONS 62 this_color) (ASSOC 62 this_layer_ent) this_layer_ent)) (ENTMOD this_layer_ent) ) ;_ end of progn ) ;_ end of if ) ;_ end of foreach ) ;_ end of PROGN ) ;_ end of IF (IF (OR (EQ (STRCASE ce_option) "LWEIGHT") (EQ (STRCASE ce_option) "CLW") (EQ (STRCASE ce_option) "LTLW") (EQ (STRCASE ce_option) "ALL") ) ;_ end of OR (PROGN (SETQ reset_lalw (ukword 1 "Yes No" "Reset all layer lineweights to \"Default\"? [Yes No]" (IF reset_lalw reset_lalw "No" ) ;_ end of if ) ;_ end of ukword ) ;_ end of setq (IF (EQ (STRCASE reset_lalw) "YES") (COMMAND ".-layer" "lw" "default" "*" "") ) ;_ end of IF ) ;_ end of PROGN ) ;_ end of IF (COND ((EQ (STRCASE ce_option) "ALL") (COMMAND ".chprop" eset "" "c" "bylayer" "lt" "bylayer" "lw" "bylayer" "") ) ((EQ (STRCASE ce_option) "COLOR") (COMMAND ".chprop" eset "" "c" "bylayer" "")) ((EQ (STRCASE ce_option) "LTYPE") (COMMAND ".chprop" eset "" "lt" "bylayer" "")) ((EQ (STRCASE ce_option) "LWEIGHT") (COMMAND ".chprop" eset "" "lw" "bylayer" "")) ((EQ (STRCASE ce_option) "CLT") (COMMAND ".chprop" eset "" "c" "bylayer" "lt" "bylayer" "")) ((EQ (STRCASE ce_option) "CLW") (COMMAND ".chprop" eset "" "c" "bylayer" "lw" "bylayer" "")) ((EQ (STRCASE ce_option) "LTLW") (COMMAND ".chprop" eset "" "lt" "bylayer" "lw" "bylayer" "")) ) ;_ end of COND ) ;_ end of PROGN ) ;_ end of IF (PRINC) ) ;defun ;|«Visual LISP© Format Options» (120 2 15 2 T "end of " 100 9 2 0 nil nil nil nil T) ;*** DO NOT add text below the comment! ***|;