Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PIPE BREAK

21 REPLIES 21
Reply
Message 1 of 22
Anonymous
5002 Views, 21 Replies

PIPE BREAK

Does anyone have a pipe break lisp I could find and download.
Thanks.
21 REPLIES 21
Message 2 of 22
Anonymous
in reply to: Anonymous

;DRAW PIPE BREAK (defun c:pb () (setq peacc (getvar "peditaccept")) (setvar "peditaccept" 0) (setq pt1 (getpoint "\nFirst Point: ")) (setq pt2 (getpoint pt1 "\nSecond Point: ")) (setq d1 (distance pt1 pt2)) (setq a1 (angle pt1 pt2)) (setq d2 (/ d1 9.0)) (setq pt3 (polar pt1 a1 (/ d1 4))) (setq pt4 (polar pt3 (+ a1 (/ pi 2)) d2)) (setq pt5 (polar pt1 a1 (/ d1 2))) (setq pt6 (polar pt5 a1 (/ d1 4))) (setq pt7 (polar pt6 (- a1 (/ pi 2)) d2)) (setq pt8 (polar pt6 (+ a1 (/ pi 2)) d2)) (command "arc" pt1 pt4 pt5) (setq e1 (entlast)) (command "arc" pt5 pt7 pt2) (setq e2 (entlast)) (command "arc" pt2 pt8 pt5) (setq e3 (entlast)) (command "pedit" e1 "y" "j" e2 e3 "" "") (setvar "peditaccept" peacc) (princ) ) SRAUSCH wrote: > Does anyone have a pipe break lisp I could find and download. > Thanks.
Message 3 of 22
Anonymous
in reply to: Anonymous

THANKS! I LIKE IT. GARTH. "C Witt" wrote in message news:402ab2e2$1_2@newsprd01... > ;DRAW PIPE BREAK > > (defun c:pb () > (setq peacc (getvar "peditaccept")) > (setvar "peditaccept" 0) > (setq pt1 (getpoint "\nFirst Point: ")) > (setq pt2 (getpoint pt1 "\nSecond Point: ")) > (setq d1 (distance pt1 pt2)) > (setq a1 (angle pt1 pt2)) > (setq d2 (/ d1 9.0)) > (setq pt3 (polar pt1 a1 (/ d1 4))) > (setq pt4 (polar pt3 (+ a1 (/ pi 2)) d2)) > (setq pt5 (polar pt1 a1 (/ d1 2))) > (setq pt6 (polar pt5 a1 (/ d1 4))) > (setq pt7 (polar pt6 (- a1 (/ pi 2)) d2)) > (setq pt8 (polar pt6 (+ a1 (/ pi 2)) d2)) > (command "arc" pt1 pt4 pt5) > (setq e1 (entlast)) > (command "arc" pt5 pt7 pt2) > (setq e2 (entlast)) > (command "arc" pt2 pt8 pt5) > (setq e3 (entlast)) > (command "pedit" e1 "y" "j" e2 e3 "" "") > (setvar "peditaccept" peacc) > (princ) > ) > > SRAUSCH wrote: > > > Does anyone have a pipe break lisp I could find and download. > > Thanks. >
Message 4 of 22
old-cadaver
in reply to: Anonymous

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun osmget () (setq osget nil)(setq osget (getvar "osmode"))(setvar "osmode" 0))
(defun osmret () (setvar "osmode" osget))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:ppl ()
(osmget)
(setvar "osmode" 1)
(setq pt1 (getpoint "\n Select One Side Of Pipe... "))
(setq pt2 (getpoint "\n Select Other Side Of Pipe... ")
dist (distance pt1 pt2)
ang (angle pt1 pt2)
pt3 (polar pt1 ang (/ dist 2.0))
)
(setvar "osmode" 0)
(setvar "plinewid" 0.0)
(command ".pline" pt1 "arc" "angle" "60" pt3 pt2 "angle" "-60" pt3 "")
(osmret)
)
Message 5 of 22
alexshein
in reply to: Anonymous

Sprausch,

Please see attached file INTTR. It breaks a line at intersection point making a gap between pipes equal to 1/8" in PS. If the there is no viewport above the intersection point, you'll be prompted for MS unit input the break distance.
Message 6 of 22
strongr1
in reply to: Anonymous

here is another variation using spline
and it has an option to show the thickness

(defun c:pb ()
(setq pt1 (getpoint "\nFirst Point: "))
(setq pt2 (getpoint pt1 "\nSecond Point: "))
(setq d5 (getdist "\nWhat is thichness of pipe wall:\n"))
(setq oldosmode (getvar "osmode"))
(setvar "osmode" 0) ; set snapmode to none
(setq d1 (distance pt1 pt2))
(setq a1 (angle pt1 pt2))
(setq d2 (/ d1 2.0))
(setq d3 (/ d1 4.0))
(setq d4 (sqrt (+ (* d3 d3) (* d3 d3))))
(setq pt3 (polar pt1 (+ a1 0.5) d4))
(setq pt4 (polar pt1 a1 d2))
(setq pt5 (polar pt4 (+ a1 0.5) d4))
(setq pt6 (polar pt4 (- a1 0.5) d4))
(command "spline" pt1 pt3 pt4 pt6 pt2 pt5 pt4 "" "" "")
(if d5
(progn
(setq d5 (abs d5))
(setq d6 (- d3 d5))
(setq d7 (sqrt (+ (* d6 d6) (* d6 d6))))
(setq pt7 (polar pt2 (- a1 pi) d5))
(setq pt8 (polar pt7 (- a1 2.7) d7))
(setq pt9 (polar pt7 (+ a1 2.7) d7))
(command "spline" pt4 pt8 pt7 pt9 pt4 "" "" "")
) ;_ end of progn
) ;_ end of if
(setvar "osmode" oldosmode)
(princ)
) ;_ end of defun
Message 7 of 22
Anonymous
in reply to: Anonymous

Thanks for all the help from everyone
Message 8 of 22
Anonymous
in reply to: Anonymous

Here's another: ;;; RCUT by DH ;;; Draws a cylindrical break mark ;;; ;;; Main program (defun c:RCUT (/ pt1 pt2 ent mid oldlay rcut_error olcmdecho oldlay olosmode) (defun rcut_error (msg) (if (or (= msg "Function cancelled") (/= msg "quit / exit abort")) (princ (strcat "Error: " msg)) ) (command ".undo" "e" "undo" "") (setvar "CMDECHO" olcmdecho) (setvar "OSMODE" olosmode) (setvar "CLAYER" oldlay) (setq *error* old_err old_err nil ) (princ) ) (setq old_err *error* *error* rcut_error ) (setq olosmode (getvar "OSMODE") olcmdecho (getvar "CMDECHO") oldlay (getvar "clayer") ) (setvar "cmdecho" 0) (command ".undo" "be") (prompt "\n RCUT - draws a cylindrical break mark") (initget 1) (setq pt1 (getpoint "\nPick right endpoint: ")) (initget 1) (setq pt2 (getpoint pt1 "\nPick left endpoint: ")) (setq ent (ssget pt1)) (if ent (setvar "clayer" (cdr (assoc 8 (entget (ssname ent 0))))) ) (setq mid (polar pt1 (angle pt1 pt2) (/ (distance pt1 pt2) 2.0))) (setvar "osmode" 0) (command ".arc" pt1 "e" mid "a" 90.0 ".arc" "" pt2 ".arc" mid "e" pt2 "a" 90.0) (command ".undo" "e") (setvar "CLAYER" oldlay) (setvar "OSMODE" olosmode) (setvar "CMDECHO" olcmdecho) (setq *error* old_err) (princ) ) (princ)
Message 9 of 22
autocad4hbi
in reply to: Anonymous

How do I use these codes you guys are writing?
Message 10 of 22
andrew_nao
in reply to: Anonymous

copy code into notepad.

save the file as whatever.lsp.

save it somewhere that you have mapped out in your acad search path.

once saved you load it like so:
(load "whatever")
it usually returns:
c:whatever
that means its load and needs to be called.
you call it by typing in "whatever" (without the quotes)
if the code does not have a defun in it, then it will automatically run as
soon as you load the lisp file.

hope this helps

wrote in message news:5563812@discussion.autodesk.com...
How do I use these codes you guys are writing?
Message 11 of 22
autocad4hbi
in reply to: Anonymous

Thanks for your response!

I followed your instructions, but when I call the program I get an "unknown command" error. The file is in the directory that is listed in both the "Support File Search Path" and the "Working Support File Search Path". When I load the file I receive the message filename "successfully loaded" so that appears to be working, but then I get the error when I type the filename.
Any ideas?
Message 12 of 22
andrew_nao
in reply to: Anonymous

it could be there is an error in the code
what is the code that you are trying to run? did you obtain it from here or
somewhere else?

wrote in message news:5565318@discussion.autodesk.com...
Thanks for your response!

I followed your instructions, but when I call the program I get an "unknown
command" error. The file is in the directory that is listed in both the
"Support File Search Path" and the "Working Support File Search Path". When
I load the file I receive the message filename "successfully loaded" so that
appears to be working, but then I get the error when I type the filename.
Any ideas?
Message 13 of 22
autocad4hbi
in reply to: Anonymous

I tried the first 2 in this discussion.
Message 14 of 22
andrew_nao
in reply to: Anonymous

what code are you trying to run that isnt working?


wrote in message news:5565407@discussion.autodesk.com...
I tried the first 2 in this discussion.
Message 15 of 22
autocad4hbi
in reply to: Anonymous

I tried the one from C. Witt on this discussion that begins -

;DRAW PIPE BREAK

(defun c:pb ()
(setq peacc (getvar "peditaccept"))
- etc. etc. etc.
Message 16 of 22

I've been looking for a way to do this as well.  I remember the old RCUT and after reading this I just made my first lsp file (Thanks to the instructions on how to make an lsp code).  It worked perfect.  I couldn't believe it was so easy!   

Message 17 of 22
william.klawitter4MJ74
in reply to: Anonymous
Message 18 of 22

Don't hold your breath for a reply 🙂

image.png

Message 19 of 22

An old thread, but if people are still finding it looking for that sort of thing....

 

>Another one<, with some additional options.  And there are surely others out there for the Searching.

Kent Cooper, AIA
Message 20 of 22
ronjonp
in reply to: Kent1Cooper

Here's another for fun 🙂

(defun c:pcont (/ e l mp p1 p2)
  ;; RJP » 2018-12-17
  ;; Draws a pipe continuation based off of 2 picked points
  (cond	((and (setq p1 (getpoint "\nSelect first point: "))
	      (setq p2 (getpoint p1 "\nSelect second point: "))
	 )
	 (setq p1 (trans p1 1 0))
	 (setq p2 (trans p2 1 0))
	 (setq mp (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.)))
	 (and (setq l (vl-some '(lambda (x) (nentselp x)) (list p1 p2)))
	      (setq l (cdr (assoc 8 (entget (car l)))))
	 )
	 (setq e (entmakex (list '(0 . "LWPOLYLINE")
				 '(100 . "AcDbEntity")
				 (cons 8
				       (if l
					 l
					 (getvar 'clayer)
				       )
				 )
				 '(100 . "AcDbPolyline")
				 '(90 . 4)
				 '(70 . 0)
				 (cons 10 p1)
				 '(42 . -0.5)
				 (cons 10 mp)
				 '(42 . 0.5)
				 (cons 10 p2)
				 '(42 . 0.5)
				 (cons 10 mp)
			   )
		 )
	 )
	 (while	(getpoint "\nPick a point to flip pipe end or enter to accept: ")
	   (entmod (mapcar '(lambda (x)
			      (cond ((and (= 42 (car x)) (/= 0 (cdr x))) (cons 42 (- (cdr x))))
				    (x)
			      )
			    )
			   (entget e)
		   )
	   )
	 )
	)
  )
  (princ)
)

2018-12-17_14-01-43.gif

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost