ILoveMadoka Posted August 4, 2023 Posted August 4, 2023 I found and modified the code found here to create this (defun C:EE1 (/ ent obj new_str) ;;; Add (E) to the end of a string (vl-load-com) (if (and (setq ent (car (entsel "\nSelect text object: "))) (wcmatch (cdadr (entget ent)) "*TEXT*") (setq obj (vlax-ename->vla-object ent)) (setq new_str "(E)")) (progn (vla-put-textstring obj (strcat (vla-get-textstring obj) " " new_str)) (princ "\nText updated successfully.") ) (princ "\nInvalid selection or empty string.") ) (princ) ) which works on a single selected object. Not sure how to create the repeat loop to process a selection set of TEXT/MTEXT objects. Quote
marko_ribar Posted August 4, 2023 Posted August 4, 2023 (defun C:EE1 (/ ss i obj new_str) ;;; Add (E) to the end of a string (vl-load-com) (if (and (not (prompt "\nSelect text objects on unlocked layer(s) : ")) (setq ss (ssget "_:L" '((0 . "*TEXT*")))) (setq new_str "(E)")) (repeat (setq i (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (vla-put-textstring obj (strcat (vla-get-textstring obj) " " new_str)) (princ "\nText updated successfully.") ) (princ "\nInvalid selection or empty string.") ) (princ) ) Untested, but should work as desired... HTH., M.R. Quote
ILoveMadoka Posted August 7, 2023 Author Posted August 7, 2023 Works perfectly.. Thank you so VERY much!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.