asami586 Posted January 20, 2018 Share Posted January 20, 2018 (edited) I get a lisp aligning leaders. But this lisp works for Only 3 point leaders. Could this lisp works for both 2 point leaders and 3 point leaders?? Please Help me. ;;; aligns the landings of selected 3 point leaders to a picked point or selection of leader ;;; and makes landing horizontal (if not already) ;;; [url]https://www.theswamp.org/[/url] (defun c:DD (/ c# crds doc e ins newpt obj ss txt x y sel) (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (initget 0 "Leader PickPoint") (if (= (cond ((getkword (strcat "\n Align by [Leader/PickPoint] <Leader>: ") ) ) ("Leader") ) "Leader" ) (and (setq e (car (entsel "\nSelect leader for alignment: "))) (setq x (cadr (assoc 10 (reverse (entget e))))) ) (setq x (car (getpoint "\nSelect point for alignment: "))) ) (if (and x (setq ss (ssget '((0 . "leader"))))) (progn (vla-endundomark doc) (vla-startundomark doc) (foreach l (vl-remove e (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) ) (setq obj (vlax-ename->vla-object l) crds (vlax-get obj 'coordinates) c# (length crds) ) (if (and (= c# 9) ;if leader has 3 points and /= x coord (not (equal x (nth (- c# 3) crds) 0.0001)) ) (progn (setq y (nth (- c# 5) crds) ;new y coord to ensure flat landing newpt (list x y (nth (1- c#) crds)) ) (vlax-put obj 'coordinates (append (reverse (cdddr (reverse crds))) newpt) ) (vla-update obj) (and (setq txt (vl-catch-all-apply ;has text attached to leader 'vlax-ename->vla-object (list (cdr (assoc 340 (entget l)))) ) ) (not (vl-catch-all-error-p txt)) ;check for invalid ename (setq ins (vlax-get txt 'insertionpoint)) (vlax-put txt 'insertionpoint (polar (list x (cadr ins) (caddr ins)) (if (> x (nth (- c# 3) crds)) 0. pi ) (if (zerop (getvar 'tilemode)) (vla-get-textgap obj) (* (getvar 'dimscale) (vla-get-textgap obj)) ) ) ) (vla-update txt) ) ) ) ) (vla-endundomark doc) ) ) (princ) ) Edited January 22, 2018 by SLW210 Added Code Tags Quote Link to comment Share on other sites More sharing options...
SLW210 Posted January 22, 2018 Share Posted January 22, 2018 Please read the Code Posting Guidelines Code needs to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here I have fixed it for you this time. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted January 22, 2018 Share Posted January 22, 2018 Are you aware of the MLEADERALIGN command? Quote Link to comment Share on other sites More sharing options...
mikewong0719 Posted March 27, 2018 Share Posted March 27, 2018 Hello, do you have any method can align leader as same angle , because my job need to align over 300 leader as same angle for drawing Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.