Jump to content

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


mikewong0719

Recommended Posts

one more question, any method can make leader height is follow leader end point and is a straight line , like to this photo

3.jpg

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by rkmcswain
Added [CODE] tags
Link to comment
Share on other sites

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

,

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

IT OK NOW , but i have one more question, any method can make leader last point is same , like to this photo

22.JPG

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

sorry , this lisp can't work, this lisp command is no action, do you know is what happen??

 

:ouch: 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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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