Author Topic: Duct elbow  (Read 2609 times)

0 Members and 1 Guest are viewing this topic.

mdbdesign

  • Newt
  • Posts: 52
Duct elbow
« on: March 26, 2009, 01:16:32 PM »
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
Marek

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Re: Duct elbow
« Reply #1 on: March 26, 2009, 01:42:07 PM »
There is probably an application around here that can that, trying searching for 'duct'. It might help if you provided a sample drawing and/or image of what your wanting to draw too.
TheSwamp.org  (serving the CAD community since 2003)

mdbdesign

  • Newt
  • Posts: 52
Re: Duct elbow
« Reply #2 on: March 26, 2009, 02:19:40 PM »
attached hope is this thing I plan to draw
Marek

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Duct elbow
« Reply #3 on: March 31, 2009, 03:04:07 PM »
round duct elbow have diffrent section vs degree and gauge.
so maybe the program must specify the degree and section ?

for my own...
I use standard elbow to reduce the cost price.
30 45 60 and 90 degree. from 3 to 5 sections.

If you need special degree there is a table showing you
the required section to make the elbow.

I hope that information will help.
Keep smile...

mdbdesign

  • Newt
  • Posts: 52
Re: Duct elbow
« Reply #4 on: March 31, 2009, 04:00:12 PM »
In job I do now nothing is standard, but I got solution :-) See attachment.
It is from my friend from far,far away. Try to use it. Even it draw notch on pipe.
It show outside dia., only need to add thickness of material.
BTW all job is cut already, roll and tack. Perfect, no question.
Let me know if it work for you
Marek

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Duct elbow
« Reply #5 on: April 02, 2009, 12:05:14 PM »
nice.. ;-)

Please check your command language compatibilitie
Code: [Select]
(command "._arc" "_C" center p1 "_A" (* -1 ang));modified by A.A.
......
(command "._pline")(mapcar 'command (list p1 p2 p3 p4))(command "");;modified by A.A.
......
(command "._pline")(mapcar 'command (list p4 p5 p6 p7))(command "");;modified by A.A.
....

Also,...I had to remove all Layer creation...i got bunch of error.

but generaly...the program work fine !  nice work !
Keep smile...

mdbdesign

  • Newt
  • Posts: 52
Re: Duct elbow
« Reply #6 on: April 02, 2009, 12:17:08 PM »
Can you post your updated version... Just curiosity.
Marek

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Duct elbow
« Reply #7 on: April 02, 2009, 01:36:49 PM »
here..

Code: [Select]
;; for Marek
;; du.lsp

(vl-load-com)

;;===================================  local defuns  =================================;;

;; make layer if this does not exist
;; by fixo
(defun _make_layer  (lname
     col
     ltype
     lweight
     plotmode
     plotstyle
     desc
     /
     layer_obj
     pstyle)

  (if (not (tblsearch "LAYER" lname))
    (progn
      (entmake
(list '(0 . "LAYER")
      '(100 . "AcDbSymbolTableRecord")
      '(100 . "AcDbLayerTableRecord")
      (cons 2 lname)
      '(70 . 0)
      (cons 62 col)
      (cons 6 ltype)
      (cons 290 plotmode)
      (cons 370 lweight)))

      ;; Create layer description and set plot style
      (setq layer_obj (vla-item
(vla-get-layers
  (vla-get-activedocument (vlax-get-acad-object)))
lname)
    )
      (if (not (eq "" desc))
(if (>= (atof (getvar "acadver")) 16.1)
  (progn

    (vla-put-description layer_obj desc)
    )
  )
)
      (vl-catch-all-apply
(function (lambda ()
    (if (= (getvar "pstylemode") 0)
      (vla-put-plotstylename layer_obj pstyle)
      )))
)
      (vlax-release-object layer_obj)
      )

    )
  )

(defun between (p1 p2 pc)
  (equal (+ (distance pc p1) (distance pc p2))
(distance p1 p2)
1e-6
)
  )

(defun dtr  (a)
  (* (/ a 180.0) pi)
  )
;;local defun

(defun strtolist  (strExp strDel / strLst)
  (while (setq pos (vl-string-position (ascii strDel) strExp))
    (setq itm (substr strExp 1 pos)
  )
    (setq strLst (append strLst (list itm))
  )
    (setq strExp (substr strExp (+ pos 2))
  )
    )
  (setq strLst (append strLst (list strExp))
)
  )
;;==============================================================================;;

(defun C:DU  (/ *error* *debug* ang cc center cl delta
        dia dist dist2 dupl halfa ln1 ln2 ln3
        midp mirr mirr1 mirr2 num osm p1 p2 p3
        p4 p5 p6 p7 pc pe pi1 pi2 pl po1 po2 po3
      po4 po5 po6 ps rad rad1 rad2 starta strd
      )
 
  (defun *error*  (msg)
    (cond ((not msg))
  ((member msg '("Function cancelled" "quit / exit abort")))
  ((princ (strcat "\nError: \n >>> " msg))
   (cond (*debug* (vl-bt)))
   )
  )
    (if osm
      (setvar "osmode" osm))
    (if cc
      (setvar "clayer" cc))
    (if cl
      (setvar "cecolor" cl))
    (princ)
    )
  (setvar "cmdecho" 1)
  (prompt "\n\t\t\>>> Press ESC key to Stop programm <<<")

  (setq osm (getvar "osmode"))
  (setq cc (getvar "clayer"))
  (setq cl (getvar "cecolor"))
  (setvar "osmode" 751)
 
  (if (not (tblsearch "ltype" "CENTER"))
    (command "._linetype" "_Load" "CENTER" "acad.lin" "")
)
 
 ;removed by A.A.   
;;;  (_make_layer
;;;    "CL"   ;layer name
;;;    4   ;color index
;;;    "CENTER"   ;linetype
;;;    -3   ;lineweight "Default" = -3
;;;    1   ; plottable
;;;    "Color_6"   ;plot style (ignore if does not exist)
;;;    "Layer for centerline"   ;layer description
;;;    )
;;;  (_make_layer
;;;    "DUCT1"   ;layer name
;;;    7   ;color index
;;;    "CENTER"   ;linetype
;;;    -3   ;lineweight "Default" = -3
;;;    1   ; plottable
;;;    "Color_7"   ;plot style (ignore if does not exist)
;;;    "Layer for duct"   ;layer description
;;;    )
;;; 

 ; (setvar "clayer" "CL")
 ; (setvar "cecolor" "BYLAYER")
 ; (setvar "celtype" "BYLAYER")
  ;; change the list of diameters here:
 
  (setq strd "50.8 67.73 81.28 101.6 135.467 162.56 203.2")
  (initget strd)
  (setq dia (getreal (strcat "\nEnter the outer diameter of elbow ["
(setq strd
(vl-string-translate " " "/" strd)) "]: "))
)
  (if (not dia)(setq dia 203.2)
    )
  (setq strd
     (apply 'strcat
    (mapcar (function (lambda (s) (strcat s "/"))
      )
    (mapcar 'rtos
    (mapcar (function (lambda (x) (* x 2.))
      )
    (mapcar 'atof (strtolist strd "/")))))
    )
strd (substr strd 1 (1- (strlen strd)))
)
  (setq rad (getreal (strcat "\nEnter the radius of the elbow [" strd "] <"
     (rtos (* dia 2.)) ">: "))
)
  (if (not rad)(setq rad (* dia 2.))
    )
  ;; change the list of section numbers here:
  (setq strd  "3 4 5 6 8 10")
  (initget strd)
    (setq num (getint(strcat "\nEnter the number of sections ["
(setq strd
(vl-string-translate " " "/" strd)) "] <5>: "))
)
  (if (not num)(setq num 5)
    )

;; change the list of angles here:
  (setq strd  "10 15 20 30 45 60 90")
  (initget strd)
    (setq ang (getreal (strcat "\nEnter the angle of the elbow in degrees ["
(setq strd
(vl-string-translate " " "/" strd)) "] <90>: "))
)
  (if (not ang)(setq ang 90.)
    )
 
  (setq p1 (getpoint "\nPick the start point of duct: ")
center (polar p1 0.0 rad)
p2 (polar p1 (- pi (dtr ang)) rad)
midp (polar p1 (- pi (/ (dtr ang) 2.)) rad)
)
 
  (command "._arc" "_C" center p1 "_A" (* -1 ang));modified by A.A.
 
  (setq rad1   (- rad (/ dia 2))
rad2   (+ rad (/ dia 2))
starta (angle center p1)
dupl   starta
delta  (/ (dtr ang) (1- num))
halfa (/ delta 2)
)

  (setq po1 (polar center pi rad2)
po2 (polar po1 (/ pi 2) 1.)
pc (polar center (- pi halfa) 1.)
po3 (polar center pi rad1)
po4 (polar po3 (/ pi 2) 1.)
pi1  (inters  po1 po2 center pc nil)
pi2  (inters  po3 po4 center pc nil)
rad1 (distance center pi1)
rad2 (distance center pi2)
)
  ;(setvar "clayer" "DUCT1");removed by A.A.
    (command "._line"
     "_non"
     po1
     "_non"
     pi1
     "")(setq ln1 (entlast))
  (command "._line"
     "_non"
     po3
     "_non"
     pi2
     "")(setq ln2 (entlast))
 
  (command "._line"
     "_non"
     po1
     "_non"
     po3
     "")(setq ln3 (entlast))
 
  (setq mirr (polar center (- pi (/ (dtr ang) 2)) 1.))
 
  (command "._mirror" ln1 ln2 ln3 "" center mirr "N")
 
  (setq starta (- starta halfa))
 
  (repeat (- num 2)
    (command "._line"
     "_non"
     (polar center starta rad1)
     "_non"
     (polar center starta rad2)
     "")
    (command "._line"
     "_non"
     (polar center starta rad1)
     "_non"
     (polar center (- starta delta) rad1)
     "")
    (command "._line"
     "_non"
     (polar center starta rad2)
     "_non"
     (polar center (- starta delta) rad2)
     "")
   
    (setq starta (- starta delta))
    )
 
  (command "._line"
     "_non"
     (polar center starta rad1)
     "_non"
     (polar center starta rad2)
     "")

  (setq ps (polar center (/ pi 2) rad1)
ps (polar ps 0. (* 8 25.4))
dist (* (distance po1 pi1) 2)
pe (polar ps 0. (* dist (1- num)))
  )
  (command "._line"
     "_non"
     ps
     "_non"
     pe
     "")
  (setq p1 ps
p2 (polar p1 (* pi 1.5) dia)
p3 (polar p2 0. (distance po3 pi2))
p4 (polar p1 0. (distance po1 pi1))

)
 
  (command "._pline")(mapcar 'command (list p1 p2 p3 p4))(command "");modified by A.A.
  (setq pl (entlast))
 
  (setq mirr1 (polar p1 0. (setq dist2 (/ (distance ps pe) 2)))
mirr2 (polar p2 0. dist2)
)
  (command "._mirror" pl "" mirr1 mirr2 "N")
 (repeat (- num 2)
  (setq po5 (polar p4 (+ (* pi 1.5) halfa) 1.0)
p5 (inters p2 p3 p4 po5 nil)
p7 (polar p4 0. dist)
po6 (polar p7 (- (* pi 1.5) halfa) 1.0)
p6 (inters p2 p3 p7 po6 nil)
)
  (command "._pline")(mapcar 'command (list p4 p5 p6 p7))(command "");modified by A.A.
  (setq p4 (polar p4 0. dist))
   )

  (*error* nil)
  (princ)
  )
;;===========================  end of defun  =====================;;
Keep smile...

mdbdesign

  • Newt
  • Posts: 52
Re: Duct elbow
« Reply #8 on: April 02, 2009, 03:22:59 PM »
Thank you. All of my dwgs usually start from template with all layer in place. All lisp's dependent from action change layer to suit.
Nice work, Andrea.
Thanks again.
Marek
Marek