Well here goes, the below LISP (EditNote), can be placed in CAB's "TextInsertDCL10_0.lsp" LISP.
Found here;
http://www.theswamp.org/index.php?topic=1392.msg508047#msg508047This function is necessary mainly because word-wrap does not work in a Dialog Box, and it would be beneficial to
be able to edit the TID files directly in CAD. A much better solution then having all your std notes in a block and inserting/exploding, as they can be individually edited in each drawing or edited and saved as a text file for future use.
To install;
1.-See Instructions in Header of Code
Couple of rules;
You cannot format the text while editing. (format stripping code is not fully developed, and saved strictly as plain text)
You can add/delete lines of text just as in MText.
DO NOT ACCEPT THE "a Template.TID" as a default in the function.... (there is a gremlin needs to be shooed away...)
One small issues I need to fix (any assistance would be great)
Need the highlighted Note to not index to the first one once a file is edited.
;;------------------------------------------------------------------------------;;
;; ;;
;; EditNote by; F. Bruce Fillmore ;;
;; Weare, NH 03281 ;;
;; AKA; snownut2 ;;
;; ;;
;; Edit Existing Note ;;
;; or ;;
;; Create New Note ;;
;; ;;
;; Written 1/26/2014 ;;
;; To Install; ;;
;; 1.- Comment out lines 2424 & 2425 ;;
;; 2.- Paste this "EditNote" Function ;;
;; In place of existing "EditNote" Function ;;
;; 3.- Replace Line 3076 with line below ;;
;; ((= action 5) (EditNote datarecord)) ;;
;;______________________________________________________________________________;;
(defun EditNote
(datarecord
/ datalayer datadims datawidth ent txtlst newnte
hedtxt oldnte file_txt newdatarecord
)
(defun textedit
(txtlist
/ txt itm allstrings mtxtlist entlist
p1 p2 scrhght scrwdth AcadObj
)
) ; (mid p1 p2)
(defun scrratio
(hght
/ scsize ratio wdth
) ratio
(/ (car scsize
)(cadr scsize
)) wdth (* hght ratio)
)
);defun
(cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbTextStyleTableRecord") )
)
)
scrwdth
(scrratio
(getvar 'viewsize
)) p1
(list (-(car p2
)(/ scrwdth
2))(+(cadr p2
)(/ scrhght
2))) mtxtlist '()
allstrings ""
entlist
)
)
; following code from CAB's textinsert tool
(foreach itm txtlist
; combine all strings plus EOL code ) ;; remove the last \\P
(while (> (strlen allstrings
) 250) ; Break into 250 char groups (setq allstrings
(substr allstrings
251)) ; remaining characters )
;; Add the remaining text to the list of groups w/ code 1
;; Combine entity list with text list
scrhght
)
);defun
(defun MTxtConvert
( ent
/ newtxtl newlst lst MTstr TxtLst newtxtL
ct cnt tempitem1 tempitem2)
(defun MTstr
->TxtLst
( str
/ s strl newlst
) (defun _replacequotes
( str
/ pos
) ; borrowed from Lee Mac (setq str
(vl
-string
-subst "\"" "\"\"" str pos
) )
)
str
);defun
(defun _\p
->lst
( str pos
/ s
) ; borrowed from Lee Mac - revised slightly )
)
(_replacequotes
(substr str
2 (- pos
2))) (_\p
->lst
(substr str
(+ pos
2)) 0) )
)
(_\p->lst str (+ pos 2))
)
)
);defun
(setq strl
(_\p
->lst str
0) )
)
);defun (MTstr->TxtLst)
(defun cdrs
(key lst
/ pair rtn
) )
)
);defun
(setq MTstr
(cdrs
3 ent
)) (setq TxtLst
(MTstr
->TxtLst x
) newtxtL
(cons TxtLst newtxtl
) )
)
MTstr (cdrs 1 ent)
TxtLst
(MTstr
->TxtLst
(car MTstr
)) newtxtL
(cons TxtLst newtxtL
) )
newtxtL
(subst tempitem1
(nth ct newtxtL
) newtxtL
) )
newtxtL
(subst tempitem2
(nth (1+ ct
) newtxtL
) newtxtL
) )
)
)
)
lst
);defun
(defun read_file
(fn
/ ln txtitm bodytxt heading
) (if (> ti_debug
2) (prompt "\nOpening File to Read")) (setq fn
(open fn
"r")) ; open file for reading );while
);while
bodytxt
(cons txtitm bodytxt
) txtitm nil
)
);while
(close fn
) ; close the open file handle );progn
);if
);defun
(defun write_file
(fn file_txt
) )
(if (> ti_debug
2) (prompt "\nOpening File for Writing")) (setq fn
(open fn
"w")) ; open file for writing )
)
);defun
(defun Append_File_Dialog
( / datarecorda dclfiletemp dcl_ida
) )
(princ "\n- Function Cancelled -") );defun
(defun write_append_dialog
( / fnappend
) ; Writes DCL Dialog to "TEMP" Folder "appendtid: dialog {"
" label = \"Append TID File --- by F. Bruce Fillmore \";"
" : boxed_column { label = \"Select Appropriate DATA or < current settings >\"; width = 60;"
" : edit_box { label = \"Enter Title for Note Item .....\"; key = \"datarecord\"; width = 25; }"
" : popup_list { label = \"Select Layer for placement \" ; key = \"datalayer\" ; width = 30; }"
" : popup_list { label = \"Select the Dimension Style \" ; key = \"datadims\" ; width = 30; }"
" : edit_box { label = \"Enter Width for MText Note \" ; key = \"datawidth\" ; fixed_width = true ; width = 5; }"
" }"
" : spacer { height = 0.5; }"
" ok_cancel;"
" : errtile { width= 20; alignment = centered; } "
" }") ; endlist
) ; end foreach
(princ "\nAppend Dialog Written ;") );defun
(set_tile "error" "You need to ENTER a NOTE TITLE !") );progn
);progn
)
);defun
(write_append_dialog)
);if
(action_tile "datalayer" "(setq ovr:layer (nth (atoi $value) lay_list))") (action_tile "datadims" "(setq ovr:dim (nth (atoi $value) dim_list))") (action_tile "datawidth" "(setq ovr:width (atof $value))") );defun
(setq datarecord
(if (= action
5)(Append_File_Dialog
)datarecord
))
)
datawidth
(if (null ovr:width
) )
)
)
(textedit
(cdr datarecord
)) txtlst (MTXTCONVERT ent)
)
(if (= action
5) ; Action = 5 for append file (progn ; Action = 6 for edit file newnte
(append datalayer datawidth datadims
(list(car datarecord
)) txtlst
) )
(appendfile tid_filename newnte)
)
(setq file_txt
(read_file tid_filename
) hedtxt
(list (strcat "***Text Item**Revised "(getdate
)"")) newnte
(append hedtxt datalayer datawidth datadims
(list(car datarecord
)) txtlst hedtxt
) )
)
)
(setq file_txt
(subst newnte oldnte file_txt
) txtlist
(subst newdatarecord datarecord txtlist
) )
(write_file tid_filename file_txt)
)
)
(setq datarecord newdatarecord
) );defun
All works fine in BricsCAD when you specify NOTEPAD as the MText editor in SETTINGS or using the default editor.
This function will edit EXISTING or CREATE a NEW note.