Draw Coordinates in mtext starting from lines

Draw Coordinates in mtext starting from lines

Anonymous
Not applicable
881 Views
2 Replies
Message 1 of 3

Draw Coordinates in mtext starting from lines

Anonymous
Not applicable

Hi,

I have lines in autocad and I am trying to make a function where the user can select all lines and the program finds the start vertices of these lines and draw the point coordinates.

Is it possible to get the Start X Y of these lines?
I tryed this XY_leader.lsp that draw the coordinate clicking on single points. I search something similar but automatic and with lines.

 

Thanks a lot for the help!

0 Likes
Accepted solutions (1)
882 Views
2 Replies
Replies (2)
Message 2 of 3

pbejse
Mentor
Mentor
Accepted solution

building off the XY_leader attachement

 

(Defun c:demo ( / XY_leader SS_Lines e sp ep)
  (defun XY_leader (p1 p2 /)
    (setvar "DYNMODE" 1)
    (vl-cmdf "_leader"
	     "_non"
	     p1
	     "_non"
	     p2
	     ""
	     (strcat "X = " (rtos (car p1) 2 2))
	     (strcat "Y = " (rtos (cadr p1) 2 2))
	     ""
    )
  )
  (if
    (setq SS_Lines (ssget '((0 . "*LINE"))))
     (repeat (Setq i (sslength SS_Lines))
       (setq e (ssname SS_Lines (setq i (1- i))))
       (setq sp	(Vlax-curve-getstartpoint e)
	     ep	(Vlax-curve-getEndpoint e)
       )
       (setq ang
	      (if
		(> (car sp) (Car ep))
		 (* 60 (/ pi 180))
		 (* 120 (/ pi 180))
	      )
       )
       (XY_leader sp (polar sp ang (* 5.0 (getvar 'Textsize))))
     )
  )
)

HTH

Message 3 of 3

Anonymous
Not applicable

Thank you very much! it was exactly what I was looking for!


0 Likes