How to make existed multileader vertical

How to make existed multileader vertical

Richard_Yankee
Enthusiast Enthusiast
483 Views
8 Replies
Message 1 of 9

How to make existed multileader vertical

Richard_Yankee
Enthusiast
Enthusiast

I have a lot multileader annotation and i was told to make all the leaders vertical. Is there anyway to make the come true easily, cause i have a lot of annotations. Thanks in advance😀

multileader vetical.png

0 Likes
Accepted solutions (1)
484 Views
8 Replies
Replies (8)
Message 2 of 9

pendean
Community Legend
Community Legend

@Richard_Yankee Nothing built-in "automatic" offers that ability except to use object snap tracking which takes some practice to perfect https://www.nobledesktop.com/learn/autocad/object-snap-tracking#:~:text=Object%20Snap%20Tracking%20c...

0 Likes
Message 3 of 9

ВeekeeCZ
Consultant
Consultant

Easy with LISP. 

http://www.lee-mac.com/runlisp.html

 

(defun c:Mleader90 ( / s i e d a b)

  (if (setq s (ssget "_:L" '((0 . "MULTILEADER"))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i)))
	    d (entget e)
	    a (cadr (assoc 110 d))
	    b (cadr (assoc 10 (member '(302 . "LEADER{") d))))
      (setpropertyvalue e "TextLocation/X"
	((if (> b a) - +) (getpropertyvalue e "TextLocation/X") (abs (- b a))))))
  (princ)
  )

 

0 Likes
Message 4 of 9

Richard_Yankee
Enthusiast
Enthusiast

Hi @ВeekeeCZ, Thanks for your kindly help, I really appreciate.

I tried the lisp, it seems only works for some of Mleaders not all of them. Could you please help to check what's going on coz  I'm not farmiliar with Lisp. Thank you so muchMleader90.gif

0 Likes
Message 5 of 9

ВeekeeCZ
Consultant
Consultant

Yeap, I can see that, thanks. That's all I can do with the picture.

0 Likes
Message 6 of 9

pendean
Community Legend
Community Legend

@ВeekeeCZ wrote:

Yeap, I can see that, thanks. That's all I can do with the picture.


I'll share one with you too.

0 Likes
Message 7 of 9

ВeekeeCZ
Consultant
Consultant
Accepted solution

Ok, a different approach does that trick.

 

(vl-load-com)

(defun c:Mleader90 ( / s i c o)
  (if (setq s (ssget "_:L" '((0 . "MULTILEADER"))))
    (repeat (setq i (sslength s))
      (and (setq o (vlax-ename->vla-object (ssname s (setq i (1- i)))))
	   (setq c (vlax-safearray->list (vlax-variant-value (vla-getleaderlinevertices o 0))))
	   (vla-SetLeaderLineVertices o 0 (vlax-safearray-fill (vlax-make-safearray vlax-vbDouble '(0 . 5)) (apply 'list (mapcar '(lambda (x) (nth x c)) '(0 1 2 0 4 5))))))))
  (princ)
  )

 

To make them flat, change the number series to 0 1 2 3 1 5.

Message 8 of 9

pendean
Community Legend
Community Legend

@ВeekeeCZ wrote:

Ok, a different approach does that trick.

 

(vl-load-com)

(defun c:Mleader90 ( / s i c o)
  (if (setq s (ssget "_:L" '((0 . "MULTILEADER"))))
    (repeat (setq i (sslength s))
      (and (setq o (vlax-ename->vla-object (ssname s (setq i (1- i)))))
	   (setq c (vlax-safearray->list (vlax-variant-value (vla-getleaderlinevertices o 0))))
	   (vla-SetLeaderLineVertices o 0 (vlax-safearray-fill (vlax-make-safearray vlax-vbDouble '(0 . 5)) (apply 'list (mapcar '(lambda (x) (nth x c)) '(0 1 2 0 4 5))))))))
  (princ)
  )

 

To make them flat, change the number series to 0 1 2 3 1 5.


Both newer versions work great in the sample I shared. Thanks.

 

0 Likes
Message 9 of 9

Richard_Yankee
Enthusiast
Enthusiast
Thanks so much
0 Likes