leo321 Posted May 17 Share Posted May 17 now N=7490570.926 E= 687539.212 change need N=7.490.570,926 E= 687.539,212 (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 3)) (setq STDY (rtos P1Y 2 3)) (setq COORDN (strcat "N=" STDY )) (setq COORDE (strcat "E= " STDX )) (setq PTXT (getpoint "\nPick text location: ")) (command "LEADER" PNT1 PTXT "" COORDN COORDE "") (princ) ) Quote Link to comment Share on other sites More sharing options...
Tsuky Posted May 17 Share Posted May 17 My way (defun convert_str2mil (str2cnv flag / l_str n l_nw) (setq l_str (if flag (reverse (vl-string->list str2cnv)) (vl-string->list str2cnv)) n 1) (while l_str (if (zerop (rem n 3)) (setq l_nw (cons 46 (cons (car l_str) l_nw))) (setq l_nw (cons (car l_str) l_nw)) ) (setq l_str (cdr l_str) n (1+ n)) ) (vl-list->string (if (not flag) (reverse l_nw) l_nw)) ) (defun C:LP ( / PNT1 P1X P1Y STDX STDY PTXT mantisse p_decimal) (setq PNT1 (getpoint "\nPick coordinate point: ")) (setq P1X (car pnt1)) ;x coord (setq P1Y (cadr pnt1)) ;y coord (setq STDX (strcat (convert_str2mil (rtos (setq mantisse (fix P1X)) 2 0) T) "," (substr (convert_str2mil (substr (rtos (setq p_decimal (- P1X (fix P1X))) 2) 3) nil) 1 3) ) ) (setq STDY (strcat (convert_str2mil (rtos (setq mantisse (fix P1Y)) 2 0) T) "," (substr (convert_str2mil (substr (rtos (setq p_decimal (- P1Y (fix P1Y))) 2) 3) nil) 1 3) ) ) (if (eq (substr STDX 1 1) ".") (setq STDX (substr STDX 2))) (if (eq (substr STDY 1 1) ".") (setq STDY (substr STDY 2))) (setq PTXT (getpoint "\nPick text location: ")) (command "_.LEADER" PNT1 PTXT "" (strcat "N=" STDY "\nE= " STDX "") "") (princ) ) 1 Quote Link to comment Share on other sites More sharing options...
leo321 Posted May 17 Author Share Posted May 17 thanks a lot, Tsuky Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.