rcb007 Posted March 25, 2021 Share Posted March 25, 2021 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 25, 2021 Share Posted March 25, 2021 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) 2 Quote Link to comment Share on other sites More sharing options...
rcb007 Posted March 26, 2021 Author Share Posted March 26, 2021 Thank you Tharwat! This will help out alot! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 26, 2021 Share Posted March 26, 2021 You're welcome anytime. Quote Link to comment Share on other sites More sharing options...
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.