热度 8|||
;;画线打断于交点处 By Gu_xl 2012.12.11
(defun c:tt (/ LA P0 PT S PL A d)
(if (null *d*) (setq *d* 0))
(setq d (getdist (strcat "\n打断距离<" (rtos *d* 2 2) ">:")))
(if (null d)
(setq d *d*)
(setq *d* d)
)
(setq d (* 0.5 d))
(setq la (getvar 'clayer))
(setq p0 (getpoint "\n第一点:"))
(while (setq pt (getpoint p0 "\n下一点:"))
(setq s
(ssget "f"
(list p0 pt)
(list (cons 0 "*line,arc,circle,ellipse") (cons 8 la))
)
)
(if s
(progn
(setq pl
(vl-sort
(apply 'append (mapcar '(lambda (x) (mapcar 'cadr (cdddr x))) (ssnamex s)))
'(lambda (a b)
(< (distance a p0) (distance b p0))
)
)
)
(setq a p0)
(foreach b pl
(if (not (equal p0 b (* 0.1 d)))
(progn
(entmake
(list '(0 . "line")
(cons 10 a)
(cons 11 (polar b (angle pt p0) d))
)
)
(setq a (polar b (angle p0 pt) d))
)
)
)
(entmake
(list '(0 . "line")
(cons 10 a)
(cons 11 pt)
)
)
)
(entmake
(list '(0 . "line")
(cons 10 p0)
(cons 11 pt)
)
)
)
(setq p0 pt)
)
(princ)
)