Here is the rib pattern code:
Code:
(Protective Bellows rib generator)
(The following program generates rib sections for making fully paramitized protective bellows)
(originally coded for emc2 - linux cnc project)
(C2008 Colin MacKenzie)
(http://www.colinmackenzie.net)
(cnczone.com member guru_florida)
(the useful variables)
#90=-7.5 ( x origin start/finish )
#91=-6 ( y origin start/finish )
#92=40 ( cutting feed rate )
#101=7.5 ( Length of each center spar, inside measurement )
#102=2 ( Length of each side spar, inside measurement )
#103=0.52 ( Width of each spar )
#104=20 ( Number of spars to cut )
#105=45 ( angle of spar cuts )
#110=0.1 (travel or jog Z depth)
#111=-0.06 (begin cut depth)
(computed often-used variables - dont change)
( the Y value of the triangle formed by the crest and root is )
( known, it is #103, the x value is not, we calculate it here )
#501=[#103*TAN[#105]]
#511=[#101+2*#501] ( length of center spar long side )
#512=[#102+#501] ( length of side spar long side )
( Compute the opposite ends of our pattern )
#502=[#90+#511+2*#102] ( the x end )
#503=[#91+#104*#103] ( the y end )
( lets print out some interesting variables about the setup )
(print,Some valuable measurements you may want to know:)
(print, Zig Zag : Angle=#105, X=#501, Y=#103)
(print,Center spars:)
(print, Length long side : #511 )
(print, Length short side : #101 )
(print,Side spars:)
(print, Length long side : #512 )
(print, Length short side : #102 )
( main program start )
G90
T2 M6
G0 Z#110
G0 X#90 Y#91
( cut verticle lines )
#51=#91 ( will hold the y value iterator )
O1 while [ #51 lt #503 ]
G0 Y#51
G1 Z#111 F#92
G1 X[#502]
G0 Z#110
#51=[#51+#103]
G0 Y#51
( cut backward )
G1 Z#111
G1 X#90
G0 Z#110
#51=[#51+#103]
O1 endwhile
( cut zigzags through the lines separating the edges from the center )
#52=[#90+#102] ( our x position of zig zag start )
#53=#52
#51=[#51-#103]
#600=#51 ( save the current Y position )
G0 X#52 Y#51
O2 while [ #51 gt #91 ]
G1 Z#111 F#92
#51=[#51-#103]
#53=[#53+#501]
G1 X[#52+#501] Y#51
O3 if [ #51 gt #91 ]
#51=[#51-#103]
#53=[#53-#501]
G1 X[#52] Y#51
O3 endif
O2 endwhile
G0 Z#110
( cut zig zags up the other side )
#52=[#502-#102-#501] ( our x position of zig zag start )
#55=[#52-#53]
(print,Check: length of spar on bottom of pattern : #55)
G0 X#52 Y#51
G1 Z#111
O4 while [ #51 lt #503 ]
G1 Z#111 F#92
#51=[#51+#103]
G1 X[#52+#501] Y#51
#51=[#51+#103]
O5 if [ #51 lt #503 ]
G1 X[#52] Y#51
O5 endif
O4 endwhile
( cut the bounding box )
G0 Z#110
G0 X#502
G1 Z#111 F#92
G1 Y#91
G0 Z#110
G0 X#90
G1 Z#111
G1 Y#600
G0 Z#110
G0 X0Y0
M30
%