daniil 0 Posted February 23 Hi everyone! Want lisp which convert mleader to text (not mtext) and delete arrow or lines if i take explode. Quote Share this post Link to post Share on other sites
pkenewell 46 Posted Thursday at 03:11 PM 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 Share this post Link to post Share on other sites
pkenewell 46 Posted Friday at 04:41 PM @daniil Hello? Any feedback on my solution? Quote Share this post Link to post Share on other sites
rkmcswain 85 Posted Friday at 06:22 PM I just tried it, on a selection set of 9 multileaders. It only operates on one of the 9 in the selection set. Quote Share this post Link to post Share on other sites
pkenewell 46 Posted Friday at 06:46 PM 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 Share this post Link to post Share on other sites
daniil 0 Posted 14 hours ago 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 Share this post Link to post Share on other sites