;;可有判断顺时针OR逆时针方法(FOR SPLINE,LWPOLYLINE,POLYLINE)
;;By LUCAS(龙龙仔)
;;线换向程序
;;FOR LWPOLYLINE ONLY
(defun C:TEST (/ ENT ENT1 Q Q1 Q3 Q4 N)
(setq ENT (entget (setq ENT1 (car (entsel)))))
(setq Q (reverse (member (assoc 39 (reverse ENT)) (reverse ENT))))
(setq Q1 (member (assoc 10 ENT) ENT))
(setq N 0
Q3 NIL
)
(repeat (/ (- (length Q1) 1) 4)
(setq Q3 (append Q3
(list (nth N Q1)
(cons 42 (* -1 (cdr (nth (+ N 3) Q1))))
(cons 41 (cdr (nth (+ N 1) Q1)))
(cons 40 (cdr (nth (+ N 2) Q1)))
)
)
)
(setq N (+ N 4))
)
(setq Q3 (reverse Q3))
(entmake (append Q
(member (assoc 10 Q3) Q3)
(list (nth 0 Q3))
(list (nth 1 Q3))
(list (nth 2 Q3))
(list (last Q1))
)
)
(entdel ENT1)
(princ)
) |