Can anyone modify this lisp so that when it creates the leader, it will join all elements (arrow, lines, etc.) also if the text would come out as Mtext that would be great. Obviously I have very little lisp experience, and if I touch this I'm sure it will stop working thanks in advance leader.lsp: (DEFUN C:le () (setvar "cmdecho" 0) (setvar "attdia" 1) (setq L (getvar "clayer")) (setq O (getvar "osmode")) (setq R (getvar "orthomode")) (setq s (getvar "dimscale")) (setq number (fix s)) (setvar "orthomode" 0) (setvar "osmode" 0) (setvar "cecolor" "1") (setq LName (strcat "a-anno-note-" (itoa number))) (if (tblsearch "LAYER" LName) (command "layer" "s" LName "") (command "layer" "m" LName "c" "3" LName "") ) (setq pt1 (getpoint "Pick ARROW location...")) (terpri) (setq pt2 (getpoint pt1 "Pick END of LEADER line . . . \n")) (setq ang1 (angle pt1 pt2) ang3 (angle '(0.0 0.0) '(0.1 0.0)) ang4 (angle '(0.1 0.0) '(0.0 0.0)) ) (setq D(* 0.125 s) E(* 0.1875 s) F(* 0.0625 s) G(* 0.15625 s) H(+ PI ang1) pt3 (polar pt1 ang1 D) pt4 (polar pt2 ang3 E) pt5 (polar pt4 ang3 G) ) ;----- CALCULATE SIZE OF ARROWHEAD (setq dist1 (* 0.126688 (getvar "dimscale")) dist2 (/ dist1 3) ) (command ".solid" pt1 (strcat "@" (rtos dist1 2 3) "<" (rtos (+ ang1 0.1651) 2 3) "r") (strcat "@" (rtos dist2 2 3) "<" (rtos (- ang1 1.5708) 2 3) "r") "" "" ) (if (> (car PT1) (car PT2))(setq DR "MR")) (if (> (car PT2) (car PT1))(setq DR "ML")) (if (= DR "ML") (setq PT4 (list (+ (car PT2) G) (cadr PT2)))) (if (= DR "MR") (setq PT4 (list (- (car PT2) G) (cadr PT2)))) (if (= DR "ML") (setq PT5 (polar PT4 ang3 F))) (if (= DR "MR") (setq PT5 (polar PT4 ang4 F))) (command "line" PT3 PT2 PT4 "") (setvar "cecolor" "bylayer") (command "dtext" DR PT5 "0") (setvar "clayer" L) (setvar "osmode" O) (setvar "orthomode" R) (princ) ) ;;;END LEADER LISP
Hmm. It appears no hope for this one. The leader is being constructed with Lines (individual entities), and arrow is being applied as insert. (However), there is hope. Check out the web site (cadfx.com). They do great things with mechanical (I,m Electrical & Fluid Power).. They can help out. Bob Shaw
Ummmm....can't you just use the "leader" command which is located under the dimension pull down? "Catch" Ya Later, Tim
Why not use the core command LE? This set the size of the arrowhead to your cimscale and give you mtext option. Personally, I use a lsp routine which uses dtext.
You can also form the leader from a Pline, and use pline width mods to make the arrowhead, but I agree that native LE is better ddk
Don't mean to sound disparaging, but if you climb out of the old AutoLisp hole and breathe in some ActiveX VisualLisp (or VBA) you'll find you can add real leaders and set their vertices via the 'Coordinates property just like a polyline. Then throw in an MTEXT object to the 'Annotation property and you've got associative MTEXT. all elements (arrow, lines, etc.) also if the text would come out as Mtext that would be great. Obviously I have very little lisp experience, and if I touch this I'm sure it will stop working