“[IAD]하루”님이 만들어 주신 리습이요.
이제보니까 폴리라인의 왼쪽 부분의 선에 수평으로
블럭의 각이 회전해서 돌아가는 거더군요.
제가 원한 것은 꺽인 부분의 중심각으로 블럭이 회전하게 하고 싶었거든요.
그래서 아래 리습이 “[IAD]하루”님께서 만들어 주신건데요.
여기서 뭐만 바꾸면 되나요?
저기 아래 180 이라는 숫자 있는 부분을 어떻게 바꾸면 될 것도 같고…
부탁드립니다. ^^
(defun c:asd(/ os ss k ed VtxList p1 p2 bn n ang)
;->*error* start
(defun *error* (msg)(princ “error: “)(princ msg)
(setvar “osmode” os)
(princ))
;-<*error* end
(setq os (getvar “osmode”))
(setq ss (ssget (list (cons 0 “lwpolyline”))))
(setq bn nil)
(while (= bn nil) (setq bn (cdr (assoc 2 (entget (car (entsel “n블럭을 선택해세요:”)))))))
(setq k 0)
(setvar “osmode” 0)
(command “undo” “be”)
(repeat (sslength ss)
(setq ed (entget (ssname ss k)))
(setq VtxList (GetPolyVtx ed))
(setq p1 (nth 0 VtxList))
(command “insert” bn p1 1 “” 0)
(setq n 0)
(repeat (1- (length VtxList))
(setq p1 (nth n VtxList)
p2 (nth (1+ n) VtxList))
(setq ang (rtd (angle p1 p2)))
(command “insert” bn p2 1 “” ang)
(setq n (1+ n))
)
(setq k (1+ k))
)
(command “undo” “e”)
(setvar “osmode” os)
(princ)
)
(defun rtd (a)(/ (* a 180.0) pi))
(defun GetPolyVtx(EntList)
(setq VtxList ‘())
(foreach x EntList
(if (= (car x) 10)
(setq VtxList (append VtxList (list (cdr x))))
)
)
VtxList
)