Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

breaks selected line

475 views
Skip to first unread message

chadidjaja

unread,
Aug 19, 2004, 5:59:33 PM8/19/04
to
Good day!

I'm looking for a routine that will select a line, then that line will be broken at points where it intersect other lines.
Or better, to draw a line which will break when intersect with other lines.

Though I've found a few codes that can be modified, I'm not familiar with LISP. Any help will be much appreciated. Thanks!

Jeff Mishler

unread,
Aug 19, 2004, 6:18:15 PM8/19/04
to
Here's one that will allow you to select the line to break and the lines
with which to break it. To change the "gap", change the line (setq gap 1.5)
to whatever number you desire.
[code]
;| Original posted to autodesk.customization newsgroup by
SMMASON on 4/02/03....modified for specific task by
Jeff Mishler on 8/04/03
|;

(defun c:brkint (/ BRK-PT1 BRK-PT2 GAP GAP1A INT-LIN1
INT-LIN1A INT-LIN2A INT-PT1 INT-PT2
INT-PT3 INT-PT4 INT-PT5 NUMLIN OLD-AUNITS
OLD-LUNITS OLD-OSNAP OLD_ERROR ONSEG PICKTYPE PT1 PT2)
(SETVAR "CMDECHO" 0)
(setq old-osnap (getvar "osmode"))
(setq old-lunits (getvar "lunits"))
(setq old-aunits (getvar "aunits"))
(setvar "osmode" 0)
(setvar "lunits" 2)
(setvar "aunits" 0)
(setq old_error *error*)
(defun *error* (msg)
(if (not
(member
msg
'("console break" "Function cancelled" "quit / exit abort")
)
)
(progn
(setvar "osmode" old-osnap)
(setvar "lunits" old-lunits)
(setvar "aunits" old-aunits)
(redraw (car int-lin1) 4)
(SETVAR "CMDECHO" 1)
)
)
)

;;;(setq gap2 (if (= gap nil) 0.125 gap))
;;;(setq gap (getreal (strcat "\nEnter Break Gap Distance " "<" (rtos gap2)
">" ": ")))
;;;(if (= gap nil) (setq gap gap2))
(setq gap 1.5)
(setq gap1a (/ gap 2))

(setq int-lin1 (entsel "\nSelect the Line to use as the Cutting Line: "))
(redraw (car int-lin1) 3)
(setq int-lin1a (entget (car int-lin1)))
(setq int-pt1 (cdr (assoc 10 int-lin1a)))
(setq int-pt2 (cdr (assoc 11 int-lin1a)))

(initget 1 "F P")
(setq picktype (getkword "\nUse Fence or Pick Lines to Break? <F or P>: "))
(if (= picktype "F")
(progn
(setq pt1 (getpoint "\nLines to Break -> Pick First Fence Point: "))
(setq pt2 (getpoint pt1 "\nPick Second Fence Point: "))
(setq fence-cut (ssget "F" (list pt1 pt2) '((0 . "LINE")) ))
(setq numlin 0)
(while (<= numlin (- (sslength fence-cut) 1))
(setq int-lin2 (entget (ssname fence-cut numlin)))
(setq int-pt3 (cdr (assoc 10 int-lin2)))
(setq int-pt4 (cdr (assoc 11 int-lin2)))
(setq int-pt5 (inters int-pt1 int-pt2 int-pt3 int-pt4 onseg))
(setq brk-pt1 (polar int-pt5 (angle int-pt5 int-pt3) gap1a))
(setq brk-pt2 (polar int-pt5 (angle int-pt5 int-pt4) gap1a))
(command "break" (ssname fence-cut numlin) brk-pt1 brk-pt2)
(setq numlin (+ numlin 1))
);end while
);end progn
(progn
(while ;(= int-lin2 nil)
(setq int-lin2 (entsel "\nSelect Line to Break: "))
(setq int-lin2a (entget (car int-lin2)))
(setq int-pt3 (cdr (assoc 10 int-lin2a)))
(setq int-pt4 (cdr (assoc 11 int-lin2a)))
(setq int-pt5 (inters int-pt1 int-pt2 int-pt3 int-pt4 onseg))
(setq brk-pt1 (polar int-pt5 (angle int-pt5 int-pt3) gap1a))
(setq brk-pt2 (polar int-pt5 (angle int-pt5 int-pt4) gap1a))
(command "break" int-lin2 "f" brk-pt1 brk-pt2)
;(setq int-lin2 nil)
);end while
);end progn
);end if

(setvar "osmode" old-osnap)
(setvar "lunits" old-lunits)
(setvar "aunits" old-aunits)
(redraw (car int-lin1) 4)
(setq *error* old_error)
(SETVAR "CMDECHO" 1)
(princ)
)
[/code]


--
Jeff
check out www.cadvault.com
"chadidjaja" <nos...@address.withheld> wrote in message
news:27985252.109295280...@jiveforum1.autodesk.com...

chadidjaja

unread,
Aug 20, 2004, 11:52:09 AM8/20/04
to
Hi Jeff, thanks a lot!
With gap = 0.0, this is really close to what I need.

The routine allows me to select a cutting line, then the lines to be broken; while I'm needing one that allows me to select which line to be broken, then the selected line will be cut by all intersecting lines on the same layer.

0 new messages