전에 리습 고수분께서 작성해주신 리습입니다.
제가 측량 회사에 종사하다보니 현황도 그릴때 유용하게 쓰이는 리습인데요. 조금더 보충해서 사용하기위해 예제 화일과 함께 올립니다.
무리한 요구가 될수도 있는데요, 고수님들 수정 가능하다면 부탁 드리겠습니다. 일단 리습과 실행 도면(설명)을 올리겠습니다.
잘 부탁 드리겠습니다
(defun c:bd (/ old1 sp ep);;;담장그리기
(setq old1 nil)
(setq sp (getpoint “n 시작점 : “))
(if sp
(progn
(if (tblsearch “layer” “담장”)
(command “layer” “s” “담장” “color” 33 “담장” “”)
(command “layer” “m” “담장” “color” 33 “담장” “”)
)
(while (setq ep (getpoint sp “n 끝점 : “))
(setq old1 (addwallmain sp ep 0.2 “solid” old1))
(setq sp ep)
)
)
)
(princ)
)
(defun c:ob (/ old1 sp ep);;;옹벽그리기
(setq old1 nil)
(setq sp (getpoint “n 시작점 : “))
(if sp
(progn
(if (tblsearch “layer” “옹벽”)
(command “layer” “s” “옹벽” “color” 7 “옹벽” “”)
(command “layer” “m” “옹벽” “color” 7 “옹벽” “”)
)
(while (setq ep (getpoint sp “n 끝점 : “))
(setq old1 (addwallmain sp ep 0.3 “donut” old1))
(setq sp ep)
)
)
)
(princ)
)
(defun c:hs (/ old1 sp ep);;;휀스그리기
(setq old1 nil)
(setq sp (getpoint “n 시작점 : “))
(if sp
(progn
(if (tblsearch “layer” “휀스”)
(command “layer” “s” “휀스” “color” 6 “휀스” “”)
(command “layer” “m” “휀스” “color” 6 “휀스” “”)
)
(while (setq ep (getpoint sp “n 끝점 : “))
(setq old1 (addwallmain sp ep 0.0 “fance” old1))
(setq sp ep)
)
)
)
(princ)
)
(defun c:bd2 (/ old1 sp ep);;;보도그리기
(setq old1 nil)
(setq sp (getpoint “n 시작점 : “))
(if sp
(progn
(if (tblsearch “layer” “보도”)
(command “layer” “s” “보도” “color” 5 “보도” “”)
(command “layer” “m” “보도” “color” 5 “보도” “”)
)
(while (setq ep (getpoint sp “n 끝점 : “))
(setq old1 (addwallmain sp ep 1.7 “sidewalk” old1))
(setq sp ep)
)
)
)
(princ)
)
(defun c:hu (/ old1 sp ep sp2 ep2);;;석축그리기
(setq old1 nil)
(setq grlist nil)
(setq sp (getpoint “n 시작점 : “))
(if sp
(progn
(if (tblsearch “layer” “석축”)
(command “layer” “s” “석축” “color” 2 “석축” “”)
(command “layer” “m” “석축” “color” 2 “석축” “”)
)
(while (setq ep (getpoint sp “n 끝점 : “))
(grdraw sp ep 1 1)
(if old1
(setq sp2 (cdr (assoc 11 (entget old1))))
(setq sp2 (getpoint “n 시작점2 : “))
)
(if sp2
(progn
(setq ep2 (getpoint sp2 “n 끝점2 : “))
(if ep2
(progn
(grdraw sp2 ep2 1 1)
(setq old1 (addwallmain2 sp ep sp2 ep2 “stonewalk” old1))
(grdraw sp ep 0 0)
(grdraw sp2 ep2 0 0)
(setq sp ep)
)
)
)
)
)
)
)
(princ)
)
(defun addwallmain (sp ep width types old1 / l2 os dist ang sp2 ep2 typesnum space index tp1 tp2 tp3 tp4)
(cond;;;심볼사이의 거리
((= (strcase types) “SOLID”) (setq typelens 2.3))
((= (strcase types) “DONUT”) (setq typelens 2.0))
((= (strcase types) “FANCE”) (setq typelens 5.0))
((= (strcase types) “SIDEWALK”) (setq typelens 6.0))
)
(setq os (getvar “osmode”))
(setvar “osmode” 0)
(setq dist (distance sp ep))
(setq ang (angle sp ep))
(setq sp2 (polar sp (+ ang (dtr 90.0)) width))
(setq ep2 (polar ep (+ ang (dtr 90.0)) width))
(setq typesnum (fix (/ dist typelens)));;;심볼갯수 구하기
(command “line” sp ep “”)
(if (/= (strcase types) “FANCE”) (command “line” sp2 ep2 “”))
(setq l2 (entlast))
(setq index 0)
(cond
((= (strcase types) “SOLID”)
(setq space (/ (- dist (- (* typesnum typelens) 0.8)) 2.0));;;담장의 간격 0.8을 제외
(repeat typesnum
(setq tp1 (polar sp ang (+ space (* index typelens))))
(setq tp2 (polar tp1 (+ ang (dtr 90.0)) width))
(setq tp3 (polar sp ang (+ space (- (* (+ index 1) typelens) 0.8))))
(setq tp4 (polar tp3 (+ ang (dtr 90.0)) width))
(command “solid” tp1 tp2 tp3 tp4 “”)
(setq index (1+ index))
)
)
((= (strcase types) “DONUT”)
(setq space (/ (- dist (* (- typesnum 1) typelens)) 2.0));;;donut이므로 심볼 하나 추가
(repeat typesnum
(setq tp1 (polar sp ang (+ space (* index typelens))))
(setq tp2 (polar tp1 (+ ang (dtr 90.0)) (/ width 2.0)))
(command “donut” 0.0 width tp2 “”)
(setq index (1+ index))
)
)
((= (strcase types) “FANCE”)
(setq space (/ (- dist (* (- typesnum 1) typelens)) 2.0));;;마지막 심볼 하나 추가
(repeat typesnum
(setq tp2 (polar sp ang (+ space (* index typelens))))
(command “line” (polar tp2 (dtr 125.0) 0.5) (polar tp2 (dtr -45) 0.5) “”)
(command “line” (polar (polar tp2 (dtr 125.0) 0.1) (dtr 45.0) 0.5) (polar (polar tp2 (dtr 125.0) 0.1) (dtr 225.0) 0.5) “”)
(command “line” (polar (polar tp2 (dtr -45.0) 0.1) (dtr 45.0) 0.5) (polar (polar tp2 (dtr -45.0) 0.1) (dtr 225.0) 0.5) “”)
(setq index (1+ index))
)
)
((= (strcase types) “SIDEWALK”)
(setq space (/ (- dist (* (- typesnum 1) typelens)) 2.0));;;마지막 심볼 하나 추가
(repeat typesnum
(setq tp1 (polar sp ang (+ space (* index typelens))))
(setq tp2 (polar tp1 (+ ang (dtr 90.0)) (/ width 2.0)))
(command “insert” “bb” tp2 1.5 1.5 (rtd (angle sp ep)))
(setq index (1+ index))
)
)
)
(if old1
(if (/= (strcase types) “FANCE”) (command “fillet” old1 l2))
)
(setvar “osmode” os)
l2
)
(defun addwallmain2 (sp ep sp2 ep2 types old1 / os dist ang typesnum l2 index space count tp1 tp2)
(cond;;;심볼사이의 거리
((= (strcase types) “STONEWALK”) (setq typelens 10.0))
)
(setq os (getvar “osmode”))
(setvar “osmode” 0)
(setq dist (distance sp ep))
(setq ang (angle sp ep))
(setq typesnum (fix (/ dist typelens)));;;심볼갯수 구하기
(command “line” sp ep “”)
(command “line” sp2 ep2 “”)
(setq l2 (entlast))
(setq index 0)
(cond
((= (strcase types) “STONEWALK”)
(setq space (/ (- dist (- (* typesnum typelens) 5.0)) 2.0));;;마지막 심볼 하나 추가
(repeat typesnum
(setq count 0)
(repeat 11
(if (= (rem count 2) 0)
(setq tp2 (polar sp ang (+ space (* index typelens) (* count 0.5))))
(progn
(setq tp2 (polar sp ang (+ space (* index typelens) (* count 0.5))))
(setq tp2 (inters tp2 (polar tp2 (+ ang (dtr 90.0)) 1.0) sp2 ep2 nil))
)
)
(if tp1 (command “line” tp1 tp2 “”))
(setq tp1 tp2)
(setq count (1+ count))
)
(setq tp1 nil)
(setq index (1+ index))
)
)
)
(if old1
(if (/= (strcase types) “FANCE”) (command “fillet” old1 l2))
)
(setvar “osmode” os)
l2
)
(defun dtr (a) (* pi (/ a 180.0)))
(defun rtd (a) (/ (* a 180.0) pi))