Is there a Lisp routine out there that will break multiple lines at a crossing line? TIA Joe
Try this routine I wrote... I allows you to select two lines and then which one to break. It uses the current Font height to determine the width of the break.... I called it XL.lsp So you start off with some lines like: | | | __|___|___|___ | | | | | | __|___|___|___ | | | | | | The you can end up wth: | | | _ | __|__ | __ | | | | | | __|__ | __|___ | | | | | | ;; Prog to Break designated line equally on either ;; side of a specified intersection ; ERROR MESSAGE *********** (defun *error* (s) (if old_error (setq *error* old_error)) (command "osnap" "non") (princ) ) ; **** GET BREAK WIDTH **** (defun brk_wid ( / apt1 apt2 brklin brklin1 brklin2 brkwidth getit getname lin1 pt1 strtlin strtpt1 strtpt2 trmlin1 trmlin1x trmlin2 trmlin2x bkwid bkwid_2 brkwid_1) (cond ((/= brkwid nil) (setq bkwid_1 brkwid) (princ (strcat "\nCurrent Break Width is <"bkwid_1">")) (setq brkwid_2 (getstring "\nEnter Break Width or Return to Accept above: ")) (terpri) ; reset if space entered (IF (= brkwid_1 nil) (setq brkwid bkwid_2) (setq brkwid brkwid_1)) (IF (= brkwid_1 "") (setq brkwid bkwid_2) (setq brkwid brkwid_1)) ) ((= brkwid nil) (princ (strcat "\nSuggested Break Width is <"sug_bkwid">")) (setq brkwid (getstring "\nEnter Break Width: ")) (terpri) (IF (= brkwid nil) (exit)) ) ) brkwid ) ; brk_wid ; *** MAIN PROGRAM *** (defun C:XL () (setvar "CMDECHO" 1) (setq Inmm (getvar "USerI1")) ; find if Inches 1 or MM 0 (setq txthit (getvar "TextSize")) ; get height of selection ; (setq sug_brkwid (* txthit 1.5)) ; set up Default incriment 1.5 x Text Height (setq brkwid (* txthit 1.5)) ; set up Default incriment 1.5 x Text Height ; *** MAIN ROUTINE *** (command "osnap" "int") (princ "\n ") (setq pt1 (getpoint "\nSelect INTersection of lines: ")) (princ "\n ") (command "-osnap" "nea") (setq lin1 (getpoint "\nSelect LINE to Break: ")) (terpri) ; now work out the Entity Definition Data (setq getit (ssget lin1)) (setq getname (ssname getit 0)) (setq strtlin (entget getname)) (setq brkwidth brkwid) (setq strtpt1 (cdr (assoc 10 strtlin))) ; start point (setq strtpt2 (cdr (assoc 11 strtlin))) ; end point (setq apt1 (angle strtpt2 strtpt1)) ; start line angle 1 (setq apt2 (angle strtpt1 strtpt2)) ; start line angle 2 (setq trmlin1 (polar pt1 apt1 (/ brkwidth 2.0))) ; trim line 1 point (setq trmlin1x (polar pt1 apt1 brkwidth)) ; trim line 1x point (setq trmlin2 (polar pt1 apt2 (/ brkwidth 2.0))) ; trim line 2 point (setq trmlin2x (polar pt1 apt2 brkwidth)) ; trim line 2x point (setq brklin (cdr (assoc -1 strtlin))) ; get line name to break (command "break" brklin trmlin1 trmlin2) ; break line (command "-osnap" "non") ) ;defun Regards, BruceF
Joe a écrit : http://www.synapse-informatique.com/qbrick_en.htm This is a freeware, wrote by the author of a fabulous topographic software.
I guess I was rather too brief with my question. I do not want to delete any part of the original lines that are crossed by another, just have two entities on either side of each intersection point instead of one. Unless there is some aspect of Trim that I have missed, it is fairly slow to select the entity, hit F, then click twice in the same spot for a zero-width break for each entity. The "Ebrick" function of French program that 'gegematic' pointed me to seems to fit the bill. Although I cannot cannot select multiple entities to be broken with one crossing line which stays intact and must pick each one individually, it can be done serially with no limit, then all are broken with one Enter stroke.
Extrim is great but I don't want to lose any part of the entities being broken just have them become two instead of one at the intersecting points. "Ebrick" that gegematic mentions seems to work. Thank you for replying.
Thanks! That's a neat program, and I can certainly forsee some uses for it. What I was looking for now, though, was a zero-width break, and Acad won't accept a zero height text input, so it seems I can't achieve that. Since writing sophisticated Lisp programs is well beyond my current skill level, would you be interested in modifying the program for zero-width breaks (or for inputting the width) and allowing window or fence selection of multiple entities to be broken? If not, or in the meantime, the ARX program 'gegematic' pointed me at does work, with individual entity selection. Thanks again, Joe
Merci! What an interesting program. I love the indicator markers it leaves at the selected intersections. This most closely fits the bill for what I needed. Thanks, Joe
Here then... try this one. It's what I think you wanted (named BRK.lsp): ;; Breaks a Line at User picked point ; ERROR MESSAGE *********** ;(defun *error* (s) ; (if old_error (setq *error* old_error)) ; (princ) ; *** MAIN PROGRAM *** (Defun C:BRK ( ) (princ "\n ") (setq pt1 (getpoint "\nPick Point on Line to Break: ")) (command "break" pt1 pt1) ) ;defun
I don't know who made it but here's a crude little lisp I found that does exactly what you want (Only works for simple line entities): ------------------------------------------------- (Defun C:BRKPNT (/ ss cnt inf pnt1 pnt2 enam cnt einf pnt3 pnt4 intr) (Princ "\nSelect lines to break: ") (Setq ss (SSGet)) (Setq cnt 0) ;(Princ "\nSelect cut edge: ") (Setq inf (Entget (Car (Entsel "\nSelect line for breaking edge: ")))) (Setq pnt1 (Cdr (Assoc 10 inf))) (Setq pnt2 (Cdr (Assoc 11 inf))) (If ss (Repeat (SSLength ss) (Setq enam (SSName ss cnt)) (Setq cnt (1+ cnt)) (Setq einf (Entget enam)) (Setq pnt3 (Cdr (Assoc 10 einf))) (Setq pnt4 (Cdr (Assoc 11 einf))) (Setq intr (inters pnt1 pnt2 pnt3 pnt4)) (Command "_.BREAK" enam intr intr) ) ) (Princ)) -------------------------------------------------------
Thinking that I could use a routine like that in my work, I modified that other routine to accept multiple selections for the breaking edges. It's still very crude: won't report invalid entity selections, locked layer problems, multiple intersections of the same lines, etc, but has some utility. --------------------------------------------------------------------------------------------------------- ;|===============================================================|; ;| MBRK.lsp by Michael Bulatovich, 18th Mar., 2004 |; ;| |; ;| Breaks a number of lines at their intersections |; ;| with a number of other lines. Behavior is as if |; ;| EDGEMODE is set to 0. ("MultiBreak") |; ;| |; ;|===============================================================|; (Defun C:MBRK (/ ss bs cnt bcnt inf beinf pnt1 pnt2 enam bename einf pnt3 pnt4 intr oldemode ) (setvar "cmdecho" 0) (setq olderror *error* oldemode (getvar "edgemode") ) (defun *mbrk_error* (msg) (if (or (= msg "Function cancelled") (= msg "quit / exit abort") ) (princ "\nFunction cancelled by user.") (progn (princ "\nError: ") (princ msg) ) ) (setvar "edgemode" oldemode) (if olderror (setq *error* olderror olderror nil ) ) (princ) ) (if (not (eq *error* *mbrk_error*)) (setq *error* *mbrk_error*) ) (setvar "edgemode" 0) (Setq cnt 0) (Princ "\nSelect lines to break: ") (Setq ss (SSGet)) (Princ "\nSelect lines for breaking edges: ") (Setq bss (SSGet) bcnt 0 ) (if bss (Repeat (SSLength bss) (Setq cnt 0 benam (SSName bss bcnt) bcnt (1+ bcnt) beinf (Entget benam) pnt1 (Cdr (Assoc 10 beinf)) pnt2 (Cdr (Assoc 11 beinf)) ) (If ss (Repeat (SSLength ss) (Setq enam (SSName ss cnt) cnt (1+ cnt) einf (Entget enam) pnt3 (Cdr (Assoc 10 einf)) pnt4 (Cdr (Assoc 11 einf)) intr (inters pnt1 pnt2 pnt3 pnt4) ) (Command "_.BREAK" enam intr intr) ) ) ) ) (setvar "edgemode" oldemode) (setq *error* olderror olderror nil ) (Princ) )
I've already used it myself in some reno work! Someone should clean it up though. I'd like to see it report that items are on locked layers at least.