Flange with bolt circle LISP

Hi ya,
I just feel like sharing a little thing I did a while ago. I love it, anyway. Hope you do too. It draws a circular flange with outer, inner,
bolt circle and holes in a snap.
Feel free to give it away at Christmas. It's a great stocking stuffer.
;;; Flange.lsp ;;; Draws a flange with bolt circle (DEFUN c:flange(/ out in bc num trou cen cen1 cir1 cir2 cir3) (SETQ out (GETREAL "Give OUTER diameter : ") in (GETREAL "Give INNER diameter :") bc (GETREAL "Give bolt circle diameter : ") num (GETINT "How many holes : ") trou (GETREAL "Hole diameter : ") cen (GETPOINT "Insertion point : ") ) ;_ end of setq (IF (NOT (AND (TBLSEARCH "layer" "Axis") (TBLSEARCH "layer" "Contour") ) ;_ END and ) ;_ END not (PROGN (COMMAND "layer" "m" "Axis" "c" "Red" "" "l" "center" "" "") ;_ END COMMAND (COMMAND "layer" "m" "Contour" "c" "Magenta" "" "l" "continuous" "" "") ;_ END COMMAND ) ;_ END progn ) (SETVAR "OSMODE" 0) (setvar "CLAYER" "Contour") (COMMAND "_.circle" cen "D" out) (COMMAND "_.circle" cen "D" in) (SETQ cen1 (POLAR cen (/ PI 2) (/ bc 2))) (COMMAND "_.circle" cen1 "D" trou) (setq cir1 (entlast)) (setvar "CLAYER" "AXIS") (command "_.line" (polar cen1 (/ pi 2) (/ trou 2)) (polar cen1 (/ pi -2) (/ trou 2)) "") (setq cir2 (entlast)) (command "_.line" (polar cen1 pi (/ trou 2)) (polar cen1 0.0 (/ trou 2)) "") (setq cir3 (entlast)) (setvar "OSMODE" 0) (command "_.regen") (COMMAND "_.array" cir1 cir2 cir3 "" "P" cen num 360 "y") (setvar "CLAYER" "Contour") (SETVAR "OSMODE" 183) (PRINC) ) ;_ end of defun
Dr Flau
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On 4/18/07 I read from Dr Fleau:
"c" )
;; get the name of the triangle
(setq *aa (entlast))
;; create a ss of the triangle
(setq *bb (ssadd *aa))
;;now revolve the triangle about the y axis
(COMMAND "revolve" *bb "" "y" "")
;;get the name of the revolved triange reuse *bb
(setq *bb (entlast))
;;create a ss of the revolved triangle reuse *aa
(setq *aa (ssadd *bb *w))
;; union the two solids
(COMMAND "union" *w "")
;;get the name of the completed flange reuse *aa
(setq *aa (entlast))
;; create a ss of the flange reuse *bb
(setq *bb (ssadd *aa))
;; reset the view to top to rotate the flange 22.5 degrees
(COMMAND "_-view" "top")
;;rotate the flange depending on the # of bolt holes
(setq *cc (/ 180 nb))
(COMMAND "rotate" *bb "" "0,0" *cc )
;; exit smooth
(princ)
;;end procinfo
)
;; create main container function to bring it all together
(defun c:fl ( / odia tflg bhdia nb lth bhcdia pid) ;; fl runs the program (rdata) (procinfo)
;;end the program
)
And now the text file:
0 pipe size/ odia/ tflg/ bhdia/ nb/ lth/ bhcdia/ pod --- last data must follow with a space 0.5 3.5 0.4375 0.625 4 1.875 2.375 0.840 0.75 3.875 0.5 0.625 4 2.0625 2.75 1.050 1 4.25 0.5625 0.625 4 2.1875 3.125 1.315 1.25 4.625 0.625 0.625 4 2.25 3.5 1.660 1.5 5 0.6875 0.625 4 2.4375 3.875 1.9 2 6 0.75 0.75 4 2.5 4.75 2.375 2.5 7 0.875 0.75 4 2.75 5.5 2.875 3 7.5 0.9375 0.75 4 2.75 6 3.5 4 9 0.9375 0.75 8 3 7.5 4.5 5 10 0.9375 0.75 8 3.5 8.5 5.563 6 11 1 0.875 8 3.5 9.5 6.625 8 13.5 1.125 0.875 8 4 11.75 8.625 10 16 1.1875 1 12 4 14.25 10.75 12 19 1.25 1 12 4.5 17 12.75
Text file ends with space after 12.75 Name the file "150_flg_data.txt" ( maximize window before you copy text) If you require flanges larger than 12" you'll need to add data to the text file I also have routines for 3d elbows, reducers, tees, and slip on flanges -- all generate solid models of exact proportions.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

will your lisp make offset reducers or just concentric?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Longshot wrote:

text
flanges --

Only concentric at this time.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.