Just wondering if anyone can help me with a routine that has the option to break vertical or break horizontal, depending on the option, the lines that cross either the horizontal or vertical (again, depending on the option) a specified distance (say .05) on either side of the line you wanted to keep. So if I choose BREAKH, the vertical lines that I choose would break any horizontal lines that cross them. Same applies to BREAKV. Hopefully I communicated clearly enough. Thanks in advance!
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
Thanks, Alanjt_! You guys are awesome! I tested an earlier version and it didn't work. But the one on the link worked like a charm! Thanks again, everyone!! LOL
A mediocre code:
(defun c:bmcut (/ _pts d cutter e pts pts2 p1 p2) (defun _pts (ent) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (member (car x) '(10 11))) ent))) (setq d (getdist "\nEnter Gap distance: ")) (princ "\nSelect Cutter lines:") (setq cutter (ssget (setq fl '((-4 . "<OR") (-4 . "<AND") (0 . "LWPOLYLINE") (90 . 2) (-4 . "AND>") (0 . "LINE") (-4 . "OR>") )) ) ) (repeat (setq i (sslength cutter)) (setq e (ssname cutter (setq i (1- i)))) (setq pts (_pts (entget e))) (if (and (setq cut-ee (ssget "_F" pts fl)) (ssdel e cut-ee) ) (repeat (setq n (sslength cut-ee)) (Setq en (ssname cut-ee (setq n (1- n)))) (setq pts2 (_pts (entget en))) (setq bpt (inters (Car pts) (cadr pts) (car pts2) (cadr pts2))) (setq p1 (polar bpt (angle (car pts2) (cadr pts2)) (* d 0.5))) (setq p2 (polar bpt (angle (cadr pts2) (car pts2)) (* d 0.5))) (command "_break" en "_non" p1 "_non" p2) ) ) ) )
Only works for LINES and 1 segment polyline though.
Pbejse - hi. Yes, this one trims horizontal lines around vertical ones. So it's got its usage for BREAKH command.
I then tried selecting only the horizontal lines and voila! - it now trims the vertical lines around the horizontal ones, thus meeting the BREAKV request. Awesome. Thank you very much, Pbejse!
@kameron1967 wrote:....Thank you very much, Pbejse!
You are welcome. Glad you found a use for the code kameron1967.
Cheers