View Full Version : add a prifix to all exisitng text
windowsxp5
2005-09-26, 02:17 PM
hi frnds
anybody has a lisp can do
add a prifix to all exisitng text
example(I WANT TO ADD A PRIFIX "L=") : 22.2 15.5 15.55
after using lisp i wnat text to be: L=22.2 L= 15.5 L= 15.55.
THAKS IN ADVANCE
Try this.....
(defun c:addpre (/ COUNT ENT NEWSTR OLDSTR SS)
(setq
newstr (getstring T "\n Text to add to beginning of selected strings: ")
)
(setq ss (ssget '((0 . "TEXT"))))
(if ss
(progn
(setq count 0)
(while (< count (sslength ss))
(setq ent (entget (ssname ss count)))
(setq oldstr (strcat newstr (cdr (assoc 1 ent))))
(setq ent (subst (cons 1 oldstr) (assoc 1 ent) ent))
(entmod ent)
(setq count (1+ count))
)
)
(princ "\nNo text entities selected.....")
)
(princ)
)
windowsxp5
2005-09-27, 11:59 AM
lisp works well
Thanks
peter
2005-09-28, 01:57 PM
here is another version using active x (in the attachment) because the forum code window is scrambling my code :(
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.