캐드좌표 200000,400000 지점을 찍었을때
x 좌표와 y 좌표를 구해서 x,y를 바꿔서
x=400000
y=200000
으로 써주는 리습입니다.
천단위 에서 , (콤마)가 찍혀서 나오게 하고 싶은데 수정가능할까요?
x=400,000
y=200,000
소숫점자리는 옵션걸수 있으면 좋겠습니다만… 출력안되게 하고 싶구요
—- 이하 본문
(defun c:YX()
(defun SETERR(s)
(if (/= s “Function cancelled”)
(princ (strcat “nError: ” s))
); of If
(setq *error* oer seterr nil)
(princ)
); of SETERR
(setq oer *error* *error* seterr)
(setq ts (* (getvar “DIMTXT”) (GETVAR “DIMSCALE”))) ;dimension text크기
(setq pt1 (getpoint “Pick First Point:”))
(setq pt2 (getpoint pt1 “Pick Second Point:”))
(setq px (car pt1))
(setq py (cadr pt1))
;****** real to string
(setq pxt (strcat “” (rtos py 2 (getvar “luprec”)))) ;y좌표를 x좌표값(측량) (strcat “X=”
(setq pyt (strcat “” (rtos px 2 (getvar “luprec”)))) ;x좌표를 y좌표값(측량) (strcat “Y=”
(command “dim1” “leader” pt1 pt2 “” pxt)
(setq txtpnt (cdr (assoc 10 (entget (entlast))))) ;text삽입점
(setq txtpnt1 (list (car txtpnt)
(- (cadr txtpnt) (* 2.0 ts)) 2.0)) ;y좌표 삽입점
(if (< (car pt2) (car pt1))
(setq algn “MR”)
(setq algn “ML”)
)
(command “TEXT” algn txtpnt1 ts “0.0” pyt) ;y좌표값 쓰기
(command “explode” txtpnt) ; x 값을 mtext—>text로
(setq *error* oer seterr nil)
(princ)
);;; End of program YX