안녕하세요~ 홀차트 리습을 받았는데
좌표 소숫점이 0이면 소숫점 아래를 다 버려버리네요. 소숫점 2째 자리까지 무조건 나타나게 하고싶은데. 파이는 그대루 두고요
혹시 아시는 분 계신가요~
(defun dtr (a) (* a (/ pi 180)))
(defun c:hole (/ sca a n index th no noo sp lsp lep 1p 2p 3p 4p 5p 6p
org xorg yorg lp ep aa spt cp x y rr ss xsp ysp rsp)
(setq sca (getreal “n>>Input Scale. < 1 >: “))
(if (= sca nil)(setq sca 1))
(setvar “orthomode” 0)(setvar “cmdecho” 0)
(setq cur-osmode (getvar “osmode”))
(setvar “osmode” 37)
(setq org (getpoint “n>> 원점.: “))
(setvar “osmode” 0)
(princ “n>>원이나 Arc를 선택하시오.:”)
(setq a (ssget)
xorg (polar org 0 100) ;(getpoint org “n>>Positive X-axis direction.: “)
yorg (polar org (/ pi 2) 100) ;(getpoint org “n>>Positive Y-axis direction.: “)
n (sslength a)
index 0 no 1
th (getreal “n>>객체번호 글자의 크기. < 2 >: “)
th-pyo 2
noo (getstring “n>>첨자. < h >: “)
non (getint “n>>첨자의 시작번호. < 1 >: “)
p-p (getint “n>> 소수이하 자릿수. < 1 >: “)
sp (getpoint “n>>표 그리기 시작점.: “)
lsp (list (- (car sp) 7.5) (+ (cadr sp) 2.5))
sp_x (polar sp 0 20) sp_y (polar sp_x 0 25.5) sp_dia (polar sp_y 0 25.5)
1p (polar lsp 0 15) 2p (polar lsp 0 40) 3p (polar lsp 0 65) lep (polar lsp 0 90)
lp lsp ep lep xp “Y”
)
(if (= th nil)(setq th 2)) (if (= noo “”)(setq noo “h”))
(if (= non nil)(setq non 1))(if (= p-p nil)(setq p-p 1))
(if (or (= xp “”)(= (strcase xp) “Y”))
(progn
(command “color” “w”)
(command “text” “m” sp th-pyo 0 “No”)(command “text” “m” sp_x th-pyo 0 “X”)
(command “text” “m” sp_y th-pyo 0 “Y”) (command “text” “m” sp_dia th-pyo 0 “Dia.”)
(command “color” “bylayer”)
)
)
(repeat n
(setq aa (entget (ssname a index)))
(if (or (= (cdr (assoc 0 aa)) “ARC”) (= (cdr (assoc 0 aa)) “CIRCLE”))
(progn
(command “ucs” “3” org xorg yorg)
(setq cp (cdr (assoc 10 aa))
x (rtos (/ (car (trans cp 0 1)) sca) 2 p-p)
y (rtos (/ (cadr (trans cp 0 1)) sca) 2 p-p)
rr (cdr (assoc 40 aa)) rr (/ (* rr 2) sca)
)
(command “ucs” “P”)
(setq spt (polar (trans cp 0 1) (dtr 45) (+ (/ rr 2) 1.0))
lsp (polar lsp (dtr 270) 5)
lep (polar lep (dtr 270) 5)
rr (strcat “%%c” (rtos rr 2 p-p))
)
(setq ss (strcat noo (itoa non)))
(command “line” lsp lep “”)
(command “color” “w”)
; (command “text” spt th-pyo 0 ss)
(command “text” “m” cp th 0 ss) ; 객체의 중심에 번호 기록
(setq sp (polar sp (dtr 270) 5))
; (setq sp (polar sp pi 1))
(command “text” “m” sp th-pyo 0 ss)
(setq xsp (polar sp 0 27.2) ysp (polar sp 0 52.7) rsp (polar sp 0 74.5)); 좌표값 입력위치 설정
(command “text” “j” “mr” xsp th-pyo 0 x)
(command “text” “j” “mr” ysp th-pyo 0 y)
(command “text” “j” “mr” rsp th-pyo 0 rr)
(command “color” “bylayer”)
(setq non (+ non 1))
)
)
(setq index (+ index 1))
)
(setq lsp (polar lsp (dtr 270) 5) lep (polar lep (dtr 270) 5)
4p (polar lsp 0 15) 5p (polar lsp 0 40) 6p (polar lsp 0 65)
)
(command “line” lp lsp lep ep lp “”)(command “line” 1p 4p “”)
(command “line” 2p 5p “”)(command “line” 3p 6p “”)
(setvar “osmode” 37)(princ)
)
감사합니다 ~ 잘 되네요`~!