인터넷에서 면적 리습을 다운받아 사용하고 있는데 현재는 소수점 두자리까지밖에 나오지 않아 조금 불편해서요
소수점 셋째자리까지 구할 수 있도록 명령어를 변경하고 싶은데 아시는 분은 도움 주시면 감사하겠습니다..!
(vl-load-com)
(defun c:AS ( / sno ss no sum tno ent_sum x etype z pt h )
(setq sno 0)
(setq ss (ssget))
(setq sno (sslength ss))
(setq no 0)
(setq sum 0.0)
(setq tno 0)
;(command “area” “” “0,0” “”)
(defun c:AS ( / sno ss no sum tno ent_sum x etype z pt h )
(setq sno 0)
(setq ss (ssget))
(setq sno (sslength ss))
(setq no 0)
(setq sum 0.0)
(setq tno 0)
;(command “area” “” “0,0” “”)
(setq ent_sum 0)
(repeat sno
(setq x (ssname ss no))
(setq etype (cdr (assoc 0 (entget x))))
(if (or (= etype “POLYLINE”)(= etype “LWPOLYLINE”)(= etype “CIRCLE”)(= etype “SPLINE”)(= etype “ELLIPSE”))
(progn
;(command “area” “e” x)
(setq ent_sum (vlax-curve-getArea x))
(princ ent_sum)
;(setq ent_sum (getvar “area”))
)
(progn
(setq tno (1- tno))
(setq ent_sum 0)
)
)
(setq sum (+ sum ent_sum))
(setq tno (1+ tno))
(setq no (1+ no))
)
(setq x (ssname ss no))
(setq etype (cdr (assoc 0 (entget x))))
(if (or (= etype “POLYLINE”)(= etype “LWPOLYLINE”)(= etype “CIRCLE”)(= etype “SPLINE”)(= etype “ELLIPSE”))
(progn
;(command “area” “e” x)
(setq ent_sum (vlax-curve-getArea x))
(princ ent_sum)
;(setq ent_sum (getvar “area”))
)
(progn
(setq tno (1- tno))
(setq ent_sum 0)
)
)
(setq sum (+ sum ent_sum))
(setq tno (1+ tno))
(setq no (1+ no))
)
(setq tno (itoa tno))
(setq sum (/ sum 1000000))
(setq sum (rtos sum 2 2))
(princ “nAdding “)
(princ tno)
(princ ” nTexts: “)
(princ “nThe Result is: “)
(princ sum)
(princ ” “)
(princ “nDo You Want Write it into the DWG? <y> “)
(setq z (strcase (getstring)))
(if (or (= z “”) (= z “Y”))
(progn
(setq pt (getpoint “nText Point: “))
(setq h (getvar “textsize”))
(prompt “nText Height: “)
(princ H)
(princ ” : “)
(setq z (getdist))
(if z
(setq h z)
)
(command “text”
(setq z pt)
(setq z h)
(setq z 0.0)
(setq z sum)
)
)
)
(prin1)
)
(setq sum (/ sum 1000000))
(setq sum (rtos sum 2 2))
(princ “nAdding “)
(princ tno)
(princ ” nTexts: “)
(princ “nThe Result is: “)
(princ sum)
(princ ” “)
(princ “nDo You Want Write it into the DWG? <y> “)
(setq z (strcase (getstring)))
(if (or (= z “”) (= z “Y”))
(progn
(setq pt (getpoint “nText Point: “))
(setq h (getvar “textsize”))
(prompt “nText Height: “)
(princ H)
(princ ” : “)
(setq z (getdist))
(if z
(setq h z)
)
(command “text”
(setq z pt)
(setq z h)
(setq z 0.0)
(setq z sum)
)
)
)
(prin1)
)
감사합니다..!!^^
https://www.gocad.co.kr/1451419