Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Contributor
SRAUSCH
Posts: 16
Registered: ‎01-15-2004
Message 1 of 16 (665 Views)

PIPE BREAK

665 Views, 15 Replies
02-11-2004 12:48 PM
Does anyone have a pipe break lisp I could find and download.
Thanks.
*C Witt
Message 2 of 16 (665 Views)

Re: PIPE BREAK

02-11-2004 02:55 PM in reply to: SRAUSCH
;DRAW PIPE BREAK (defun c:smileytongue:b () (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.
*G. Willis
Message 3 of 16 (665 Views)

Re: PIPE BREAK

02-11-2004 08:21 PM in reply to: SRAUSCH
THANKS! I LIKE IT. GARTH. "C Witt" wrote in message news:402ab2e2$1_2@newsprd01... > ;DRAW PIPE BREAK > > (defun c:smileytongue:b () > (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. >
Distinguished Contributor
old-cadaver
Posts: 5,183
Registered: ‎12-12-2003
Message 4 of 16 (665 Views)

Re: PIPE BREAK

02-11-2004 08:31 PM in reply to: SRAUSCH
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun osmget () (setq osget nil)(setq osget (getvar "osmode"))(setvar "osmode" 0))
(defun osmret () (setvar "osmode" osget))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:smileytongue:pl ()
(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)
)
Valued Contributor
alexshein
Posts: 55
Registered: ‎12-08-2003
Message 5 of 16 (665 Views)

Re: PIPE BREAK

02-12-2004 10:43 AM in reply to: SRAUSCH
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.
Active Member
strongr1
Posts: 9
Registered: ‎12-04-2003
Message 6 of 16 (665 Views)

Re: PIPE BREAK

02-12-2004 12:55 PM in reply to: SRAUSCH
here is another variation using spline
and it has an option to show the thickness

(defun c:smileytongue:b ()
(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
Contributor
SRAUSCH
Posts: 16
Registered: ‎01-15-2004
Message 7 of 16 (665 Views)

Re: PIPE BREAK

02-17-2004 07:05 AM in reply to: SRAUSCH
Thanks for all the help from everyone
*Tom C.
Message 8 of 16 (665 Views)

Re: PIPE BREAK

03-01-2004 02:50 PM in reply to: SRAUSCH
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)
Active Contributor
autocad4hbi
Posts: 34
Registered: ‎04-25-2007
Message 9 of 16 (665 Views)

Re: PIPE BREAK

04-25-2007 07:41 AM in reply to: SRAUSCH
How do I use these codes you guys are writing?
Distinguished Contributor
andrew_nao
Posts: 1,419
Registered: ‎06-03-2002
Message 10 of 16 (665 Views)

Re: PIPE BREAK

04-26-2007 05:59 AM in reply to: SRAUSCH
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?
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.