PDA

View Full Version : LISP for Converting Coordinates to text



Sarath Nair
26-05-2008, 10:58 AM
Please help me to write coordinate points as text in drawing which can edit, as we write dimensions or text

Eddie
26-05-2008, 10:31 PM
you could ID the point then copy and paste the X,Y,Z values to your text..
OR
Use a lisp or vba routine to do the same.

Sarath Nair
27-05-2008, 03:57 AM
I think you did not understood what i asked well, i want somebody tp help for lisp or VBA for converting id points to Text

Eddie
27-05-2008, 10:43 PM
Oh I understood you alright...

Here is a lisp that does something similar.

Labeling N,E Coordinates with Leader - David B. Stewart
(defun C:LP(/ PNT1 P1X P1Y STDY DY COORDN COORDE PTXT)
(setq PNT1 (getpoint
"\nPick coordinate point: "))
(setq P1X (car pnt1)) ;x coord
(setq P1Y (cadr pnt1)) ;y coord
(setq STDX (rtos P1X 2 2))
(setq STDY (rtos P1Y 2 2))
(setq COORDN (strcat "N " STDY ))
(setq COORDE (strcat "E " STDX ))
(setq PTXT (getpoint
"\nPick text location: "))
(command "LEADER" PNT1 PTXT "" COORDN COORDE "")
(princ)
)

architech
28-05-2008, 02:47 AM
Oh I understood you alright...

......

"And the aussie comes out swinging.... "
:thspitcoffee:

Sarath Nair
28-05-2008, 04:40 AM
Thanks a lot it works

huosam aldeen
04-08-2008, 05:27 PM
good evening my friend Eddie

Please tell me again ... in that lisp

how I can put it in autocad to worked...

then

Another question, if allowed

Is this line within a lisp

Labeling N,E Coordinates with Leader - David B. Stewart

thanx alot

Eddie
05-08-2008, 11:21 PM
Paste the following in a text file (use notepad)

(defun C:LP(/ PNT1 P1X P1Y STDY DY COORDN COORDE PTXT)
(setq PNT1 (getpoint
"\nPick coordinate point: "))
(setq P1X (car pnt1)) ;x coord
(setq P1Y (cadr pnt1)) ;y coord
(setq STDX (rtos P1X 2 2))
(setq STDY (rtos P1Y 2 2))
(setq COORDN (strcat "N " STDY ))
(setq COORDE (strcat "E " STDX ))
(setq PTXT (getpoint
"\nPick text location: "))
(command "LEADER" PNT1 PTXT "" COORDN COORDE "")
(princ)
)
Save the file and rename the TXT extension to LSP.
then you just need to load into acad by either drag and drop into a drawing or add it the startup suite.

CarLB
06-08-2008, 03:50 AM
As a quick way to try it out...

You can just copy the code Eddie posted, paste it into AutoCAD's command line. Then start the routine with "LP".