@Anonymous wrote:
wow, BREAK is pretty decent. But still tiresome if you imagine that you need to repeat the command and pick points over and over, every line, every file. There must be other way to do this quickly, automatic, like ... a LISP with BREAK function.
....
Here's one way to at least do one whole wall edge's worth all at once automatically, by selecting first the long [your blue] Line and then the shorter [your red] Lines over whose lengths you want to Break the long one [presumably with a window, or WP if not orthogonal].
The tricky part was overcoming the different possibilities about the direction the various Lines were drawn, and the draw order of the shorter ones [it would be much easier if you could count on the same relationship between all of them, and the short ones drawn in sequence, but I would assume you can't], and the question of whether the part of the longer one that still needs pieces Broken out of it is the original entity or the remainder entity from the previous Break.
Lightly tested, but it seems to work with different sequences in the draw order of the short ones, and different direction of the long one relative to the short ones. None of the usual bells and whistles yet.
(defun C:BOL ; = Break Overlapping Lines
(/ long longpieces shortss n short shortdata foundit m subject breakthis)
(setq
long (car (entsel "\nSelect long line to Break where overlapped: "))
longpieces (list long)
); setq
(redraw long 3); highlight
(prompt "\nFor overlapping lines over whose length to Break the long line,")
(setq shortss (ssget '((0 . "LINE"))))
(if (and long shortss)
(repeat (setq n (sslength shortss))
(setq
short (ssname shortss (setq n (1- n)))
shortdata (entget short)
shortstart (cdr (assoc 10 shortdata))
shortend (cdr (assoc 11 shortdata))
foundit nil ; reset for (while) loop
m 0 ; counter for stepping through longpieces
); setq
(while (and (< m (length longpieces)) (not foundit))
(setq subject (nth m longpieces))
(if
(not ; if (not) returns T, subject line is the one to Break
(equal ; closest points on subject to both ends of short line the same
; i.e. short line's length does not overlap subject line
(vlax-curve-getClosestPointTo subject shortstart)
(vlax-curve-getClosestPointTo subject shortend)
1e-4
); equal
); not
(setq ; then
breakthis subject
foundit T ; stop (while) loop
); setq
(setq m (1+ m)); else -- next short line
); if
); while
(command "_.break" breakthis "_none" shortstart "_none" shortend)
(setq longpieces (cons (entlast) longpieces)); add remainder to list
); repeat
); if
); defun
That could probably be expanded on to select more than one combination at once, if you can count on the short ones being within some definable tolerance of lying right on the long ones.
Kent Cooper, AIA