(defun c:tt(/ ss en n n1 k tot dis dis1 siz bas bas2 x1 y1 t1 text_out r th pnt msg k)
(prompt “nCommand: Line Plus…”)
; 글자크기 지정
;(setq siz (* 20 (getvar “dimscale”)))
(setq siz (getvar “TEXTSIZE”))
(setq siz (getreal (strcat “n글자크기를 지정해 주세요 <” (rtos siz) “>: “)))
(if (not siz) (setq siz (getvar “TEXTSIZE”)))
(prompt “n더하고자하는 line을 선택-> “)
(setq ss (ssget))
(setq n1 (sslength ss))
(setq n n1 k 0)
(setq tot 0 dis 0 dis1 0)
(setq text_all “”)
(setq bas (getpoint “전체데이터 화면표시 위치:”))
(setq os (getvar “osmode”))
(setvar “osmode” 0)
(while (<= 1 n)
(setq en (ssname ss k))
(setq stype (cdr (assoc 0 (entget en))))
(if (= stype “LINE”)(progn
(setq spt (cdr (assoc 10 (entget en))))
(setq ept (cdr (assoc 11 (entget en))))
(setq dis1 (distance spt ept))
(setq dis (/ dis1 1000.0))(prin1 dis)
; Text Screen
(setq t1 (itoa (+ 1 k)))
(setq text_out (strcat t1 “) “))
(setq t1 (rtos dis 2 0))
(setq text_out (strcat text_out t1))
(setq x1 (car bas) y1 (cadr bas))
(setq y1 (- y1 (* siz (* 2 (+ 1 k)))))
(setq bas2 (list x1 y1))
(command “text” “s” “standard” bas2 siz 0 text_out)
))(terpri)
(if (= stype “LWPOLYLINE”)(progn
(command “area” “e” en)
(setq dis1 (getvar “perimeter”))
(setq dis (/ dis1 1000.0))
; Text Screen
(setq t1 (itoa (+ 1 k)))
(setq text_out (strcat t1 “) “))
(setq t1 (rtos dis 2 0))
(setq text_out (strcat text_out t1))
(setq x1 (car bas) y1 (cadr bas))
(setq y1 (- y1 (* siz (* 2 (+ 1 k)))))
(setq bas2 (list x1 y1))
(command “text” “s” “standard” bas2 siz 0 text_out)
))
(setq tot (+ tot dis))
(setq n (- n 1))
(setq k (+ k 1))
)
(terpri)
(prompt “총”)(prin1 n1)(prompt “개의 라인…”)
(prompt “전체길이 : “)(prin1 tot)(prompt ” m”)
(prin1)
(setq text_out “Total Length: “)
(setq t1 (rtos tot 2 4)) ; 끝의숫자가 소숫점 자리수임 ( 0 ~ 4 가능 )
(setq text_out (strcat text_out t1))
(setq text_out (strcat text_out text_all))
; Text Screen
(setq x1 (car bas) y1 (cadr bas))
(setq y1 (- y1 (* siz (* 2 (+ 1 k)))))
(setq bas2 (list x1 y1))
(command “text” “s” “standard” bas2 siz 0 text_out)
(setvar “osmode” os)
(princ)
(setq r 10 ; 원의 반지름
th (getint “시작번호를 입력하세요 <1>:”) ; 넘버링 시작번호
)
(if (= th nil)(setq th 1))
(setq msg (strcat “넘버링 위치를 클릭하세요 <” (rtos th 2 0) “>:”))
(initget 128)
(while (setq pnt (getPoint msg)) ; 넘버링 위치
(setq a (entlast))
(if (= (type pnt) ‘LIST)
(progn
(command “circle” Pnt r) ; 원 그리기
(command “text” “j” “mc” pnt “6” “0” th) ; 텍스트 쓰기
(setq k (ssadd))
(while (setq a (entnext a))
(setq k (ssadd a k))
)
(command “Copybase” pnt k “”)
(command “Erase” k “”)
(command “Pasteblock” pnt)
(setq th (+ 1 th)) ; 1씩 + 하기
)
(if (= (strcase pnt) “B”)
(setq th (+ th 1))
(setq th (atoi pnt))
)
)
(initget 128)
(setq msg (strcat “넘버링 위치를 클릭하세요 <” (rtos th 2 0) “>:”))
)
(princ)
)
1.자동넘버링으로 바꿔야하는데 어떤걸 건드려야 할지
2.라인 자동 합계에서 spline 인식을 못하는데요 (pline , line, spline) 구분없이 인식할수 있는지???
3.합계는소수점이 나오는데 각라인별 소수점을 부탁드립니다.
완전초보라서