Lisp for Leader

Lisp for Leader

infoH8EQN
Enthusiast Enthusiast
3,204 Views
7 Replies
Message 1 of 8

Lisp for Leader

infoH8EQN
Enthusiast
Enthusiast

Hi,

 

I need to place a lot of leaders on my drawing and my current workflow is a bit time-consuming. 

 

Is it possible to make a lisp that works like this? :

 

  • 1st snap: start of the dashed line.
  • 2nd snap: place arrow

Thanks

Cattura.PNG

 

 

 

0 Likes
Accepted solutions (2)
3,205 Views
7 Replies
Replies (7)
Message 2 of 8

ВeekeeCZ
Consultant
Consultant

What's your workflow now?

0 Likes
Message 3 of 8

infoH8EQN
Enthusiast
Enthusiast

I have this leader on my standard elements. Each time I need to snap it on an object and move the other vertex to the correct point. 

In two-click will be more efficient. 

 

 

0 Likes
Message 4 of 8

ВeekeeCZ
Consultant
Consultant

@infoH8EQN wrote:

I have this leader on my standard elements what is it, a tool palette?. Each time I need to snap it on an object and move the other vertex to the correct point. why would you do that, just draw a qleader.

In two-click will be more efficient. 

 


Sorry, not following. Doesn't make sense at all. Would you post some video capture?

0 Likes
Message 5 of 8

infoH8EQN
Enthusiast
Enthusiast

 

no, it is a collection of recursive elements (text, arrow, blocks, etc) I use on my drawing. Each time I copy them on drawings.

arrow2.PNG

When I need to pick the correct arrow (1), copy the element (2) and adjust it (3).  Will be more simple by clicking on point A and B. 

 

 

0 Likes
Message 6 of 8

ВeekeeCZ
Consultant
Consultant
Accepted solution

The first version requires just two points, but you need to have the correct dimstyle current. 

The second is as ADDSELECTED style, similar to your current workflow that you pick your pattern leader first.

 

(defun c:HLeader nil
  (command "_.leader" pause pause "_a" "" "_n")
  (command "_.chprop" "_l" "" "_lt" "HIDDEN" "")
  (princ)
  )


(defun c:Addleader (/ p)
  (if (ssget "I")
    (command "_.addselected" pause pause "_a" "" "_n")
    (command "_.addselected" pause pause pause "_a" "" "_n"))
  (while (setq p (getpoint "\nSpecify leader start point: "))
    (command "_.addselected" "_p" "_none" p pause "_a" "" "_n"))
  (princ)
  )

 

Message 7 of 8

infoH8EQN
Enthusiast
Enthusiast
Thanks very much. Work perfectly.
0 Likes
Message 8 of 8

hak_vz
Advisor
Advisor
Accepted solution

 

(defun c:mml (/ *error* p1 p2)
(defun *error* ( msg )
		(if (not (member msg '("Function cancelled" "quit / exit abort")))
			(princ)
		)
		(setvar 'cmdecho 1)
		(princ)
	)
	(setvar 'cmdecho 0)
	(while 
		(and
			(distance
				(setq p1 (getpoint "\nLeader arrow location point >"))
				(setq p2 (getpoint p1 "\nLeader  tail point>"))
			)
		)
		(entmakex
			(list
				(cons 0 "LEADER")	
				(cons 100 "AcDbEntity")
				(cons 100 "AcDbLeader")
				(cons 3 "ISO-25")
				(cons 67 0)
				(cons 71 1)
				(cons 72 0)
				(cons 73 3)
				(cons 75 0)
				(cons 10 p1)
				(cons 10 p2)
			)
		)
		(command "_.chprop" "_l" "" "_lt" "DASHEDX2" "")
	)
	(setvar 'cmdecho 1)
	(princ)
)

 

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.