|
Description: |
Dependancies: |
|
This routine prompts user to draw a fence, and breaks all crossing line segments on the intersection. Copyright (C) 2000 Asbjørn Værnes. |
None. |
;;;Clean
up on error
;;;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(defun
ERROR_ROUTINE (/)
(setq olderror *error*)
)
(defun
*ERROR* (str_errmessage)
(princ str_errmessage)
(POSTRUN)
(setq
*error* olderror)
(princ)
)
;;;Prepare
;;;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(defun
PRERUN (/)
(setq oldcmdecho (getvar "cmdecho"))
(setvar
"cmdecho" 0)
(setq oldblipmode (getvar
"blipmode"))
(setvar "blipmode" 0)
(command
".undo" "be")
)
;;;Restore
;;;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(defun
POSTRUN (/)
(command ".undo" "e")
(setvar
"cmdecho" oldcmdecho)
(setvar "blipmode"
oldblipmode)
(if oldosmode
(setvar "osmode"
oldosmode)
)
)
;;;Main
function
;;;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(defun
MB (/ ent_BreakFence cnt pnt_1 pnt_2 pnt_3 pnt_4 pnt_5
ss
ent_LineToBreak
)
(setq pnt_1 (getpoint "\nFirst
point of break fence: "))
(if pnt_1
(progn
(setq pnt_2
(getpoint pnt_1 "\nSecond point of break fence: "))
(if
pnt_2
(progn
(setq oldosmode (getvar "osmode"))
(setvar
"osmode" 0)
(setq ss (ssget "_F" (list pnt_1
pnt_2) '((0 . "LINE"))))
(setq cnt 0)
(if (>
(sslength ss) 0)
(repeat (sslength ss)
(setq ent_LineToBreak
(entget (setq ent_BreakFence(ssname ss cnt)))
pnt_3 (cdr (assoc 10
ent_LineToBreak))
pnt_4 (cdr (assoc 11 ent_LineToBreak))
pnt_5
(inters pnt_1 pnt_2 pnt_3 pnt_4 T)
)
(if pnt_5
(command
"_.break" ent_BreakFence pnt_5 pnt_5)
)
(setq cnt (1+
cnt))
)
)
)
)
)
)
)
;;;Control
function
;;;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(defun
C:MB ()
(PRERUN)
(ERROR_ROUTINE)
(MB)
(POSTRUN)
)
(prompt "\nType MB to run..")