Text Lisp
Text Lisp
(OP)
Does anyone have a lisp that can edit Mtext or regular text to put common things behind or in front of the text?
Example:
I have a leader with text "a"(mtext or regular text) and I want it to read "a typ" or "a SEE DETAIL" or "2X a SEE Detail"
So I am looking for something that I can pick the text and then pick a prefix to apply to that text? Just curios.
Example:
I have a leader with text "a"(mtext or regular text) and I want it to read "a typ" or "a SEE DETAIL" or "2X a SEE Detail"
So I am looking for something that I can pick the text and then pick a prefix to apply to that text? Just curios.





RE: Text Lisp
Yes you can do that with a lisp
program, but may not be worth it
(time spent in writing routine)
for single use only. It's good to
do it via lisp when you are adding
additonal text to multiple instances
in mutltiple drawings.
RE: Text Lisp
I have noticed some utilities for boms which would be nice, but for me and my use, a perfect thing would be to have buttons for assigning piece marks, a dialog pops up, type in the name and values to be put in the bom, for lengths to click a dimension and the length is put in the bom.
But for now I spend alot of time cleaning up drawings with putting typ, ns+fs, see deails text on existing text. So that is what I was really looking for.
RE: Text Lisp
;
"CT" Change text
;
(DEFUN chgterr (s)
(if (/= s "Function cancelled") ; If an error (such as CTRL-C) occurs
(princ (strcat "\nError: " s)) ; while this command is active...
)
(setq p nil) ; Free selection set
(setq *error* olderr) ; Restore old *error* handler
(princ)
)
;
(DEFUN C:CT (/ p l n e os as ns st s nsl osl sl si chf chm olderr) ; Correct spelling errors
(setq olderr *error* ; Initialize variables
*error* chgterr
chm 0)
(setq p (ssget)) ; Select objects
(if p (progn ; If any objects selected
(while (= 0 (setq osl (strlen (setq os (getstring t "\nOld string: ")))))
(princ "Null input invalid")
)
(setq nsl (strlen (setq ns (getstring t "\nNew string: "))))
(setq l 0 n (sslength p))
(while (< l n) ; For each selected object...
(if (= "TEXT" ; Look for TEXT entity type (group 0)
(cdr (assoc 0 (setq e (entget (ssname p l))))))
(progn
(setq chf nil si 1)
(setq s (cdr (setq as (assoc 1 e))))
(while (= osl (setq sl (strlen
(setq st (substr s si osl)))))
(if (= st os)
(progn
(setq s (strcat (substr s 1 (1- si)) ns
(substr s (+ si osl))))
(setq chf t) ; Found old string
(setq si (+ si nsl))
)
(setq si (1+ si))
)
)
(if chf (progn ; Substitute new string for old
(setq e (subst (cons 1 s) as e))
(entmod e) ; Modify the TEXT entity
(setq chm (1+ chm))
))
)
)
(setq l (1+ l))
)
))
(princ "Changed ") ; Print total lines changed
(princ chm)
(princ " text lines.")
(terpri)
(setq *error* olderr) ; Restore old *error* handler
(princ)
)
RE: Text Lisp
See if you can use this program by Brenda Larson entitled "Notes Made Easy". Its in the February 1997 issue of Cadalyst magazine (Tips 1291A-D). They can be downloaded at this site: http://new.cadalyst.com/code/browseyear.cfm?fullyear=1997#2
Some modification may be needed to fit your needs.