PIPE BREAK

Discussion in 'AutoCAD' started by SRAUSCH, Feb 11, 2004.

  1. SRAUSCH

    SRAUSCH Guest

    Does anyone have a pipe break lisp I could find and download.
    Thanks.
     
    SRAUSCH, Feb 11, 2004
    #1
  2. SRAUSCH

    C Witt Guest

    ;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)
    )
     
    C Witt, Feb 11, 2004
    #2
  3. SRAUSCH

    G. Willis Guest

    THANKS! I LIKE IT.

    GARTH.


     
    G. Willis, Feb 12, 2004
    #3
  4. SRAUSCH

    OLD-CADaver Guest

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (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)
    )
     
    OLD-CADaver, Feb 12, 2004
    #4
  5. SRAUSCH

    strongr1 Guest

    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
     
    strongr1, Feb 12, 2004
    #5
  6. SRAUSCH

    SRAUSCH Guest

    Thanks for all the help from everyone
     
    SRAUSCH, Feb 17, 2004
    #6
  7. SRAUSCH

    Tom C. Guest

    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)
     
    Tom C., Mar 1, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.