### Author Topic: Label Coordinate  (Read 339 times)

0 Members and 1 Guest are viewing this topic.

#### mohan

• Newt
• Posts: 41
##### Label Coordinate
« on: July 05, 2021, 04:41:56 AM »
Help to correction this route !
Code: [Select]
`; coord-ldr.lsp; x,y Coordinates on Leader Lines(defun C:CR (/ *error* PNT1 P1X P1Y STDY DY COORD PTXT)  (defun *error* ( msg )(if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred")))  (princ));end_defun    (setvar 'TEXTSTYLE RomanS)  (setvar 'TEXTSIZE 3.5)    (setq PNT1 (getpoint "\nPick coordinate point: "))    (setq P1X (car pnt1))  ;x coord    (setq P1Y (cadr pnt1)) ;y coord    (setq STDX (rtos P1X 2 3))    (setq STDY (rtos P1Y 2 3))    (setq COORD (strcat "Off- "  STDX)          COORD1(strcat "Elev- " STDY))    (setq PTXT (getpoint PNT1 "\nPick text location: "))(Progn   (command "_-style" "RomanS" "RomanS.shx" "0.000" "1" "0" "n" "n" "n") (command "LEADER" PNT1 PTXT "" COORD COORD1 "" "")) (princ))(ALERT "IT WILL PRINT THE X,Y CO-ORDINATES OF A POINT..., C:Cc")`
"Save Energy"

#### BIGAL

• Swamp Rat
• Posts: 830
• 30 + years of using Autocad
##### Re: Label Coordinate
« Reply #1 on: July 07, 2021, 12:38:25 AM »
Try this

Code: [Select]
`(defun C:CR (/ *error* PNT1 P1X P1Y STDY DY COORD PTXT) (defun *error* ( msg )(if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred")))  (princ));end_defun  (setq ts (tblsearch "Style" "Romans")) (if (= ts nil)(command "_-style" "RomanS" "RomanS.shx" "0.000" "1" "0" "n" "n" "n"))    (setvar 'TEXTSTYLE "RomanS")  (setvar 'TEXTSIZE 3.5)    (setq PNT1 (getpoint "\nPick coordinate point: "))    (setq P1X (car pnt1))  ;x coord    (setq P1Y (cadr pnt1)) ;y coord    (setq STDX (rtos P1X 2 3))    (setq STDY (rtos P1Y 2 3))    (setq COORD (strcat "Off- "  STDX)          COORD1(strcat "Elev- " STDY))    (setq PTXT (getpoint PNT1 "\nPick text location: "))   (command "LEADER" PNT1 PTXT "" COORD COORD1 "" "")  (princ) )(ALERT "IT WILL PRINT THE X,Y CO-ORDINATES OF A POINT..., C:Cc")`