Drawing HVAX Flex Duct - Lisp or Other Means ???
Drawing HVAX Flex Duct - Lisp or Other Means ???
(OP)
Does anyone out there have a quick lisp or other means of drawing flex duct (basically an arc with smaller alternating arcs or vertices propogated down the large arc)for HVAC plans. This may possibly be done within autocad with no outside lisp; if so I am unaware of it. Anyhow any direction would be greatly appreciate it.
Thanks
Thanks





RE: Drawing HVAX Flex Duct - Lisp or Other Means ???
Please send me a copy of it.
Just a sketch.
my e mail is
devitg@ciudad.com.ar
Pardal
RE: Drawing HVAX Flex Duct - Lisp or Other Means ???
I don't know of a double-line solution.
RE: Drawing HVAX Flex Duct - Lisp or Other Means ???
bdr
RE: Drawing HVAX Flex Duct - Lisp or Other Means ???
polyline-----------------------
(defun arcleft (/ p1 p2 arc d1 chord bng1 bng2 cpbng1 cpbng2 tp1 tp2
cenpt a1 a2 a3 rad prop arclen num segarc pitch
oradbig oradlit iradbig oradlit f1 f2 f3 f4 f5 f6)
(setq p1 (cdr(assoc 10 e4))) ;gets the location of the vertex
(setq arc(* 4.0(atan(cdr(assoc 42 e4)))));gets angle of arc
(setq e3 (entnext e3))
(setq e4 (entget e3))
(setq p2 (cdr(assoc 10 e4)))
(setq d1 (distance p1 p2)) ;length of run
(setq chord (angle p1 p2)) ;angle of run
(setq bng1 (- chord (/ arc 2.0))) ;forward bearing 1
(setq bng2 (+ bng1 arc)) ;forward bearing 2
(setq cpbng1 (+ bng1 (/ pi 2.0)))
(setq cpbng2 (+ bng2 (/ pi 2.0)))
(setq tp1 (polar p1 cpbng1 500))
(setq tp2 (polar p2 cpbng2 500))
(setq cenpt (inters p1 tp1 p2 tp2 ext))
(setq a1 (angle cenpt p1)
a2 (angle cenpt p2)
a3 (abs(- a2 a1)) ;included angle
rad(distance cenpt p1)
);setq
;next bit to trap angles starting in the third/fourth quadrants
(if (> a1 a2)
(setq a3 (- (* pi 2.0) a3))
);if
(setq
prop (/ (* pi 2.0) a3) ;proportion of full circle
arclen (/(* pi 2 rad )prop) ;length of the arc
num (fix(/ arclen nompitch)) ;number of iterations
segarc (/ a3 num 2.0) ;half the pitch segment angle
pitch (/ arclen num) ;actual centre line pitch
oradbig(+ rad (/ dia 2.0)) ;large radius outer
iradbig(- rad (/ dia 2.0)) ;large radius inner
oradlit(+ rad (/(- dia nompitch)2.0)) ;small radius outer
iradlit(- rad (/(- dia nompitch)2.0)) ;small radius inner
);setq
;--------compute the pitch points---------
(repeat num
(setq
f1 (polar cenpt a1 oradlit)
f2 (polar cenpt a1 iradlit)
a1 (+ a1 segarc) ;increment the angle
f3 (polar cenpt a1 oradbig)
f4 (polar cenpt a1 iradbig)
a1 (+ a1 segarc) ;increment the angle
f5 (polar cenpt a1 oradlit)
f6 (polar cenpt a1 iradlit)
);setq
(command "PLINE" f3 f1 f2 f4 f3 f5 f6 f4 "") ;draw the group
);repeat
(setq p1 p2)
);defun
;
;------------------curved right part of a polyline-----------------------
(defun arcright (/ p1 p2 arc d1 chord bng1 bng2 cpbng1 cpbng2 tp1 tp2
cenpt a1 a2 a3 rad prop arclen num segarc pitch
oradbig oradlit iradbig oradlit f1 f2 f3 f4 f5 f6)
(setq p1 (cdr(assoc 10 e4))) ;gets the location of the vertex
(setq arc(* 4.0(atan(abs(cdr(assoc 42 e4))))));gets angle of arc
(setq e3 (entnext e3))
(setq e4 (entget e3))
(setq p2 (cdr(assoc 10 e4)))
(setq d1 (distance p1 p2)) ;length of run
(setq chord (angle p1 p2)) ;angle of run
(setq bng1 (+ chord (/ arc 2.0))) ;forward bearing 1
(setq bng2 (- bng1 arc)) ;forward bearing 2
(setq cpbng1 (- bng1 (/ pi 2.0)))
(setq cpbng2 (- bng2 (/ pi 2.0)))
(setq tp1 (polar p1 cpbng1 500))
(setq tp2 (polar p2 cpbng2 500))
(setq cenpt (inters p1 tp1 p2 tp2 ext))
(setq a1 (angle cenpt p1)
a2 (angle cenpt p2)
a3 (abs(- a1 a2)) ;included angle
rad(distance cenpt p1)
);setq
;next bit to trap angles starting in the third/fourth quadrants
(if (> a2 a1)
(setq a3 (- (* pi 2.0) a3))
);if
(setq
prop (/ (* pi 2.0) a3) ;proportion of full circle
arclen (/(* pi 2 rad )prop) ;length of the arc
num (fix(/ arclen nompitch)) ;number of iterations
segarc (/ a3 num 2.0) ;half the pitch segment angle
pitch (/ arclen num) ;actual centre line pitch
oradbig(+ rad (/ dia 2.0)) ;large radius outer
iradbig(- rad (/ dia 2.0)) ;large radius inner
oradlit(+ rad (/(- dia nompitch)2.0)) ;small radius outer
iradlit(- rad (/(- dia nompitch)2.0)) ;small radius inner
);setq
;--------compute the pitch points---------
(repeat num
(setq
f1 (polar cenpt a1 oradlit)
f2 (polar cenpt a1 iradlit)
a1 (- a1 segarc) ;increment the angle
f3 (polar cenpt a1 oradbig)
f4 (polar cenpt a1 iradbig)
a1 (- a1 segarc) ;increment the angle
f5 (polar cenpt a1 oradlit)
f6 (polar cenpt a1 iradlit)
);setq
(command "PLINE" f3 f1 f2 f4 f3 f5 f6 f4 "") ;draw the group
);repeat
(setq p1 p2)
);defun
;
;----------------main function to sort and call entities-----------------
(defun c:ductflex (/ blp cmd osm cla plw txst)
(setq olderr *ERROR*) ;variable for old error handler
(setq *ERROR* flxerr) ;set error handler to flxerr
(getset) ;get current settings
(setup) ;do setup utilities
(prompt "\nConverting centre lines to flexible ducts ")
(datin) ;get or retain default data
(setq ent (entsel "\nSelect a centre line to convert "))
(while ent
(setq ent2 (dxf 0 ent))
(cond
((= ent2 "LINE")(flexlin))
((= ent2 "ARC")(flexarc))
((= ent2 "POLYLINE")(flexpl))
(t(princ "\nNot possible for this entity "))
);cond
(setq ent (entsel "\nSelect another or RETURN to quit "))
);while
(command "REDRAW") ;tidy up
(restset) ;restore settings
(setq *ERROR* olderr) ;restore error handler
(princ) ;clean exit
);defun
;(c:ductflex) ;calls main function
;END PROGRAM
;Author Richard Elliott Cartesian Computing Ltd. Copyright (C) UK 1996