Lisp select all multileaders and change text height

Lisp select all multileaders and change text height

larsr2866
Enthusiast Enthusiast
1,553 Views
4 Replies
Message 1 of 5

Lisp select all multileaders and change text height

larsr2866
Enthusiast
Enthusiast

Hello,

 

I am trying to add an extra command in my existing lisp entry. I already have created the command to change all existing text heigts to witch works great for text and mtext, but the multileader doesn't work. It would be great if someone could help me with this.

 

(if (and (setq ss (ssget "_W" '(49130 -49590) '(387222 166237)))
(setq sst (acet-ss-ssget-filter ss '((0 . "TEXT,MTEXT,MLEADER"))))
)
(command "_.SCALETEXT" sst "" "E"'"100"))

 

Thanks in advance.

 

0 Likes
Accepted solutions (1)
1,554 Views
4 Replies
Replies (4)
Message 2 of 5

diagodose2009
Collaborator
Collaborator

Can you upload a samples Drawing.dwg? You set color to red-color for  Before.dwg ;; and You set greencolor  inside After.dwg

0 Likes
Message 3 of 5

larsr2866
Enthusiast
Enthusiast

Thanks for youtr reaction

I have attached 2 dwg s (after en before)

 

Thanks

0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

For one thing, the entity type is "MULTILEADER" [not "MLEADER"].  And you may as well put the entity type filter right in the (ssget) function, rather than find everything in the window and then filter out the right kinds of things.  And you have an extraneous ' in the SCALETEXT command.  But that command doesn't accept Mleaders, so you need to do it differently.  It could apply SCALETEXT to Text and Mtext and something else to Mleaders, but since you're doing it around whatever the Existing insertion point is, it may as well use a way that can be applied to any of them.  Oddly, the entity data entry for height is different for Mleaders than it is for Text/Mtext.  Try this:

 

(defun C:TEST (/ ss tent tdata tml)
  (if (setq ss (ssget "_W" '(49130 -49590) '(387222 166237) '((0 . "TEXT,MTEXT,MULTILEADER"))))
    (repeat (setq n (sslength ss)); then
      (setq
        tent (ssname ss (setq n (1- n)))
        tdata (entget tent)
        tml (= (cdr (assoc 0 tdata)) "MULTILEADER"); text is in a MLeader [T or nil]
      ); setq
      (entmod
        (subst 
          (cons (if tml 41 40) 100);<-- EDIT [replace 100 with desired height]
          (assoc (if tml 41 40) tdata)
          tdata
        ); subst
      ); entmod
    ); repeat
  ); if
  (princ)
); defun

 

I used the 100 height in your original Message, not the 80 in your "after" drawing.

 

Kent Cooper, AIA
0 Likes
Message 5 of 5

larsr2866
Enthusiast
Enthusiast

Thanks! That works perfect! 

0 Likes