mikewong0719 Posted June 20, 2018 Author Posted June 20, 2018 one more question, any method can make leader height is follow leader end point and is a straight line , like to this photo Quote
hanhphuc Posted June 20, 2018 Posted June 20, 2018 hi read this about code tags before [NOPARSE] your code here [/NOPARSE] after your code here Marko also commented one more question, any method can make leader height is follow leader end point and is a straight line , like to this photo (defun c:test ( / s e p i a ) (if (setq s (ssget ":L" '((0 . "LEADER") (-4 . "&=") (76 . 3)))) (repeat (setq i (sslength s)) (setq e (ssname s (setq i (1- i))) p (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget e))) a (angle (car p) (cadr p)) ) (vlax-put (vlax-ename->vla-object e) 'coordinates (apply 'append (subst (polar (car p) a (abs (/ (cadr (mapcar '- (car p) (caddr p))) (sin a)))) (cadr p) p ) ) ) ) (princ "\nNothing?") ) (princ) ) Quote
mikewong0719 Posted June 20, 2018 Author Posted June 20, 2018 (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) ) Edited June 20, 2018 by rkmcswain Added [CODE] tags Quote
SLW210 Posted June 20, 2018 Posted June 20, 2018 Why didn't you go back to your original thread on this instead of creating a new thread? Please read the Code Posting Guidelines and have your Code to be included in Code Tags. <> = Your Code Here Quote
mikewong0719 Posted June 21, 2018 Author Posted June 21, 2018 slw210 said: why didn't you go back to your original thread on this instead of creating a new thread? your code here sorry, i don't know how to delete my old post , i only just want to discuss this lisp to solve my problem, in th future , i just only in this post to discuss , sorry , Quote
mikewong0719 Posted June 21, 2018 Author Posted June 21, 2018 PLEASE HELP ME , I REALLY NEED THIS LISP, because MY DRAWING 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 Quote
hanhphuc Posted June 21, 2018 Posted June 21, 2018 PLEASE HELP ME , I REALLY NEED THIS LISP, because MY DRAWING 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 hi, IMO it's time to learn coding possibly the solutions ? 1. match leader angle using (c:foo) - by Ronjonp or Marko 2. optional for same height, perhaps equal spacing method ? 3. To fix straight to end, (c:test) previous post#22 Quote
mikewong0719 Posted June 21, 2018 Author Posted June 21, 2018 I DON'T KNOW HOW TO REVERSE THE LISP, CAN U HELP ME??pls Quote
hanhphuc Posted June 21, 2018 Posted June 21, 2018 I DON'T KNOW HOW TO REVERSE THE LISP, CAN U HELP ME??pls i tested Ron's (c:foo) , it fixed the angle, ok Quote
mikewong0719 Posted June 21, 2018 Author Posted June 21, 2018 IT OK NOW , but i have one more question, any method can make leader last point is same , like to this photo Quote
ronjonp Posted June 21, 2018 Posted June 21, 2018 If you start using mleaders ( which I strongly suggest you do ) the mleaderalign command will do that easily. Quote
mikewong0719 Posted June 21, 2018 Author Posted June 21, 2018 I need to use qleader,not multiple leader, thx Quote
ronjonp Posted June 21, 2018 Posted June 21, 2018 I need to use qleader,not multiple leader, thx What does a qleader offer that an mleader does not? Quote
hanhphuc Posted June 21, 2018 Posted June 21, 2018 IT OK NOW , but i have one more question, any method can make leader last point is same , like to this photo 1.If the Mtext is associative to Leader's end, just move it or modify x-coordinates properties. 2.lisp: same method from my previous code, by subsituting middle point (cadr p) now just modify the end point (last p) (defun c:test ( / s e p i a ) (if [color="red"](and (setq x (getpoint "\nPick side to extend "))[/color] (setq s (ssget ":L" '((0 . "LEADER") (-4 . "&=") (76 . 3)))) [color="red"])[/color] ... ... ... (apply 'append [color="red"] (subst (cons (car x) (cdr (last p))) (last p) p )[/color] ) ... ... p/s: if you've learned then you can combine all 3 in 1 Quote
mikewong0719 Posted June 22, 2018 Author Posted June 22, 2018 sorry , this lisp can't work, this lisp command is no action, do you know is what happen?? Quote
hanhphuc Posted June 22, 2018 Posted June 22, 2018 sorry , this lisp can't work, this lisp command is no action, do you know is what happen?? Of course it won't work you just simply 'copy & paste' without reading or ignored our comments? (e.g: code tags etc..) hopefully this forum is able to guide you to the right direction in coding, are already few examples by Ronjonp, Marko etc.. you just need to modify previous code post#22 compare with post#35 red coded, trial & error. otherwise in future being hopeless if nobody helps you! good luck Quote
mikewong0719 Posted June 24, 2018 Author Posted June 24, 2018 Ok, now i can make the leader match angle , and the leader second line is straight to end , but need 3 steps step 1 : Leader match angle step 2 : Leader second line straight step 3 : Extend leader line to end point ANYONE KNOW CAN TO COMBINE 3 LISP IN 1 LISP, THX 1.lsp 2.lsp 3.lsp Quote
hanhphuc Posted June 25, 2018 Posted June 25, 2018 Ok, now i can make the leader match angle , and the leader second line is straight to end , but need 3 steps Yeah. It's a good good start! you just made your first step to code sorry, no fish. pseudo code, i.e: green dot & comments remove prefix c: (defun [color="red"]c:[/color]foo ( / [color="green"]...[/color] )[color="green"] ...[/color] ) -> (defun foo ([color="red"]ss[/color] / [color="green"]...[/color] ) [color="green"]...[/color] ) (defun [color="red"]c:[/color]test1 ( / [color="green"]...[/color] ) [color="green"]...[/color] ) -> (defun test1 ([color="red"]ss[/color] / [color="green"]... [/color]) [color="green"]...[/color] ) (defun [color="red"]c:[/color]test2 ( /[color="green"] ...[/color] ) [color="green"]... [/color]) -> (defun test2 ([color="red"]ss[/color] / [color="green"]...[/color] )[color="green"] ...[/color] ) foreach 3 function, remove (setq ss (ssget ...)) -> ss only The easiest way without hard coding, subs with argument which selection set is identical (defun c:mike ( / [color="red"]ss [/color][color="green"]variables[/color] ) (if (and (setq [color="red"]ss[/color] (ssget[color="green"] ...[/color])) [color="green"] ;<-- only select once[/color] (setq p (getpoint [color="green"]...[/color] )) ([color="blue"]progn[/color] (foo [color="red"]ss[/color]) (test1 [color="red"]ss[/color]) (test2 [color="red"]ss[/color]) ) [color="green"];progn[/color] ) [color="green"];if[/color] (princ) ) [color="green"];end[/color] have a look for these functions : if , and , progn in dev documentations good luck Quote
mikewong0719 Posted June 26, 2018 Author Posted June 26, 2018 i want 1 command to complete step 1 + step 2 , but i don't know how to reverse this lisp, anyone can help me, PLS Quote
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.