;;;Formats and places individualized construction notes. ;;; ;;;Requirements: ;;; (A) Insert(s) of a block named B_TAG w/ one ATTRIB who's value is a no.; ;;; (B) Text file named CONOTE.TXT with ALL of the construction notes. ;;; 1st line of file contains a number, ;;; 2nd line of file contains that number's note, ;;; 3rd line of file contains another number, ;;; 4th line of file contains that number's note, ;;; etc. ;;; ;;; Use only one line for each entire note text. ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 10-23-2002 ;;;> EDITED: 08-25-2006 ;;; (defun c:dtlnote (/ tag_lst ndx_line red_line note_offd note_len new_len start_pt cbpt2 note_lst cbpt3 cbpt4 cnpt1 cnpt1a hdrpt1 hdrpt1a ttl_pt cnpt2 cnpt2a cnpt3 cnpt3a cnpt4 cnpt4a cnpt5 cnpt5a cnpt6 cnpt6a cnpt7 cnpt7a cnpt8 cnpt8a cnpt9 cnpt9a cnpt10 cnpt10a note_txt str_cnt str_offd notes_title ) (SETQ OLD_EXPERT (GETVAR "EXPERT")) (SETVAR "EXPERT" 5) (command ".undo" "begin") (setq old_do_exist do_exist do_exist nil colra NIL colri NIL colr "6" ) (if (setq note_ofil (open (getfiled "Insert Note File" (strcat (getvar "dwgprefix") (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4) ) ;_ end of SUBSTR ) ;_ end of STRCAT "txt" 4 ) ;_ end of getfiled "r" ) ;_ end of open ) ;_ end of setq (progn (setq old_osmode (getvar"osmode")) (setvar "osmode" 0) (while (and (setq ndx_line (read-line note_ofil)) (setq red_line (read-line note_ofil)) ) ;_ end of and (IF (EQ (TYPE (READ (SUBSTR ndx_line 1 1))) 'SYM) (SETQ notes_title ndx_line ndx_line red_line red_line (read-line note_ofil)) ) (if note_lst (setq note_lst (append note_lst (list (cons (atoi ndx_line) (strcase red_line))) ) ;_ end of append ) ;_ end of setq (setq note_lst (list (cons (atoi ndx_line) (strcase red_line))) ) ;_ end of setq ) ;_ end of if ) ;_ end of while (setq cnt 2) (setq minnote_len nil) (foreach n note_lst (if minnote_len (setq minnote_len (min minnote_len (strlen (cdr n)))) (setq minnote_len (strlen (cdr n))) ) ) (if getstyle nil (load "getstyle") ) ;_ end of if (getstyle "A") (IF uint NIL (LOAD "uint" "\nFile UINT.LSP not loaded! ")) (setq wraplen (uint 1 "Match" (STRCAT "Note wrap length or atch existing" (IF minnote_len (STRCAT " " (CHR 40) "shortest note length is "(ITOA minnote_len)(CHR 41)) "" ) ) ;;; (if minnote_len ;;; minnote_len (if wraplen wraplen 50.0 ) ;_ end of if ;;; ) ) ;_ end of uint ) ;_ end of setq (if (eq wraplen "Match") (progn (while (or (not (setq MATCH_TEXT (entsel "\nSelect text to match. ")) ) ;_ end of not (/= (cdr (assoc 0 (entget (car MATCH_TEXT)))) "TEXT") ) ;_ end of OR ) ;_ end of WHILE (setq wraplen (strlen (cdr (assoc 1 (entget (car MATCH_TEXT))))) ) ;_ end of setq ) ;_ end of PROGN ) ;_ end of IF (if txtsize nil (load "txtsize" "\nFile TXTSIZE.LSP not found!") ) ;_ end of if (txtsize nil) (if dimscl nil (load "dimscl") ) ;_ end of if (dimscl) (if c:mklayr nil (load "mklayr") ) ;_ end of if (c:svlayr) (IF upoint NIL (LOAD "upoint" "\nFile UPOINT.LSP not loaded! ")) (setq start_pt (upoint 1 "" "Pick point for upper left corner of Notes" nil nil ) ;_ end of upoint ) ;_ end of setq (setq cnpt1 (polar start_pt ;;; (polar start_pt ;;; (- 0 (getvar "viewtwist")) ;;; (* dimsc 0.4) ;;; ) ;_ end of polar (- 0 (getvar "viewtwist") (* pi 0.5)) ;;; (* dimsc 0.65) (* dimsc (atoi thts) 0.001 2.5) ) ;_ end of polar cnpt1a (polar cnpt1 (- 0 (getvar "viewtwist")) (* dimsc (atoi thts) 0.001 2.85) ) ;_ end of polar ;;; hdrpt1 (polar start_pt ;;; (polar start_pt ;;; (- 0 (getvar "viewtwist")) ;;; (* dimsc 0.4) ;;; ) ;_ end of polar ;;; (- 0 (getvar "viewtwist") (* pi 0.5)) ;;; (* dimsc 0.43) ;;; ) ;_ end of polar ;;; hdrpt1a (polar hdrpt1 (- 0 (getvar "viewtwist")) (* dimsc 0.25)) ) ;_ end of setq (foreach n note_lst (set (read (strcat "cnpt" (itoa cnt))) (polar (eval (read (strcat "cnpt" (itoa (1- cnt))))) (- 0 (getvar "viewtwist") (* pi 0.5)) (* dimsc (atoi thts) 0.001 2.5) ) ;_ end of polar ) ;_ end of set (set (read (strcat "cnpt" (itoa cnt) "a")) (polar (eval (read (strcat "cnpt" (itoa (1- cnt)) "a"))) (- 0 (getvar "viewtwist") (* pi 0.5)) (* dimsc (atoi thts) 0.001 2.5) ) ;_ end of polar ) ;_ end of set (setq cnt (1+ cnt)) ) ;_ end of foreach (if note_ofil (progn (close note_ofil) (setq cnt 1) (setq llt "-" colr txcolr modf (if do_cmud_issues "REVU" "NOTE" ) ;_ end of IF var_indx (length note_lst) ) ;_ end of setq (c:mklayr) (if note_lst (progn (setq subnotlst (LIST "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")) (setq subncnt 0) (foreach n note_lst (if (EQ (CAR n) 0) (SETQ start_subn T) (SETQ start_subn nil) ) (command ".text" "j" "ml" (polar (list (car (eval (read (strcat "cnpt" (itoa cnt))))) (cadr (eval (read (strcat "cnpt" (itoa cnt))))) (* dimsc 1002.5) ) ;_ end of list (- 0 (getvar "viewtwist") (* pi 0.5)) (if note_offd note_offd 0 ) ;_ end of if ) ;_ end of polar (* (atoi thts) 0.001 dimsc) (* (/ (- 0 (getvar "viewtwist")) pi) 180) (strcat (COND ((AND (EQ (TYPE (CAR n)) 'int)(/= (CAR n) 0)) (itoa (car n))) ((EQ (CAR n) 0) (NTH subncnt subnotlst)) ((EQ (TYPE n) 'STR) (CAR n)) (T "?") ) (if do_cmud (chr 41) "." ) ;_ end of if ) ;_ end of strcat ) ;_ end of command (if start_subn (SETQ subncnt (1+ subncnt)) ) (setq note_txt (cdr n)) (if abrkstr nil (load "abrkstr") ) ;_ end of if (if note_txt (progn (abrkstr note_txt (if start_subn (- wraplen 6) wraplen)) (setq str_cnt 1) (repeat var_indx (setq str_offd (* (1- str_cnt) (* 1.5 (atoi thts) 0.001 dimsc) ) ;_ end of * ) ;_ end of setq (command ".text" "j" "ml" (polar (eval (read (strcat "cnpt" (itoa cnt) "a"))) (- 0 (getvar "viewtwist") (* pi 0.5)) (if note_offd (+ note_offd str_offd) str_offd ) ;_ end of if ) ;_ end of polar (* (atoi thts) 0.001 dimsc) (* (/ (- 0 (getvar "viewtwist")) pi) 180) (eval (read (strcat "typ_t" (itoa str_cnt)))) ) ;_ end of command (setq str_cnt (1+ str_cnt)) (if note_len (if (> (setq new_len (distance (car (textbox (entget (entlast)))) (cadr (textbox (entget (entlast)))) ) ;_ end of DISTANCE ) ;_ end of setq note_len ) ;_ end of > (if new_len (setq note_len new_len) ) ;_ end of if ) ;_ end of if (setq note_len (distance (car (textbox (entget (entlast)))) (cadr (textbox (entget (entlast)))) ) ;_ end of DISTANCE ) ;_ end of setq ) ;_ end of if ) ;_ end of repeat (if note_offd (setq note_offd (+ note_offd str_offd)) ;(* dimsc 0.22) (setq note_offd str_offd) ;+ (* dimsc 0.22) ) ;_ end of if (setq cnt (1+ cnt) box_botm (polar (cdr (assoc 10 (entget (entlast)))) (- 0 (getvar "viewtwist") (* pi 0.5)) (* dimsc (atoi thts) 0.001 1.5) ) ;_ end of polar ) ;_ end of setq ) ;_ end of progn (princ "\nNo note available. Check file. ") ) ;_ end of if ) ;_ end of foreach (setq cbpt2 (polar start_pt (- 0 (getvar "viewtwist")) (+ (* dimsc (1+ (* (atoi thts) 0.001))) (if note_len note_len 50 ) ;_ end of if ) ;_ end of + ) ;_ end of polar tmp_pt1 (polar cbpt2 (- 0 (getvar "viewtwist") (* pi 0.5)) 10 ) ;_ end of polar tmp_pt2 (polar box_botm (- 0 (getvar "viewtwist")) 10) cbpt3 (inters cbpt2 tmp_pt1 box_botm tmp_pt2 nil) cbpt4 (polar cbpt3 (angle cbpt2 start_pt) (+ (* dimsc (1+ (* (atoi thts) 0.001))) (if note_len note_len 50 ) ;_ end of if ) ;_ end of + ) ;_ end of polar ttl_pt start_pt ;;; (polar (polar start_pt ;;; (- 0 (getvar "viewtwist")) ;;; ;;; (/ (distance start_pt cbpt2) 2) ;;; (/ note_len 2); MIDPOINT of notes ;;; ) ;_ end of polar ;;; (+ (- 0 (getvar "viewtwist")) (* pi 0.5)) ;;; (* (atoi thts) 0.001 dimsc) ;;; ) ;_ end of polar ) ;_ end of setq (setq colr txcolr) (c:mklayr) ;;; (princ "\nnote_lst = ") ;;; (princ note_lst) ;;; (princ) (if do_cmud (PROGN (command ".text" "j" "ml" start_pt (* (* (atoi thts) 0.001) dimsc) (* (/ (- 0 (getvar "viewtwist")) pi) 180) (IF (EQ (LENGTH note_lst) 1) "NOTE:" "NOTES:" ) ) ;_ end of command ) (PROGN (command ".text" "j" "ml" ttl_pt (* (atoi thts) 0.001 dimsc) (* (/ (- 0 (getvar "viewtwist")) pi) 180) (IF (EQ (LENGTH note_lst) 1) "NOTE:" "NOTES:" ) ) ;_ end of command (IF notes_title (PROGN (SETQ colr "2") (c:mklayr) (command ".text" "j" "ml" (POLAR ttl_pt (+ (* (/ (- 0 (getvar "viewtwist")) pi) 180) (* PI 0.5)) (* 4.0 (atoi thts) 0.001 dimsc)) (* 175 0.001 dimsc) (* (/ (- 0 (getvar "viewtwist")) pi) 180) (STRCASE (STRCAT "%%U" notes_title)) ) ;_ end of command ) ) ) ) ;_ end of if ) ;_ end of progn (princ "\nNo notes. Check file! ") ) ;_ end of if ) ;_ end of progn (princ "\nFile not found! ") ) ;_ end of if (setvar "osmode" old_osmode) (c:rslayr) (getstyle "") (clr_txt) ) ;_ end of progn ) ;_ end of if (setq do_exist old_do_exist) (command ".undo" "end") (SETVAR "EXPERT" OLD_EXPERT) (princ) ) ;_ end of defun ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 1 0 0 T T nil T) ***Don't add text below the comment!***|;