Jump to content

Removing Text in front of a Dash Mtext


rcb007

Recommended Posts

I have a bunch of mleaders in alot of files which have a dash in the labels. I need to come up with a way to remove the starting text and the dash. 


I wanted to use a find and replace, but the values are different in front of the dash. 

 

Is there a way where I can select a set of mleaders and which have a (i.e. ADSH123-Note 1, BEJGWHH99-Note 5) to be (i.e. Note 1, Note 5)?

 

Thank you for any help 

Link to comment
Share on other sites

This should work I believe.

(defun c:Test ( / int sel ent get str pos)
  ;; Tharwat - Date: 26.Mar.2021	;;
  (and (princ "\nSelect Mleader objects to parse strings after DASH once found : ")
       (setq int -1 sel (ssget "_:L" '((0 . "MULTILEADER"))))
       (while (setq int (1+ int) ent (ssname sel int))
         (setq get (entget ent)
               str (assoc 304 get)
               )
         (and (setq pos (vl-string-search "-" (cdr str)))
              (entmod (subst (cons 304 (substr (cdr str) (+ 2 pos))) str get))
              )
         )
       )
  (princ)
  ) (vl-load-com)

 

  • Like 2
Link to comment
Share on other sites

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