수량산출 리습 중 소숫점 표기관련 문의드립니다.
컨텐츠 정보
- 773 조회
- 0 추천
- 0 비추천
-
목록
본문
수량구하는 리습중에 소숫점은 1째자리에서 반올림하되 표기는 소숫점 두째자리까지 표기하도록
하고 싶은데 어디를 고쳐야 할까요?
수량이 1.59 이면 1.60으로 표기되도록입니다. 1.54면 1.50이구요
제가 사용중인 리습은 아래와 같고 첨부도 하였습니다.
;면적을 m2단위로 산정
(DEFUN C:sa ( / a b c d e ss)
(setq ac nil ara 0 a1 nil)
(redraw)
(setvar "CMDECHO" 0)
(setvar "dimzin" 1)
(setvar "aperture" 5)
(command "osnap" "none")
(graphscr)
(setq pt (getpoint "nStrikes Point :"))
(while (/= pt nil)
(setq ss (bpoly pt))
(if(/= ss nil)
(progn
(setq aa (entlast))
(command "area" "e" aa)
(setq ara (+ (getvar "area") ara))
(princ "n Total Area = ")
(princ ara)
(princ "n")
(redraw aa 3)
(setq aa1 (list aa) a1 (append a1 aa1))
)
(princ "n Point is outside of Boundary")
)
(setq pt (getpoint "nStrikes Point :"))
)
(setq ln1 (length a1))
(if (> ln1 0)
(progn
(foreach nn a1
(progn
(entdel nn)
)
) ;endfor
)
)
(redraw)
(command "osnap" "none")
(prompt "nSelect text to edit?: ")
(setq a (ssget))
(setq b (sslength a))
(setq c 0)
(while (<= 1 b)
(setq d (ssname a c))
(if (eq (cdr (assoc 0 (entget d))) "TEXT")
(progn
(redraw d 3)
; (prompt "nNew text string <")
; (princ (cdr (assoc 1 (entget d))))
; (princ ">:")
(setq ara (/ ara 1.))
(setq e (rtos ara 2 2))
(if (= e "")
(setq e (cdr (assoc 1 (entget d))))
)
(entmod (subst (cons 1 e) (assoc 1 (entget d)) (entget d)))
(redraw d 4)
)
)
(setq b (- b 1))
(setq c (+ c 1))
)
(command "CHANGE" "P" "" "P" "C" "4″ "") ;시안
(command "osnap" "end,int,mid,cen")
(princ)
)