After I provided AutoLISP program to label coordinate automatically, I had some questions if it can show N, E, and elevation instead of just the coordinate text. So I made minor adjustment to the code.
This automatic labeling will create three lines of texts instead of just one line of xyz coordinate.
You can open notepad, copy and paste the code below, then save it as “lb.lsp” (type it with double quote when saving in notepad). If you want to show only Easting and Northing, you can delete the marked lines. Or replace East with E or X=, and so on.
You can read our tip on how to load AutoLISP program.
I hope this is useful.
; Automatic coordinate labeling
; Edwin Prakoso
; https://www.cad-notes.com
;
; Limitation
; ----------
; Will use current leader style and current units setting
; If you don't want to show elevation, then modify lines marked *
(defun c:lb (/ p x y z ptcoord textloc)
(while
(setq p (getpoint "
Pick Point: "))
(setq textloc (getpoint "
Pick Label Location: "))
(setq x (rtos (car p)))
(setq y (rtos (cadr p)))
(setq z (rtos (caddr p))) ;*you may delete this line
(setq x (strcat "East " x))
(setq y (strcat "North " y))
(setq z (strcat "Elev. " z)) ;*you may delete this line
(command "_LEADER" p textloc "" x y z "") ;*you may delete z
)
)
Want to create this program by your own? You can also adjust it to your needs. Try this AutoLISP exercise to create labeling coordinate program here.
thank you master, I little bit modify your routine to get Y value for manual cross section
but how to change the leader became point or node?. and make the text vertical. btw thank you sir
(defun c:lb (/ p x y ptcoord textloc)
(while
(setq p (getpoint “\nPick Point: “))
(setq textloc (getpoint “\nPick Label Location: “))
(setq y (rtos (cadr p)))
(setq ptcoord (strcat y))
(command “_LEADER” p textloc “” ptcoord “”)
)
)
which command will type in command list then XY coordinates will be showing in the darawing
hello im a beginner to lisp ,campus student.this is what i need.i need a lisp code (program) to get every coordinate of points in specific layer to a notepad.i know it can be done but my knowledge is at very basic .So pls send me a code with comments that explain complex codes. im requirement is to learn that kind of lisp program not only to use it.So if U can please help me with this . sir idont know how do give coordinates from cadd to excel please hlep me sir
Hi, i would like to ask if it is possible to remove the leader, i just wanted to make it just the mtext with coordinates. Thanks!
Amigo, muito obrigado, salvaste meu dia!!!! Feliz Natal!!!!
hello im a beginner to lisp ,campus student.this is what i need.i need a lisp code (program) to get every coordinate of points in specific layer to a notepad.i know it can be done but my knowledge is at very basic .So pls send me a code with comments that explain complex codes. im requirement is to learn that kind of lisp program not only to use it.So if U can please help me with this
Hi Edwin Prakoso,
How are you, this was a useful lisp, but I need a lisp which labels texts of offset and elevation of different points of a polyline and should ask the point to where text will be labeled. If you have such a lisp please provide.Thanks…
Can you describe what you want to achieve? A sample drawing perhaps? This LISP should do similar thing, only need minor adjustment.
hi why does this routine show nil after existing ??
(defun c:lpo (/ a p yvalue p1 )
(setq a 0.0)
(setq p (getpoint"n New Origin Point: "))
(setq yvalue (getreal"n New Yvalue: "))
(command "_.ucs" "o" p )
(setq p1 (list a (* -1 yvalue) a ))
(command "_.ucs" "o" p1 )
princ()
)
You should use (princ) not princ() at the last line.
Try to change it and reload the AutoLISP. It should fix it.
Yes I am saving and reloading after every change. I will send you the file, it would be great if you could figure out what the issue is.
Thank you
Hi,
I really like the three different lines feature of this code.
I am trying to have the coordinates appear in N,E,Z format instead of E,N,Z. I have tried rearranging the code but it seems to not work for me.
Also when I change the command to anything but 'lb' it loads fine but does not work once loaded in AutoCAD (even when I change it back to lb, it seems any changes to the command make it not work properly).
Any ideas here?
Have you tried to reload the LISP program? You need to save it and reload it after you make changes.
If you have, email me your code so I can take a look.
Sir, Can u teach me how to use lisp in uatocad 2017? TIA
This is my email: [email protected]