Jump to content

update lisp coordenates X,Y (format)


leo321

Recommended Posts

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)
)

 

 

 

Link to comment
Share on other sites

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)
)

 

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...