AutoCAD 2004/2005/2006

Reply
Active Contributor
prenotes
Posts: 30
Registered: ‎09-22-2005
Message 1 of 16 (325 Views)

Need to break two crossing lines

325 Views, 15 Replies
10-14-2005 09:40 AM
Hi

Is there a Lisp routine to break two crossing lines, I have a large drawing with many crossing lines on them and I want to be able to click each line and have them break from each other.

A lisp routine would work for me.

thanks
*Allen Jessup
Message 2 of 16 (325 Views)

Re: Need to break two crossing lines

10-14-2005 11:48 AM in reply to: prenotes
Since I view all lines as part to the Design in never break them. To mask
the crossing I insert a block containing a Wipeout. The block can be
inserted or copied multiple times to the intersections created by the lines.

Allen

wrote in message news:4985126@discussion.autodesk.com...
Hi

Is there a Lisp routine to break two crossing lines, I have a large drawing
with many crossing lines on them and I want to be able to click each line
and have them break from each other.

A lisp routine would work for me.

thanks
Valued Contributor
Griftin
Posts: 62
Registered: ‎12-10-2003
Message 3 of 16 (325 Views)

Re: Need to break two crossing lines

10-14-2005 08:00 PM in reply to: prenotes
Allen

Thanks Allen I'll try that.

Still looking for that Lisp routine
Distinguished Contributor
cadee
Posts: 180
Registered: ‎08-10-2004
Message 4 of 16 (325 Views)

Re: Need to break two crossing lines

10-16-2005 11:58 PM in reply to: prenotes
I've added an icon on my toolbar for this script file:-

circle int \50 select last trim p \;erase p

you can change 50 to whatever size you and it prompts you for which line you like to break either vertical of horizontal. You must zoom in to pick either line within the circle.

Hope it helps
Active Contributor
prenotes
Posts: 30
Registered: ‎09-22-2005
Message 5 of 16 (325 Views)

Re: Need to break two crossing lines

10-17-2005 08:31 AM in reply to: prenotes
Jons

I can't get script to work. It says I need to draw circle.
?????????????
Active Contributor
prenotes
Posts: 30
Registered: ‎09-22-2005
Message 6 of 16 (325 Views)

Re: Need to break two crossing lines

10-17-2005 09:12 AM in reply to: prenotes
I can't get the script to work, It says I need to draw a circle.

Thanks
Distinguished Contributor
cadee
Posts: 180
Registered: ‎08-10-2004
Message 7 of 16 (325 Views)

Re: Need to break two crossing lines

10-18-2005 12:01 AM in reply to: prenotes
What the script does is draws a circle of a radius of 50 at the intersection of the two lines and then pauses for you to select the line you want to trim. It then trims the line within the circle and then deletes the circle and you are left with a gap. If you want to have a smaller gap eg. 1mm for an electrical schematic modify the value from 50 to 1 and so on, maybe have different menu icons for different size gaps.
Member
alex.banul
Posts: 4
Registered: ‎09-02-2004
Message 8 of 16 (325 Views)

Re: Need to break two crossing lines

10-18-2005 05:48 AM in reply to: prenotes
Try this. Set Break distance = 0. It'll break one line.

*******

;Tip1786: XBREAK.LSP BREAK LINES (C)2002, Scott Townsend

;;;====================================================================
;;;A utility for quiclky and evenly breaking Pipes/Duct/Lines
;;;that intersect
;;;
;;;Written By William "Scott" Townsend
;;;
;;;This routine will break a Line at even distances
;;;from an intersection by a given width
;;;assuming your using paper space viewports for plotting and
;;;model space for drawing. Determine the Break Distance as you would
;;;like it to appear in pspace (plotted) i.e 3/16". set the XPScale to
;;;The zoom xp of the viewport (i.e. 1/48 for 1/4"=1'-0") the routine
;;;divides the Break Distance by the XPscale to determine the model space
;;;Break Distance. (i.e (3/16")/(1/48) = 0.1875/0.0208333 = 9" model space
;;;Break Distance) the line is broken (Break Distance/2) on each side of the
;;;intersection. or you can set the XPscale to 1 and the Break Distance to 9
;;;if you wish. You only need to enter the settings one time. the routine
;;;will store these settings in a dictionary for future use.
;;;you also have the option of the break distance being applied
;;;Linear (Vertical or Horizontal regardless of line angle) or
;;;Aligned (distance mesured along angle of line).
;;;The current settings are shown at the prompt
;;;

(defun
C:XX (/ MYDICT XPSCALE METHOD OLDLUP OLDOS OLDUNITS BRKDIST BREAKONE
OLDERR R90 R270 BREAKTWO KEYWORD
)
(setvar "cmdecho" 0)
(setq
OLDUNITS
(getvar "lunits")
OLDLUP
(getvar "luprec")
KEYWORD ""
) ;_ end of setq
(setvar "lunits" 2)
(setvar "luprec" 8) ;(setq pi (* 4 (atan 1)))
(setq
R90
(* 90 (/ pi 180))
R270
(* 270 (/ pi 270))
OLDOS
(getvar "osmode")
OLDERR *ERROR*
) ;_ end of setq
(defun
*ERROR* (S)
(setvar "osmode" OLDOS)
(setvar "lunits" OLDUNITS)
(setvar "luprec" OLDLUP)
(princ (strcat "\nError: " S "\n"))
;;; Dictionary corruption WILL occur after repeatedly pressing space bar or enter
;;; While attempting to change settings using improper values. type fixdict
;;; To fix the dictionary
(prompt
"\nIf Program Aborts Immediatly After Typing XX\nThe Dictionary Settings May Be Corrupt. Type FIXDICT To Fix Dictionary"
) ;_ end of prompt
(setq *ERROR* OLDERR)
(textscr)
) ;_ end of defun
(setq MYDICT (dictsearch (namedobjdict) "Break_$etting$"))
(if (= MYDICT NIL)
(progn
(if (= 0 (getvar "psvpscale"))
(setq XPSCALE 1)
(setq XPSCALE (getvar "psvpscale"))
) ;if
(setq
BRKDIST 0.1875
METHOD "Aligned"
) ;setq
(MAKEDICTIONARY)
) ;progn
(SETAX) ;else
) ;if
(while (/= KEYWORD NIL)
(prompt
(strcat
"\nBreak Distance: "
(rtos BRKDIST)
", Method: "
METHOD
", XP Scale: "
(rtos XPSCALE)
) ;_ end of strcat
) ;_ end of prompt
(initget "Break Aligned Vertical Horizontal XPscale")
(setq
KEYWORD
(getkword
"\nXP scale/Aligned/Horizontal/Vertical/Break distance/ : "
) ;_ end of getkword
) ;_ end of setq
(if (/= KEYWORD NIL)
(progn
(cond
((= KEYWORD "XPscale")
(setq XPSCALE (getreal "\nEnter New XP Scale Factor: "))
(if (= 0 XPSCALE)
(setq XPSCALE "1")
) ;_ end of if
) ;cant divide by zero
((= KEYWORD "Break")
(setq BRKDIST (getreal "\nEnter New Break Distance: "))
)
((setq METHOD KEYWORD))
) ;cond
(dictremove (namedobjdict) "Break_$etting$")
(MAKEDICTIONARY)
) ;progn
) ;if
) ;while
(setvar "osmode" 512)
(setq LINETOBREAK (entget (car (entsel "\nSelect Line To Break: "))))
(setvar "osmode" 32)
(setq
BREAKPOINT
(getpoint "\nSelect Intersection: ")
LINEANGLE
(angle
(cdr (assoc 10 LINETOBREAK))
(cdr (assoc 11 LINETOBREAK))
) ;_ end of angle
) ;_ end of setq
(cond
((or (= LINEANGLE 0) (= LINEANGLE pi) (= "Horizontal" METHOD))
(HORIZMETHOD)
)
((or (= LINEANGLE R90) (= LINEANGLE R270) (= "Vertical" METHOD))
(VERTMETHOD)
)
((ALIGNMETHOD))
) ;_ end of cond
(BREAKIT)
(setq *ERROR* OLDERR)
(setvar "osmode" OLDOS)
(setvar "lunits" OLDUNITS)
(setvar "luprec" OLDLUP)
(princ)
) ;_ end of defun
;;;======Tangent=======

(defun TAN (ANG) (setq ANG (/ (sin ANG) (cos ANG))))

;;;======Cotangent=======

(defun COTAN (ANG) (setq ANG (/ (cos ANG) (sin ANG))))

;;;=====Get Dictionary Settings=====
(defun
SETAX (/ AX)
(setq
AX (assoc 350 MYDICT)
AX (entget (cdr AX))
XPSCALE
(atof (cdr (assoc 1 AX)))
BRKDIST
(atof (cdr (assoc 3 AX)))
METHOD
(cdr (assoc 2 AX))
) ;_ end of setq
) ;defun

;;;=====Make Dictionary To Store Settings======

(defun
MAKEDICTIONARY (/ DICTIONARY XNAME DATALIST)
(setq
DICTIONARY
(list '(0 . "DICTIONARY") '(100 . "AcDbDictionary"))
XNAME
(entmakex DICTIONARY)
MYDICT
(dictadd (namedobjdict) "Break_$etting$" XNAME)
DATALIST
(append
(list '(0 . "XRECORD") '(100 . "AcDbXrecord"))
(list
(cons 1 (rtos XPSCALE))
(cons 2 METHOD)
(cons 3 (rtos BRKDIST))
) ;_ end of list
) ;_ end of append
XNAME
(entmakex DATALIST)
) ;_ end of setq
(dictadd MYDICT "My_$etting$" XNAME)
(setq MYDICT (entget MYDICT))
) ;defun

;;;===============Break It==================

(defun
BREAKIT ()
(setvar "osmode" 0) ;break will sometimes occour '@' if not set to 0
(command "_Break" (cdr (car LINETOBREAK)) BREAKONE BREAKTWO)
) ;defun breakit

;;;==========Set Up Break Points For Horizontal Break============

(defun
HORIZMETHOD ()
(setq
BREAKONE
(list
(+ (car BREAKPOINT) (/ (/ BRKDIST XPSCALE) 2))
(+ (cadr BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (TAN LINEANGLE))
) ;_ end of +
0
) ;_ end of list
) ;_ end of setq
(setq
BREAKTWO
(list
(- (car BREAKPOINT) (/ (/ BRKDIST XPSCALE) 2))
(- (cadr BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (TAN LINEANGLE))
) ;_ end of -
0
) ;_ end of list
) ;_ end of setq
) ;defun horizmethod

;;;==========Set Up Break Points For Vertical Break============

(defun
VERTMETHOD ()
(setq
BREAKONE
(list
(+ (car BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (COTAN LINEANGLE))
) ;_ end of +
(+ (cadr BREAKPOINT) (/ (/ BRKDIST XPSCALE) 2))
0
) ;_ end of list
) ;_ end of setq
(setq
BREAKTWO
(list
(- (car BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (COTAN LINEANGLE))
) ;_ end of -
(- (cadr BREAKPOINT) (/ (/ BRKDIST XPSCALE) 2))
0
) ;_ end of list
) ;_ end of setq
) ;defun vertmethod

;;;==========Set Up Break Points For Aligned Break============

(defun
ALIGNMETHOD ()
(setq
BREAKONE
(list
(+ (car BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (cos LINEANGLE))
) ;_ end of +
(+ (cadr BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (sin LINEANGLE))
) ;_ end of +
0
) ;_ end of list
) ;_ end of setq
(setq
BREAKTWO
(list
(- (car BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (cos LINEANGLE))
) ;_ end of -
(- (cadr BREAKPOINT)
(* (/ (/ BRKDIST XPSCALE) 2) (sin LINEANGLE))
) ;_ end of -
0
) ;_ end of list
) ;_ end of setq
) ;defun alignmethod

(defun
C:FIXDICT (/ MYDICT XPSCALE BRKDIST METHOD)
(setq MYDICT (dictsearch (namedobjdict) "Break_$etting$"))
(if (/= MYDICT NIL)
(dictremove (namedobjdict) "Break_$etting$")
) ;_ end of if
(setq XPSCALE 1)
(setq BRKDIST 0.1875)
(setq METHOD "Aligned")
(MAKEDICTIONARY)
(princ "Fixed Dictionary. Change Settings To Suit")
(princ)
) ;_ end of defun

(prompt "\nType XX To Run Break Routine")
(princ)
Active Contributor
prenotes
Posts: 30
Registered: ‎09-22-2005
Message 9 of 16 (325 Views)

Re: Need to break two crossing lines

10-18-2005 09:13 AM in reply to: prenotes
Hi

I can get the routine to draw the circle but I can't get it to trim the lines nor erase the circle.

"Still Trying"
Active Contributor
prenotes
Posts: 30
Registered: ‎09-22-2005
Message 10 of 16 (325 Views)

Re: Need to break two crossing lines

10-18-2005 09:21 AM in reply to: prenotes
Alex

Is there a way to put this Lips routine in my support folder?
Where can I get it already typed?
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.