Jump to content

Recommended Posts

Posted
Good morning to everyone, they would be so kind to support me with a routine that eliminates leader and converts them into texts. thank you very much for your attention. Attached example file. thanks

 
 
 
 
 
 

MLTOTEXT.dwg

Posted
5 minutes ago, ronjonp said:

Explode? Why are you doing this?

I usually explore it when I have only one multileader, but if I have 100 or more multileader it is very tedious to delete the leaders of each one of them

 
 
 
 
 
 
Posted (edited)

Code is not really needed but this will get your selection at least

(defun c:foo (/ s)
  (if (setq s (ssget ":L" '((0 . "MULTILEADER"))))
    (sssetfirst nil s)
  )
  (princ)
)

Then in the properties palette:

image.png.f3b3aeb44535782c0e029d0461a931a0.png

Edited by ronjonp
Posted

Try this.

(vl-load-com)
(defun C:TxtMLeader (/ CDR10 CMD ENT LS_ENT)

 (defun CDR10 (EntData / list10)
  (foreach el EntData
   (if (= (car el) 10)
    (setq list10 (cons (cdr el) list10))
   )
  )
  list10
 ) ;;CDR10

 (while
  (setq ENT (car (entsel "\nSelect MLeader entity: ")))
  (if (and
     (= (cdr (assoc 0 (entget ENT))) "MULTILEADER")
     (not (vl-position ENT LS_ENT))
    )
   (progn
    (vla-highlight (vlax-ename->vla-object ENT) :vlax-true)
    (setq LS_ENT (cons ENT LS_ENT))
    (prompt (strcat "\n" (itoa (length LS_ENT)) " found"))
   )
  )
 )
 (prompt
  (if LS_ENT
   (progn
    (setq CMD (getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (vl-cmdf "_.UNDO" "_Mark")
    (mapcar
     (function
      (lambda (x / ls_pts)
       (setq ls_pts (CDR10 (entget x)))
       (vl-cmdf "_.EXPLODE" x)
       (mapcar
        (function
         (lambda (y / e)
          (if (and
             (setq e (ssget y))
             (not (vl-position (cdr (assoc 0 (entget (ssname e 0)))) (quote ("TEXT" "MTEXT" "INSERT"))))
            )
           (setq e (command "_.ERASE" e ""))
          )
         )
        )
        ls_pts
       )
      )
     )
     LS_ENT
    )
    (vl-cmdf "_.UNDO" "_End")
    (setvar "CMDECHO" CMD)
    (strcat "\n" (itoa (length LS_ENT)) " MultiLeader entities modified")
   )
   "\nNorthing selected."
  )
 )
 (princ)
)

 

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