Jump to content

Request: Help changing ENTSEL code to SSGET


Recommended Posts

Posted

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.

 

 

 

Posted
(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.

Posted

Works perfectly..

Thank you so VERY much!!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...