좋은 하루입니다. ^^
면적구하는 리습은 많이 있는데 첨부된 그림처럼 빵꾸뚤린 박스의 면적을 구하는 리습은 못 찾겠습니다. ㅜㅜ 큰박스를 먼저찍고 빼고 싶은 범위를 찍어 면적이 나왔으면합니다. 그리고 그 값을 임의의 점에 찍어 텍스트로 나타내고 싶내요.(단위는 M2, M2텍스트가 값끝에 나올수있게,소수둘째자리까지)
도와주세요!ㅜ
(defun c:AS (/ z ss sno no tno sum x entity etype num h pt ent_sum )
(setvar “cmdecho” 0)
(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”))
(progn
(command “area” “e” x)
(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)
)
)
)
(setvar “cmdecho” 1)
(setvar “blipmode” 0)
(prin1))
도와주셔서 감사합니다.^^