Jump to content

hello, any one can help me make multiple leader match same angle


Recommended Posts

Posted

HELP, does any one have a method or lisp can make multiple leader arrange and match same angle ,because my job need to make a lot of multiple leader arrange ,anyone can suggest solve the problem ??

 

like from 1 to 2

1.JPG

2.JPG

Posted

Check the ALIGN option of the Multileader Command.

Posted

but i try multileader algin, how can i change from leader to mleader, i found a lisp can change to mleader , but once time only can change 1 leader to multileader , how can i change all leader to mleader faster

because my job need to align over 300 leader and align , this too waste my time

Posted

Give this a try:

(defun c:foo (/ _pts a d e el epts i mp n o p p2 s x y)
 ;; RJP 03.27.2018
 ;; Aligns 'old school' 3 pt leaders matching angle of leader and fixes offset distance of horizontal landings
 ;; ***The bottom most leader is the one matched***
 ;; Far from perfect, but better than doing it manually 
 (defun _pts (e) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget e))))
 (cond	((and (setq s (ssget ":L" '((0 . "leader"))))
      (setq s (vl-sort (mapcar '(lambda (x) (append (list x) (_pts x)))
			       (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
		       )
		       '(lambda (a b) (< (cadr (last a)) (cadr (last b))))
	      )
      )
      (setq d (/ (distance (last (car s)) (last (last s))) (length s)))
      (or (setq
	    i (getdist
		(strcat "\nEnter spacing for horizontal leader[<" (vl-princ-to-string d) ">]: ")
	      )
	  )
	  (setq i d)
      )
      (setq e (car s))
      (setq s (cdr s))
 )
 (setq a (angle (car (setq epts (cdr e))) (cadr epts)))
 (setq y (last epts))
 (setq n 1)
 (foreach l s
   (setq o (vlax-ename->vla-object (car l)))
   (setq p (cdr l))
   (cond ((setq	mp (inters (car p)
			   (polar (car p) a 1e-2)
			   (setq p2 (list (car y) (+ (* n i) (cadr y)) 0.0))
			   (polar p2 0.0 1e-2)
			   nil
		   )
	  )
	  (vlax-put o 'coordinates (apply 'append (list (car p) mp p2)))
	  (setq n (1+ n))
	 )
   )
 )
)
 )
 (princ)
)(vl-load-com)

2018-03-27_10-12-23.png

  • Like 1
Posted

this lisp i try, it can set the spacing same, but i don't know how to set angle, anyone can help me, PLEASE

Posted

my drawing is like to this drawing , many cbw need to show, how can i align angle and heignt all leader easily

3.JPG

  • Funny 1
Posted

when i use foo.lisp, it will be like to 4.jpeg

how can i know it is follow which leader is buttom??

4.jpg

new.dwg

Posted

Put your bottom label how you want it. Then select all above to match.

Posted

my drawing leader now can align, but leader have a block or text need to algin ,any method can make block align leader

:)

5.jpg

Posted
my drawing leader now can align, but leader have a block or text need to algin ,any method can make block align leader

:)

 

Post a sample drawing.

Posted
Gotta love the forum spammers....;)

 

:lol:

 

(_CreateNewThread "hello ,does any one have a method or lisp can make multiple leader arrange and match same angle")
(foreach x
 '("hello, does any one have a method or lisp can make multiple leader arrange and match same angle ,because my job need to make a lot of multiple leader arrange ,anyone can suggest solve the problem ??
   \nTHX"
   "Multiple need same angle same height,does anyone have a method?"
   "my drawing is like to this drawing , many cbw need to show, how can i align angle and heignt all leader easily"
   "bump"
   "bump"
   "bump"
 )
 (_PostReply x)
); foreach

Posted

my drawing is like to this one, i need a lisp or method to finish my job, please help me

7.dwg

  • 2 months later...
Posted

hello, any one can help me make multiple leader match same angle, because i have a lot of leader but leader angle not same , but my job need to arrange all leader make same angle, how can i do ??I only need same angle, no need same height

THX

擷取.JPG

Posted (edited)

in other post, i found this lisp, but i only need same angle, no need same height, but i don't know how to change this lisp, anyone can help me, pls

 

Code:

---------

(defun c:foo (/ _pts a d e el epts i mp n o p p2 s x y)
 ;; RJP 03.27.2018
 ;; Aligns 'old school' 3 pt leaders matching angle of leader and fixes offset distance of horizontal landings
 ;; ***The bottom most leader is the one matched***
 ;; Far from perfect, but better than doing it manually 
 (defun _pts (e) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget e))))
 (cond ((and (setq s (ssget ":L" '((0 . "leader"))))
             (setq s (vl-sort (mapcar '(lambda (x) (append (list x) (_pts x)))
                                      (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
                              )
                              '(lambda (a b) (< (cadr (last a)) (cadr (last b))))
                     )
             )
             (setq d (/ (distance (last (car s)) (last (last s))) (length s)))
             (or (setq
                   i (getdist
                       (strcat "\nEnter spacing for horizontal leader[<" (vl-princ-to-string d) ">]: ")
                     )
                 )
                 (setq i d)
             )
             (setq e (car s))
             (setq s (cdr s))
        )
        (setq a (angle (car (setq epts (cdr e))) (cadr epts)))
        (setq y (last epts))
        (setq n 1)
        (foreach l s
          (setq o (vlax-ename->vla-object (car l)))
          (setq p (cdr l))
          (cond ((setq mp (inters (car p)
                                  (polar (car p) a 1e-2)
                                  (setq p2 (list (car y) (+ (* n i) (cadr y)) 0.0))
                                  (polar p2 0.0 1e-2)
                                  nil
                          )
                 )
                 (vlax-put o 'coordinates (apply 'append (list (car p) mp p2)))
                 (setq n (1+ n))
                )
          )
        )
       )
 )
 (princ)
)

Edited by rkmcswain
Added [CODE] tags
Posted

Try this, but it's untested... And I don't think it will be applicable for example picture you provided...

Please post the code in code tags next time :

[noparse]

Your code here...

[/noparse]

 

 

(defun c:foo ( / mtchleader ss a i lea p1 p2 p3 mp )

 (vl-load-com)

 (while
   (or
     (not (setq mtchleader (car (entsel "\nPick matching leader - matching angle of this leader is reference angle for all other leaders..."))))
     (if mtchleader
       (/= (cdr (assoc 0 (entget mtchleader))) "LEADER")
     )
   )
   (prompt "\nMissed or picked wrong entity type...")
 )
 (while
   (or
     (prompt "\nSelect leaders to match...")
     (not (setq ss (ssget "_:L" '((0 . "LEADER")))))
   )
   (prompt "\nEmpty sel.set...")
 )
 (setq a (angle (cdr (assoc 10 (entget mtchleader))) (cdr (assoc 10 (cdr (member (assoc 10 (entget mtchleader)) (entget mtchleader)))))))
 (if (ssmemb mtchleader ss)
   (ssdel mtchleader ss)
 )
 (repeat (setq i (sslength ss))
   (setq lea (ssname ss (setq i (1- i))))
   (setq p1 (cdr (assoc 10 (entget lea))))
   (setq p2 (cdr (assoc 10 (cdr (member (assoc 10 (entget lea)) (entget lea))))))
   (setq p3 (cdr (assoc 10 (reverse (entget lea)))))
   (setq mp (inters p1 (polar p1 a 1e-2) p2 p3 nil))
   (vla-put-coordinates (vlax-ename->vla-object lea) (apply 'append (list p1 mp p3)))
 )
 (princ)
)

 

 

Regards, M.R.

HTH.

Posted
Try this, but it's untested... And I don't think it will be applicable for example picture you provided...

Please post the code in code tags next time :

[noparse]

Your code here...

[/noparse]

 

 

(defun c:foo ( / mtchleader ss a i lea p1 p2 p3 mp )

 (vl-load-com)

 (while
   (or
     (not (setq mtchleader (car (entsel "\nPick matching leader - matching angle of this leader is reference angle for all other leaders..."))))
     (if mtchleader
       (/= (cdr (assoc 0 (entget mtchleader))) "LEADER")
     )
   )
   (prompt "\nMissed or picked wrong entity type...")
 )
 (while
   (or
     (prompt "\nSelect leaders to match...")
     (not (setq ss (ssget "_:L" '((0 . "LEADER")))))
   )
   (prompt "\nEmpty sel.set...")
 )
 (setq a (angle (cdr (assoc 10 (entget mtchleader))) (cdr (assoc 10 (cdr (member (assoc 10 (entget mtchleader)) (entget mtchleader)))))))
 (if (ssmemb mtchleader ss)
   (ssdel mtchleader ss)
 )
 (repeat (setq i (sslength ss))
   (setq lea (ssname ss (setq i (1- i))))
   (setq p1 (cdr (assoc 10 (entget lea))))
   (setq p2 (cdr (assoc 10 (cdr (member (assoc 10 (entget lea)) (entget lea))))))
   (setq p3 (cdr (assoc 10 (reverse (entget lea)))))
   (setq mp (inters p1 (polar p1 a 1e-2) p2 p3 nil))
   (vla-put-coordinates (vlax-ename->vla-object lea) (apply 'append (list p1 mp p3)))
 )
 (princ)
)

 

 

Regards, M.R.

HTH.

 

this lisp doesn't work, anyone can help me, PLS

Posted
this lisp doesn't work, anyone can help me, PLS

Replace this

(vla-put-coordinates (vlax-ename->vla-object lea) (apply 'append (list p1 mp p3)))

with

(vlax-put (vlax-ename->vla-object lea) 'coordinates (apply 'append (list p1 mp p3)))

Posted (edited)

NOW THIS LISP IS WORK , BUT ONLY CAN MAKE ANGLE ,BUT LEADER SECOND LINE HAVE A PROBLEM , HOW CAN SOLVE?? pls

(defun c:foo ( / mtchleader ss a i lea p1 p2 p3 mp )

 (vl-load-com)

 (while
   (or
     (not (setq mtchleader (car (entsel "\nPick matching leader - matching angle of this leader is reference angle for all other leaders..."))))
     (if mtchleader
       (/= (cdr (assoc 0 (entget mtchleader))) "LEADER")
     )
   )
   (prompt "\nMissed or picked wrong entity type...")
 )
 (while
   (or
     (prompt "\nSelect leaders to match...")
     (not (setq ss (ssget "_:L" '((0 . "LEADER")))))
   )
   (prompt "\nEmpty sel.set...")
 )
 (setq a (angle (cdr (assoc 10 (entget mtchleader))) (cdr (assoc 10 (cdr (member (assoc 10 (entget mtchleader)) (entget mtchleader)))))))
 (if (ssmemb mtchleader ss)
   (ssdel mtchleader ss)
 )
 (repeat (setq i (sslength ss))
   (setq lea (ssname ss (setq i (1- i))))
   (setq p1 (cdr (assoc 10 (entget lea))))
   (setq p2 (cdr (assoc 10 (cdr (member (assoc 10 (entget lea)) (entget lea))))))
   (setq p3 (cdr (assoc 10 (reverse (entget lea)))))
   (setq mp (inters p1 (polar p1 a 1e-2) p2 p3 nil))
   (vlax-put (vlax-ename->vla-object lea) 'coordinates (apply 'append (list p1 mp p3)))
 )
 (princ)
)

2.jpg

Edited by rkmcswain
Added [CODE] tags

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