;; ===================================================================== ;; AppendText.lsp - append the same text to the end of many text objects ;; Command: APPENDTEXT ;; AutoCAD / GstarCAD (AutoLISP). Description and installation: ;; https://fixcontrol.co/tools/autocad-lisp-scripts ;; ;; WHAT IT DOES: ;; 1. Asks for the text to append (spaces allowed; Enter finishes). ;; 2. You select text objects (TEXT, MTEXT). ;; 3. The given text is appended to the end of every selected text, ;; e.g. "12" + " m2" -> "12 m2". ;; Leading spaces of the appended text are kept - if you want a gap, ;; type it. Undo with U. ;; ;; OPTIONS: none - the script has no settings. ;; ===================================================================== (defun c:APPENDTEXT ( / ss i obj suffix ) (vl-load-com) ;; text to append (spaces allowed) (setq suffix (getstring t "\nEnter text to append: ")) (setq ss (ssget '((0 . "TEXT,MTEXT")))) (if ss (progn (setq i 0) (while (< i (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss i))) (vla-put-TextString obj (strcat (vla-get-TextString obj) suffix)) (setq i (1+ i)) ) (princ (strcat "\nAppended \"" suffix "\" to " (itoa (sslength ss)) " text objects.")) ) (princ "\nNo text objects selected.") ) (princ) ) (princ "\nAPPENDTEXT loaded. Type APPENDTEXT to run.") (princ)