////////////////////////////////////////////////////////////////////// // LibFile: ball_bearings.scad // Models for standard ball bearing cartridges. // Includes: // include // include // FileGroup: Parts // FileSummary: Models for standard ball bearing cartridges. ////////////////////////////////////////////////////////////////////// // Section: Ball Bearing Models // Module: ball_bearing() // Synopsis: Creates a standardized ball bearing assembly. // SynTags: Geom // Topics: Parts, Bearings // See Also: linear_bearing(), lmXuu_bearing(), lmXuu_housing() // Description: // Creates a model of a ball bearing assembly. // Arguments: // trade_size = String name of a standard ball bearing trade size. ie: "608", "6902ZZ", or "R8" // id = Inner diameter of ball bearing assembly. // od = Outer diameter of ball bearing assembly. // width = Width of ball bearing assembly. // shield = Does the ball bearing assembly have a shield. // flange = Does the ball bearing assembly have a flange. // fd = Diameter of the flange (only used if `flange=true`). // fw = Width of the flange (only used if `flange=true`). // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP` // Example: // ball_bearing("608", $fn=72); // Example: // ball_bearing("608ZZ", $fn=72); // Example: // ball_bearing("R8", $fn=72); // Example: // ball_bearing(id=12,od=32,width=10,shield=false, $fn=72); // Example: // ball_bearing(id=12,od=24,width=6,shield=true, flange=true, fd=26.5, fw=1.5, $fn=72); module ball_bearing(trade_size, id, od, width, shield=true, flange=false, fd=0, fw=0, anchor=CTR, spin=0, orient=UP) { info = is_undef(trade_size)? [id, od, width, shield] : ball_bearing_info(trade_size); check = assert(all_defined(info), "Bad Input"); id = info[0]; od = info[1]; width = info[2]; shield = info[3]; flange = info[4]; fd = info[5]; fw = info[6]; mid_d = (id+od)/2; wall = (od-id)/2/3; color("silver") attachable(anchor,spin,orient, d=od, l=width) { if (shield) { tube(id=id, wall=wall, h=width); tube(od=od, wall=wall, h=width); tube(id=id+0.1, od=od-0.1, h=(wall*2+width)/2); if (flange){ translate([0,0,-width/2+fw/2])tube(id=od, od=fd, h=fw); } } else { ball_cnt = floor(PI*mid_d*0.95 / (wall*2)); difference() { union() { tube(id=id, wall=wall, h=width); tube(od=od, wall=wall, h=width); } torus(r_maj=mid_d/2, r_min=wall); } for (i=[0:1:ball_cnt-1]) { zrot(i*360/ball_cnt) right(mid_d/2) sphere(d=wall*2); } if (flange){ translate([0,0,-width/2+fw/2])tube(id=od, od=fd, h=fw); } } children(); } } // Section: Ball Bearing Info // Function: ball_bearing_info() // Synopsis: Returns size info for a standardized ball bearing assembly. // Topics: Parts, Bearings // See Also: ball_bearing(), linear_bearing(), lmXuu_info() // Description: // Get dimensional info for a standard metric ball bearing cartridge. // Returns `[SHAFT_DIAM, OUTER_DIAM, WIDTH, SHIELDED, FLANGED, FLANGE_DIAM, FLANGE_WIDTH]` for the cylindrical cartridge. // Arguments: // size = Inner diameter of lmXuu bearing, in mm. function ball_bearing_info(trade_size) = assert(is_string(trade_size)) let( IN = 25.4, data = [ // trade_size, ID, OD, width, shielded, flanged, fd, fw [ "R2", 1/8*IN, 3/8*IN, 5/32*IN, false, false, 0, 0 ], [ "R3", 3/16*IN, 1/2*IN, 5/32*IN, false, false, 0, 0 ], [ "R4", 1/4*IN, 5/8*IN, 0.196*IN, false, false, 0, 0 ], [ "R6", 3/8*IN, 7/8*IN, 7/32*IN, false, false, 0, 0 ], [ "R8", 1/2*IN, 9/8*IN, 1/4*IN, false, false, 0, 0 ], [ "R10", 5/8*IN, 11/8*IN, 9/32*IN, false, false, 0, 0 ], [ "R12", 3/4*IN, 13/8*IN, 5/16*IN, false, false, 0, 0 ], [ "R14", 7/8*IN, 15/8*IN, 3/8*IN, false, false, 0, 0 ], [ "R16", 8/8*IN, 16/8*IN, 3/8*IN, false, false, 0, 0 ], [ "R18", 9/8*IN, 17/8*IN, 3/8*IN, false, false, 0, 0 ], [ "R20", 10/8*IN, 18/8*IN, 3/8*IN, false, false, 0, 0 ], [ "R22", 11/8*IN, 20/8*IN, 7/16*IN, false, false, 0, 0 ], [ "R24", 12/8*IN, 21/8*IN, 7/16*IN, false, false, 0, 0 ], [ "R2ZZ", 1/8*IN, 3/8*IN, 5/32*IN, true, false, 0, 0 ], [ "R3ZZ", 3/16*IN, 1/2*IN, 5/32*IN, true, false, 0, 0 ], [ "R4ZZ", 1/4*IN, 5/8*IN, 0.196*IN, true, false, 0, 0 ], [ "R6ZZ", 3/8*IN, 7/8*IN, 7/32*IN, true, false, 0, 0 ], [ "R8ZZ", 1/2*IN, 9/8*IN, 1/4*IN, true, false, 0, 0 ], [ "R10ZZ", 5/8*IN, 11/8*IN, 9/32*IN, true, false, 0, 0 ], [ "R12ZZ", 3/4*IN, 13/8*IN, 5/16*IN, true, false, 0, 0 ], [ "R14ZZ", 7/8*IN, 15/8*IN, 3/8*IN, true, false, 0, 0 ], [ "R16ZZ", 8/8*IN, 16/8*IN, 3/8*IN, true, false, 0, 0 ], [ "R18ZZ", 9/8*IN, 17/8*IN, 3/8*IN, true, false, 0, 0 ], [ "R20ZZ", 10/8*IN, 18/8*IN, 3/8*IN, true, false, 0, 0 ], [ "R22ZZ", 11/8*IN, 20/8*IN, 7/16*IN, true, false, 0, 0 ], [ "R24ZZ", 12/8*IN, 21/8*IN, 7/16*IN, true, false, 0, 0 ], [ "608", 8, 22, 7, false, false, 0, 0 ], [ "629", 9, 26, 8, false, false, 0, 0 ], [ "635", 5, 19, 6, false, false, 0, 0 ], [ "6000", 10, 26, 8, false, false, 0, 0 ], [ "6001", 12, 28, 8, false, false, 0, 0 ], [ "6002", 15, 32, 9, false, false, 0, 0 ], [ "6003", 17, 35, 10, false, false, 0, 0 ], [ "6007", 35, 62, 14, false, false, 0, 0 ], [ "6200", 10, 30, 9, false, false, 0, 0 ], [ "6201", 12, 32, 10, false, false, 0, 0 ], [ "6202", 15, 35, 11, false, false, 0, 0 ], [ "6203", 17, 40, 12, false, false, 0, 0 ], [ "6204", 20, 47, 14, false, false, 0, 0 ], [ "6205", 25, 52, 15, false, false, 0, 0 ], [ "6206", 30, 62, 16, false, false, 0, 0 ], [ "6207", 35, 72, 17, false, false, 0, 0 ], [ "6208", 40, 80, 18, false, false, 0, 0 ], [ "6209", 45, 85, 19, false, false, 0, 0 ], [ "6210", 50, 90, 20, false, false, 0, 0 ], [ "6211", 55, 100, 21, false, false, 0, 0 ], [ "6212", 60, 110, 22, false, false, 0, 0 ], [ "6301", 12, 37, 12, false, false, 0, 0 ], [ "6302", 15, 42, 13, false, false, 0, 0 ], [ "6303", 17, 47, 14, false, false, 0, 0 ], [ "6304", 20, 52, 15, false, false, 0, 0 ], [ "6305", 25, 62, 17, false, false, 0, 0 ], [ "6306", 30, 72, 19, false, false, 0, 0 ], [ "6307", 35, 80, 21, false, false, 0, 0 ], [ "6308", 40, 90, 23, false, false, 0, 0 ], [ "6309", 45, 100, 25, false, false, 0, 0 ], [ "6310", 50, 110, 27, false, false, 0, 0 ], [ "6311", 55, 120, 29, false, false, 0, 0 ], [ "6312", 60, 130, 31, false, false, 0, 0 ], [ "6403", 17, 62, 17, false, false, 0, 0 ], [ "6800", 10, 19, 5, false, false, 0, 0 ], [ "6801", 12, 21, 5, false, false, 0, 0 ], [ "6802", 15, 24, 5, false, false, 0, 0 ], [ "6803", 17, 26, 5, false, false, 0, 0 ], [ "6804", 20, 32, 7, false, false, 0, 0 ], [ "6805", 25, 37, 7, false, false, 0, 0 ], [ "6806", 30, 42, 7, false, false, 0, 0 ], [ "6900", 10, 22, 6, false, false, 0, 0 ], [ "6901", 12, 24, 6, false, false, 0, 0 ], [ "6902", 15, 28, 7, false, false, 0, 0 ], [ "6903", 17, 30, 7, false, false, 0, 0 ], [ "6904", 20, 37, 9, false, false, 0, 0 ], [ "6905", 25, 42, 9, false, false, 0, 0 ], [ "6906", 30, 47, 9, false, false, 0, 0 ], [ "6907", 35, 55, 10, false, false, 0, 0 ], [ "6908", 40, 62, 12, false, false, 0, 0 ], [ "16002", 15, 22, 8, false, false, 0, 0 ], [ "16004", 20, 42, 8, false, false, 0, 0 ], [ "16005", 25, 47, 8, false, false, 0, 0 ], [ "16100", 10, 28, 8, false, false, 0, 0 ], [ "16101", 12, 30, 8, false, false, 0, 0 ], [ "608ZZ", 8, 22, 7, true, false, 0, 0 ], [ "629ZZ", 9, 26, 8, true, false, 0, 0 ], [ "635ZZ", 5, 19, 6, true, false, 0, 0 ], [ "6000ZZ", 10, 26, 8, true, false, 0, 0 ], [ "6001ZZ", 12, 28, 8, true, false, 0, 0 ], [ "6002ZZ", 15, 32, 9, true, false, 0, 0 ], [ "6003ZZ", 17, 35, 10, true, false, 0, 0 ], [ "6007ZZ", 35, 62, 14, true, false, 0, 0 ], [ "6200ZZ", 10, 30, 9, true, false, 0, 0 ], [ "6201ZZ", 12, 32, 10, true, false, 0, 0 ], [ "6202ZZ", 15, 35, 11, true, false, 0, 0 ], [ "6203ZZ", 17, 40, 12, true, false, 0, 0 ], [ "6204ZZ", 20, 47, 14, true, false, 0, 0 ], [ "6205ZZ", 25, 52, 15, true, false, 0, 0 ], [ "6206ZZ", 30, 62, 16, true, false, 0, 0 ], [ "6207ZZ", 35, 72, 17, true, false, 0, 0 ], [ "6208ZZ", 40, 80, 18, true, false, 0, 0 ], [ "6209ZZ", 45, 85, 19, true, false, 0, 0 ], [ "6210ZZ", 50, 90, 20, true, false, 0, 0 ], [ "6211ZZ", 55, 100, 21, true, false, 0, 0 ], [ "6212ZZ", 60, 110, 22, true, false, 0, 0 ], [ "6301ZZ", 12, 37, 12, true, false, 0, 0 ], [ "6302ZZ", 15, 42, 13, true, false, 0, 0 ], [ "6303ZZ", 17, 47, 14, true, false, 0, 0 ], [ "6304ZZ", 20, 52, 15, true, false, 0, 0 ], [ "6305ZZ", 25, 62, 17, true, false, 0, 0 ], [ "6306ZZ", 30, 72, 19, true, false, 0, 0 ], [ "6307ZZ", 35, 80, 21, true, false, 0, 0 ], [ "6308ZZ", 40, 90, 23, true, false, 0, 0 ], [ "6309ZZ", 45, 100, 25, true, false, 0, 0 ], [ "6310ZZ", 50, 110, 27, true, false, 0, 0 ], [ "6311ZZ", 55, 120, 29, true, false, 0, 0 ], [ "6312ZZ", 60, 130, 31, true, false, 0, 0 ], [ "6403ZZ", 17, 62, 17, true, false, 0, 0 ], [ "6800ZZ", 10, 19, 5, true, false, 0, 0 ], [ "6801ZZ", 12, 21, 5, true, false, 0, 0 ], [ "6802ZZ", 15, 24, 5, true, false, 0, 0 ], [ "6803ZZ", 17, 26, 5, true, false, 0, 0 ], [ "6804ZZ", 20, 32, 7, true, false, 0, 0 ], [ "6805ZZ", 25, 37, 7, true, false, 0, 0 ], [ "6806ZZ", 30, 42, 7, true, false, 0, 0 ], [ "6900ZZ", 10, 22, 6, true, false, 0, 0 ], [ "6901ZZ", 12, 24, 6, true, false, 0, 0 ], [ "6902ZZ", 15, 28, 7, true, false, 0, 0 ], [ "6903ZZ", 17, 30, 7, true, false, 0, 0 ], [ "6904ZZ", 20, 37, 9, true, false, 0, 0 ], [ "6905ZZ", 25, 42, 9, true, false, 0, 0 ], [ "6906ZZ", 30, 47, 9, true, false, 0, 0 ], [ "6907ZZ", 35, 55, 10, true, false, 0, 0 ], [ "6908ZZ", 40, 62, 12, true, false, 0, 0 ], [ "16002ZZ", 15, 22, 8, true, false, 0, 0 ], [ "16004ZZ", 20, 42, 8, true, false, 0, 0 ], [ "16005ZZ", 25, 47, 8, true, false, 0, 0 ], [ "16100ZZ", 10, 28, 8, true, false, 0, 0 ], [ "16101ZZ", 12, 30, 8, true, false, 0, 0 ], [ "MF52ZZ", 2, 5, 2, true, true, 6.2, 0.6 ], [ "MF63ZZ", 3, 6, 2.5, true, true, 7.2, 0.6 ], [ "MF74ZZ", 4, 7, 2.5, true, true, 8.2, 0.6 ], [ "MF83ZZ", 3, 8, 2.5, true, true, 9.2, 0.6 ], [ "MF85ZZ", 5, 8, 2.5, true, true, 9.2, 0.6 ], [ "MF95ZZ", 5, 9, 2.5, true, true, 10.2, 0.6 ], [ "MF105ZZ", 5, 10, 3, true, true, 11.2, 0.6 ], [ "MF117ZZ", 7, 11, 2.5, true, true, 12.2, 0.6 ], [ "MF128ZZ", 8, 12, 3.5, true, true, 13.6, 0.8 ], [ "MF148ZZ", 8, 14, 3.5, true, true, 15.6, 0.8 ], [ "F6700ZZ", 10, 15, 4, true, true, 16.8, 0.8 ], [ "F6701ZZ", 12, 18, 4, true, true, 19.8, 0.8 ], [ "F6800ZZ", 10, 19, 5, true, true, 21.1, 1.1 ], [ "F6801ZZ", 12, 21, 5, true, true, 23.1, 1.1 ], [ "F6802ZZ", 15, 24, 5, true, true, 26.1, 1.1 ], [ "F6803ZZ", 17, 26, 5, true, true, 28.1, 1.1 ], [ "F6804ZZ", 20, 32, 7, true, true, 35, 1.5 ], [ "F6805ZZ", 25, 37, 7, true, true, 40.2, 1.5 ], [ "F6900ZZ", 10, 22, 6, true, true, 24.5, 1.5 ], [ "F6901ZZ", 12, 24, 6, true, true, 26.5, 1.5 ], [ "MF85", 5, 8, 2, false, true, 9.2, 0.6 ], ], found = search([trade_size], data, 1)[0] ) assert(found!=[], str("Unsupported ball bearing trade size: ", trade_size)) select(data[found], 1, -1); // vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap