+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 34

Thread: Duct elbow

  1. #1
    Super Member mdbdesign's Avatar
    Computer Details
    mdbdesign's Computer Details
    Operating System:
    XP PRO
    Computer:
    Homemade
    Motherboard:
    GIGABYTE G31M-ES2L
    CPU:
    INTEL CORE 2-QUAD-Q6600@2.4GHz
    RAM:
    4 GB
    Graphics:
    NVIDIA GeForce 9800 gt 1gb
    Primary Storage:
    WESTERN DIGITAL 500GB
    Monitor:
    2 - 21" COMPACQ
    Discipline
    Mechanical
    mdbdesign's Discipline Details
    Occupation
    Designing Engineer in Engineering Department
    Discipline
    Mechanical
    Details
    Pressure tanks Oil processing & storage equip. Steel mill equip. Telecom towers & equip. Wind turbine towers Power plant structures etc.
    Using
    AutoCAD 2012
    Join Date
    Jan 2007
    Location
    Courtice, Ontario, Canada
    Posts
    749

    Default Duct elbow

    Registered forum members do not see this ad.

    We got large project for aluminum duct system ranging Ø from 100 to 1000 mm involving lots of elbows My question is: is there somewhere lisp that can draw side view of elbow with only user input as: duct OD, # of segments and elbow degree.
    Please help

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,709

    Default

    Try this for starters:

    Code:
    (defun c:duct (/ *error* oVars vLst dPt dOd Segs dAng vEnt i PntEve PntOdd
                 cAngE sPtE ePtE cAngO sPtO ePtO last_pt1 last_pt2)
      (defun *error* (msg)
        (if oVars (mapcar 'setvar vLst oVars))
        (princ (strcat "\nError: " (strcase msg))) (princ))
      (setq vLst '("CMDECHO" "OSMODE")
        oVars (mapcar 'getvar vLst))
      (if (and (setq dPt (getpoint "\nSelect Point for Elbow: "))
           (not (initget 7)) (setq dOd (getdist "\nSpecify Duct OD: "))
           (not (initget 7)) (setq Segs (getint "\nSpecify No. of Segments: "))
           (setq dAng (getreal "\nSpecify Elbow Angle: ")) (< 0 dAng 360))
        (progn
          (mapcar 'setvar vlst '(0 0))
          (command "_arc" "_C" (polar dPt (/ pi 2) dOd) dPt "_A" (rtos dAng))
          (setq vEnt (vlax-ename->vla-object (entlast)) i 0.0 inc (/ (vla-get-ArcLength vEnt) Segs))
          (while (or  (setq PntEve (vlax-curve-GetPointatDist vEnt i)
                PntOdd (vlax-curve-GetPointatDist vEnt (setq i (+ inc i)))))
        (setq cAngE (+ (/ pi 2) (angle '(0 0 0) (vlax-curve-getFirstDeriv vEnt
                             (vlax-curve-GetParamAtPoint vEnt PntEve)))))
        (command "_line" (setq sPtE (polar PntEve cAngE 4.0)) (setq ePtE (polar PntEve (+ pi cAngE) 4.0)) "")
        (if (and last_pt1 last_pt2) (progn (command "_line" last_pt1 sPtE "") (command "_line" last_pt2 ePtE "")))
        (setq cAngO (+ (/ pi 2) (angle '(0 0 0) (vlax-curve-getFirstDeriv vEnt
                             (vlax-curve-GetParamAtPoint vEnt PntOdd)))))
        (command "_line" (setq sPtO (polar PntOdd cAngO 3.0)) (setq ePtO (polar PntOdd (+ pi cAngO) 3.0)) "")
        (command "_line" sPtE sPtO "") (command "_line" ePtE ePtO "")
        (setq last_pt1 sPtO last_pt2 ePtO)
        (setq i (+ inc i)))
          (vla-put-Color vEnt acblue))
        (princ "\n<!> Points Specified Incorrectly <!>"))
      (mapcar 'setvar vLst oVars)
      (princ))
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  3. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,709

    Default

    My apologies, this is better:

    Code:
    (defun c:duct  (/ *error* oVars    vLst dPt dOd Segs dAng vEnt i PntEve
               PntOdd cAngE sPtE ePtE cAngO sPtO ePtO last_pt1 last_pt2)
      (defun *error*  (msg)
        (if    oVars (mapcar 'setvar vLst oVars))
        (princ (strcat "\nError: " (strcase msg))) (princ))
      (setq    vLst  '("CMDECHO" "OSMODE")
        oVars (mapcar 'getvar vLst))
      (if (and (setq dPt (getpoint "\nSelect Point for Elbow: "))
           (not (initget 7)) (setq dOd (getdist "\nSpecify Duct OD: "))
           (not (initget 7)) (setq Segs (getint "\nSpecify No. of Segments: "))
           (setq dAng (getreal "\nSpecify Elbow Angle: ")) (< 0 dAng 360))
        (progn
          (mapcar 'setvar vlst '(0 0))
          (command "_arc" "_C" (polar dPt (/ pi 2) (* 1.5 dOd)) dPt "_A" (rtos dAng))
          (setq vEnt (vlax-ename->vla-object (entlast)) i 0.0 inc (/ (vla-get-ArcLength vEnt) Segs))
          (while (setq PntEve (vlax-curve-GetPointatDist vEnt i))
        (setq cAngE (+ (/ pi 2) (angle '(0 0 0) (vlax-curve-getFirstDeriv vEnt
                    (vlax-curve-GetParamAtPoint vEnt PntEve)))))
        (command "_line" (setq sPtE (polar PntEve cAngE (/ (+ dOd (* inc 2.0)) 2.0)))
             (setq ePtE (polar PntEve (+ pi cAngE) (/ (+ dOd (* inc 2.0)) 2.0))) "")
        (if (and last_pt1 last_pt2) (progn (command "_line" last_pt1 sPtE "") (command "_line" last_pt2 ePtE "")))
        (if (setq PntOdd (vlax-curve-GetPointatDist vEnt (setq i (+ inc i))))
          (progn
            (setq cAngO    (+ (/ pi 2) (angle '(0 0 0) (vlax-curve-getFirstDeriv vEnt
                                  (vlax-curve-GetParamAtPoint vEnt PntOdd)))))
            (command "_line" (setq sPtO (polar PntOdd cAngO (/ dOd 2.0)))
                 (setq ePtO (polar PntOdd (+ pi cAngO) (/ dOd 2.0))) "")
            (command "_line" sPtE sPtO "") (command "_line" ePtE ePtO "")
            (setq last_pt1 sPtO last_pt2 ePtO i (+ inc i)))))
          (vla-put-Color vEnt acblue))
        (princ "\n<!> Points Specified Incorrectly <!>"))
      (mapcar 'setvar vLst oVars)
      (princ))
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  4. #4
    Super Member mdbdesign's Avatar
    Computer Details
    mdbdesign's Computer Details
    Operating System:
    XP PRO
    Computer:
    Homemade
    Motherboard:
    GIGABYTE G31M-ES2L
    CPU:
    INTEL CORE 2-QUAD-Q6600@2.4GHz
    RAM:
    4 GB
    Graphics:
    NVIDIA GeForce 9800 gt 1gb
    Primary Storage:
    WESTERN DIGITAL 500GB
    Monitor:
    2 - 21" COMPACQ
    Discipline
    Mechanical
    mdbdesign's Discipline Details
    Occupation
    Designing Engineer in Engineering Department
    Discipline
    Mechanical
    Details
    Pressure tanks Oil processing & storage equip. Steel mill equip. Telecom towers & equip. Wind turbine towers Power plant structures etc.
    Using
    AutoCAD 2012
    Join Date
    Jan 2007
    Location
    Courtice, Ontario, Canada
    Posts
    749

    Default

    Lee, it got any restriction about Autocad version for this rutine?
    See dwg.
    Attached Files

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,709

    Default

    Not restrictions, I just thought you wanted ducting like this:
    Attached Images
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,709

    Default

    Ok, I've given you an "adjustment menu" at the top of the LISP, play around with it til your hearts content

    Code:
    (defun c:duct  (/ *error* oVars    vLst dPt dOd Segs dAng vEnt i PntEve PntOdd
              cAngE sPtE ePtE cAngO sPtO ePtO last_pt1 last_pt2 Cent str)
    
      ;; ==== Adjustments ====
    
      (setq Cent T) ; Duct Centreline
    
      (setq str T) ; Straight/Corrugated Duct (T = Straight, nil = Corrugated)
    
      ;; =====================
    
    
      (defun *error*  (msg)
        (if    oVars (mapcar 'setvar vLst oVars))
        (princ (strcat "\nError: " (strcase msg)))
        (princ))
      (setq    vLst  '("CMDECHO" "OSMODE")
        oVars (mapcar 'getvar vLst))
      (if (and (setq dPt (getpoint "\nSelect Point for Elbow: "))
           (not (initget 7))
           (setq dOd (getdist "\nSpecify Duct OD: "))
           (not (initget 7))
           (setq Segs (getint "\nSpecify No. of Segments: "))
           (setq dAng (getreal "\nSpecify Elbow Angle: "))
           (< 0 dAng 360))
        (progn
          (mapcar 'setvar vlst '(0 0))
          (or (and str (setq j 0.0)) (setq j 1.0))
          (command "_arc" "_C" (polar dPt (/ pi 2) (* 1.5 dOd)) dPt "_A" (rtos dAng))
          (setq vEnt (vlax-ename->vla-object (entlast))
            i     0.0
            inc     (/ (vla-get-ArcLength vEnt) Segs))
          (while (setq PntEve (vlax-curve-GetPointatDist vEnt i))
        (setq cAngE (+ (/ pi 2) (angle '(0 0 0) (vlax-curve-getFirstDeriv vEnt
                    (vlax-curve-GetParamAtPoint vEnt PntEve)))))
        (command "_line" (setq sPtE (polar PntEve cAngE (/ (+ dOd (* j inc 2.0)) 2.0)))
             (setq ePtE (polar PntEve (+ pi cAngE) (/ (+ dOd (* j inc 2.0)) 2.0))) "")
        (if (and last_pt1 last_pt2)
          (progn (command "_line" last_pt1 sPtE "") (command "_line" last_pt2 ePtE "")))
        (if (setq PntOdd (vlax-curve-GetPointatDist vEnt (setq i (+ inc i))))
          (progn
            (setq cAngO    (+ (/ pi 2) (angle '(0 0 0) (vlax-curve-getFirstDeriv vEnt
                                  (vlax-curve-GetParamAtPoint vEnt PntOdd)))))
            (command "_line" (setq sPtO (polar PntOdd cAngO (/ dOd 2.0)))
                 (setq ePtO (polar PntOdd (+ pi cAngO) (/ dOd 2.0))) "")
            (command "_line" sPtE sPtO "")
            (command "_line" ePtE ePtO "")
            (setq last_pt1 sPtO last_pt2 ePtO i (+ inc i)))))
          (if Cent (vla-put-Color vEnt acblue) (vla-delete vEnt)))
        (princ "\n<!> Points Specified Incorrectly <!>"))
      (mapcar 'setvar vLst oVars)
      (princ))
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  7. #7
    Super Member mdbdesign's Avatar
    Computer Details
    mdbdesign's Computer Details
    Operating System:
    XP PRO
    Computer:
    Homemade
    Motherboard:
    GIGABYTE G31M-ES2L
    CPU:
    INTEL CORE 2-QUAD-Q6600@2.4GHz
    RAM:
    4 GB
    Graphics:
    NVIDIA GeForce 9800 gt 1gb
    Primary Storage:
    WESTERN DIGITAL 500GB
    Monitor:
    2 - 21" COMPACQ
    Discipline
    Mechanical
    mdbdesign's Discipline Details
    Occupation
    Designing Engineer in Engineering Department
    Discipline
    Mechanical
    Details
    Pressure tanks Oil processing & storage equip. Steel mill equip. Telecom towers & equip. Wind turbine towers Power plant structures etc.
    Using
    AutoCAD 2012
    Join Date
    Jan 2007
    Location
    Courtice, Ontario, Canada
    Posts
    749

    Default

    Will try at home. Big thanks Lee

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,709

    Default

    Quote Originally Posted by mdbdesign View Post
    Will try at home. Big thanks Lee

    No probs, I had fun working on it
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  9. #9
    Super Member mdbdesign's Avatar
    Computer Details
    mdbdesign's Computer Details
    Operating System:
    XP PRO
    Computer:
    Homemade
    Motherboard:
    GIGABYTE G31M-ES2L
    CPU:
    INTEL CORE 2-QUAD-Q6600@2.4GHz
    RAM:
    4 GB
    Graphics:
    NVIDIA GeForce 9800 gt 1gb
    Primary Storage:
    WESTERN DIGITAL 500GB
    Monitor:
    2 - 21" COMPACQ
    Discipline
    Mechanical
    mdbdesign's Discipline Details
    Occupation
    Designing Engineer in Engineering Department
    Discipline
    Mechanical
    Details
    Pressure tanks Oil processing & storage equip. Steel mill equip. Telecom towers & equip. Wind turbine towers Power plant structures etc.
    Using
    AutoCAD 2012
    Join Date
    Jan 2007
    Location
    Courtice, Ontario, Canada
    Posts
    749

    Default

    Perfect.
    Lee, I will explain...
    on attached dwg
    Attached Files

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,709

    Default

    Registered forum members do not see this ad.

    Ok, will have a look when I get home
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

Similar Threads

  1. Request for Lisp to draw Duct Elbow
    By LSA in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 12th Aug 2010, 11:36 am
  2. Pipe - making an 90deg Elbow
    By Cunoblin in forum AutoCAD 3D Modelling & Rendering
    Replies: 20
    Last Post: 5th Mar 2009, 03:31 am
  3. Help with Isometric elbow.
    By Woodsball Dude in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 12th Jun 2008, 03:26 pm
  4. Another 3d elbow question
    By ClarkGriwold in forum AutoCAD 3D Modelling & Rendering
    Replies: 4
    Last Post: 2nd Aug 2006, 06:37 pm
  5. sphere=elbow pipe?
    By cadmuska in forum AutoCAD 3D Modelling & Rendering
    Replies: 4
    Last Post: 18th Jul 2006, 06:00 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts