daniil Posted February 23, 2021 Share Posted February 23, 2021 Hi everyone! Want lisp which convert mleader to text (not mtext) and delete arrow or lines if i take explode. Quote Link to comment Share on other sites More sharing options...
pkenewell Posted February 25, 2021 Share Posted February 25, 2021 Here is the simplest way: (defun c:ML2TXT (/ en ss) (if (and ; Mark the last entity in the drawing. (setq en (entlast)) ;; Select the Multileader(s) (setq ss (ssget '((0 . "MULTILEADER")))) ) (progn (command "._explode" ss);; Explodes the mleader ;; loops to get all new entities created after explode. (while (setq en (entnext en)) ;; if a line, polyline or solid, delete it. (if (wcmatch (cdr (assoc 0 (entget en))) "*LINE,SOLID")(entdel en)) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
pkenewell Posted February 26, 2021 Share Posted February 26, 2021 @daniil Hello? Any feedback on my solution? Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted February 26, 2021 Share Posted February 26, 2021 I just tried it, on a selection set of 9 multileaders. It only operates on one of the 9 in the selection set. Quote Link to comment Share on other sites More sharing options...
pkenewell Posted February 26, 2021 Share Posted February 26, 2021 20 minutes ago, rkmcswain said: I just tried it, on a selection set of 9 multileaders. It only operates on one of the 9 in the selection set. @rkmcswain Thank you - I thought that it would gather all the new entities from the explode command without resetting the last entity. Wrong! Here's is a new solution: Tested on multiple MLEADERS. I had to change it to iterate through the selection set and explode 1 MLEADER at a time, get the new entities and delete them. (defun c:ML2TXT (/ en ss cnt) (if (and ; Mark the last entity in the drawing. (setq en (entlast)) ;; Select the Multileader(s) (setq ss (ssget '((0 . "MULTILEADER")))) ) (repeat (setq cnt (sslength ss)) ;; Get 1 MLEADER from the selection set. (setq en (ssname ss (setq cnt (1- cnt)))) ;; Explode the MLEADER (command "._explode" en) ;; Loop through the newly created entities. (while (setq en (entnext en)) ;; if a line, polyline or solid, delete it. (if (wcmatch (cdr (assoc 0 (entget en))) "*LINE,SOLID")(entdel en)) ) (setq en (entlast)) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
daniil Posted March 2, 2021 Author Share Posted March 2, 2021 On 26/02/2021 at 20:46, pkenewell said: @rkmcswain Thank you - I thought that it would gather all the new entities from the explode command without resetting the last entity. Wrong! Here's is a new solution: Tested on multiple MLEADERS. I had to change it to iterate through the selection set and explode 1 MLEADER at a time, get the new entities and delete them. (defun c:ML2TXT (/ en ss cnt) (if (and ; Mark the last entity in the drawing. (setq en (entlast)) ;; Select the Multileader(s) (setq ss (ssget '((0 . "MULTILEADER")))) ) (repeat (setq cnt (sslength ss)) ;; Get 1 MLEADER from the selection set. (setq en (ssname ss (setq cnt (1- cnt)))) ;; Explode the MLEADER (command "._explode" en) ;; Loop through the newly created entities. (while (setq en (entnext en)) ;; if a line, polyline or solid, delete it. (if (wcmatch (cdr (assoc 0 (entget en))) "*LINE,SOLID")(entdel en)) ) (setq en (entlast)) ) ) (princ) ) @pkenewell It is work very strange because this lisp delete polylines too Quote Link to comment Share on other sites More sharing options...
pkenewell Posted March 3, 2021 Share Posted March 3, 2021 On 3/2/2021 at 3:05 AM, daniil said: @pkenewell It is work very strange because this lisp delete polylines too Oops! Here is a correction: Tested with other polylines (defun c:ML2TXT (/ en en2 ss) (if (and ; Mark the last entity in the drawing. (setq en (entlast)) ;; Select the Multileader(s) (setq ss (ssget '((0 . "MULTILEADER")))) ) (repeat (setq cnt (sslength ss)) ;; Get 1 MLEADER from the selection set. (setq en2 (ssname ss (setq cnt (1- cnt)))) ;; Explode the MLEADER (command "._explode" en2) ;; Loop through the newly created entities. (while (setq en (entnext en)) ;; if a line, polyline or solid, delete it. (if (wcmatch (cdr (assoc 0 (entget en))) "*LINE,SOLID")(entdel en)) ) (setq en (entlast)) ) ) (princ) ) 1 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.