Added ball_bearings.scad

This commit is contained in:
Revar Desmera 2022-09-19 20:18:25 -07:00
parent aeed8e9f30
commit 75dfe87c51
2 changed files with 303 additions and 66 deletions

231
ball_bearings.scad Normal file
View file

@ -0,0 +1,231 @@
//////////////////////////////////////////////////////////////////////
// LibFile: ball_bearings.scad
// Models for standard ball bearing cartridges.
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/ball_bearings.scad>
// FileGroup: Parts
// FileSummary: Models for standard ball bearing cartridges.
//////////////////////////////////////////////////////////////////////
// Section: Ball Bearing Models
// Module: ball_bearing()
// 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.
// 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("603");
// Example:
// ball_bearing("603ZZ");
// Example:
// ball_bearing("R8");
// Example:
// ball_bearing(id=12,od=32,width=10,shield=false);
module ball_bearing(trade_size, id, od, width, shield=true, 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];
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);
} 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);
}
}
children();
}
}
// Section: Ball Bearing Info
// Function: ball_bearing_info()
// Description:
// Get dimensional info for a standard metric ball bearing cartridge.
// Returns `[SHAFT_DIAM, OUTER_DIAM, WIDTH, SHIELDED]` 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
[ "R2", 1/8*IN, 3/8*IN, 5/32*IN, false],
[ "R3", 3/16*IN, 1/2*IN, 5/32*IN, false],
[ "R4", 1/4*IN, 5/8*IN, 0.196*IN, false],
[ "R6", 3/8*IN, 7/8*IN, 7/32*IN, false],
[ "R8", 1/2*IN, 9/8*IN, 1/4*IN, false],
[ "R10", 5/8*IN, 11/8*IN, 9/32*IN, false],
[ "R12", 3/4*IN, 13/8*IN, 5/16*IN, false],
[ "R14", 7/8*IN, 15/8*IN, 3/8*IN, false],
[ "R16", 8/8*IN, 16/8*IN, 3/8*IN, false],
[ "R18", 9/8*IN, 17/8*IN, 3/8*IN, false],
[ "R20", 10/8*IN, 18/8*IN, 3/8*IN, false],
[ "R22", 11/8*IN, 20/8*IN, 7/16*IN, false],
[ "R24", 12/8*IN, 21/8*IN, 7/16*IN, false],
[ "R2ZZ", 1/8*IN, 3/8*IN, 5/32*IN, true ],
[ "R3ZZ", 3/16*IN, 1/2*IN, 5/32*IN, true ],
[ "R4ZZ", 1/4*IN, 5/8*IN, 0.196*IN, true ],
[ "R6ZZ", 3/8*IN, 7/8*IN, 7/32*IN, true ],
[ "R8ZZ", 1/2*IN, 9/8*IN, 1/4*IN, true ],
[ "R10ZZ", 5/8*IN, 11/8*IN, 9/32*IN, true ],
[ "R12ZZ", 3/4*IN, 13/8*IN, 5/16*IN, true ],
[ "R14ZZ", 7/8*IN, 15/8*IN, 3/8*IN, true ],
[ "R16ZZ", 8/8*IN, 16/8*IN, 3/8*IN, true ],
[ "R18ZZ", 9/8*IN, 17/8*IN, 3/8*IN, true ],
[ "R20ZZ", 10/8*IN, 18/8*IN, 3/8*IN, true ],
[ "R22ZZ", 11/8*IN, 20/8*IN, 7/16*IN, true ],
[ "R24ZZ", 12/8*IN, 21/8*IN, 7/16*IN, true ],
[ "608", 8, 22, 7, false],
[ "629", 9, 26, 8, false],
[ "635", 5, 19, 6, false],
[ "6000", 10, 26, 8, false],
[ "6001", 12, 28, 8, false],
[ "6002", 15, 32, 9, false],
[ "6003", 17, 35, 10, false],
[ "6007", 35, 62, 14, false],
[ "6200", 10, 30, 9, false],
[ "6201", 12, 32, 10, false],
[ "6202", 15, 35, 11, false],
[ "6203", 17, 40, 12, false],
[ "6204", 20, 47, 14, false],
[ "6205", 25, 52, 15, false],
[ "6206", 30, 62, 16, false],
[ "6207", 35, 72, 17, false],
[ "6208", 40, 80, 18, false],
[ "6209", 45, 85, 19, false],
[ "6210", 50, 90, 20, false],
[ "6211", 55, 100, 21, false],
[ "6212", 60, 110, 22, false],
[ "6301", 12, 37, 12, false],
[ "6302", 15, 42, 13, false],
[ "6303", 17, 47, 14, false],
[ "6304", 20, 52, 15, false],
[ "6305", 25, 62, 17, false],
[ "6306", 30, 72, 19, false],
[ "6307", 35, 80, 21, false],
[ "6308", 40, 90, 23, false],
[ "6309", 45, 100, 25, false],
[ "6310", 50, 110, 27, false],
[ "6311", 55, 120, 29, false],
[ "6312", 60, 130, 31, false],
[ "6403", 17, 62, 17, false],
[ "6800", 10, 19, 5, false],
[ "6801", 12, 21, 5, false],
[ "6802", 15, 24, 5, false],
[ "6803", 17, 26, 5, false],
[ "6804", 20, 32, 7, false],
[ "6805", 25, 37, 7, false],
[ "6806", 30, 42, 7, false],
[ "6900", 10, 22, 6, false],
[ "6901", 12, 24, 6, false],
[ "6902", 15, 28, 7, false],
[ "6903", 17, 30, 7, false],
[ "6904", 20, 37, 9, false],
[ "6905", 25, 42, 9, false],
[ "6906", 30, 47, 9, false],
[ "6907", 35, 55, 10, false],
[ "6908", 40, 62, 12, false],
[ "16002", 15, 22, 8, false],
[ "16004", 20, 42, 8, false],
[ "16005", 25, 47, 8, false],
[ "16100", 10, 28, 8, false],
[ "16101", 12, 30, 8, false],
[ "608ZZ", 8, 22, 7, true ],
[ "629ZZ", 9, 26, 8, true ],
[ "635ZZ", 5, 19, 6, true ],
[ "6000ZZ", 10, 26, 8, true ],
[ "6001ZZ", 12, 28, 8, true ],
[ "6002ZZ", 15, 32, 9, true ],
[ "6003ZZ", 17, 35, 10, true ],
[ "6007ZZ", 35, 62, 14, true ],
[ "6200ZZ", 10, 30, 9, true ],
[ "6201ZZ", 12, 32, 10, true ],
[ "6202ZZ", 15, 35, 11, true ],
[ "6203ZZ", 17, 40, 12, true ],
[ "6204ZZ", 20, 47, 14, true ],
[ "6205ZZ", 25, 52, 15, true ],
[ "6206ZZ", 30, 62, 16, true ],
[ "6207ZZ", 35, 72, 17, true ],
[ "6208ZZ", 40, 80, 18, true ],
[ "6209ZZ", 45, 85, 19, true ],
[ "6210ZZ", 50, 90, 20, true ],
[ "6211ZZ", 55, 100, 21, true ],
[ "6212ZZ", 60, 110, 22, true ],
[ "6301ZZ", 12, 37, 12, true ],
[ "6302ZZ", 15, 42, 13, true ],
[ "6303ZZ", 17, 47, 14, true ],
[ "6304ZZ", 20, 52, 15, true ],
[ "6305ZZ", 25, 62, 17, true ],
[ "6306ZZ", 30, 72, 19, true ],
[ "6307ZZ", 35, 80, 21, true ],
[ "6308ZZ", 40, 90, 23, true ],
[ "6309ZZ", 45, 100, 25, true ],
[ "6310ZZ", 50, 110, 27, true ],
[ "6311ZZ", 55, 120, 29, true ],
[ "6312ZZ", 60, 130, 31, true ],
[ "6403ZZ", 17, 62, 17, true ],
[ "6800ZZ", 10, 19, 5, true ],
[ "6801ZZ", 12, 21, 5, true ],
[ "6802ZZ", 15, 24, 5, true ],
[ "6803ZZ", 17, 26, 5, true ],
[ "6804ZZ", 20, 32, 7, true ],
[ "6805ZZ", 25, 37, 7, true ],
[ "6806ZZ", 30, 42, 7, true ],
[ "6900ZZ", 10, 22, 6, true ],
[ "6901ZZ", 12, 24, 6, true ],
[ "6902ZZ", 15, 28, 7, true ],
[ "6903ZZ", 17, 30, 7, true ],
[ "6904ZZ", 20, 37, 9, true ],
[ "6905ZZ", 25, 42, 9, true ],
[ "6906ZZ", 30, 47, 9, true ],
[ "6907ZZ", 35, 55, 10, true ],
[ "6908ZZ", 40, 62, 12, true ],
[ "16002ZZ", 15, 22, 8, true ],
[ "16004ZZ", 20, 42, 8, true ],
[ "16005ZZ", 25, 47, 8, true ],
[ "16100ZZ", 10, 28, 8, true ],
[ "16101ZZ", 12, 30, 8, true ],
],
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

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////
// LibFile: linear_bearings.scad
// Mounts for LMxUU style linear bearings.
// Mounts and models for LMxUU style linear bearings.
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/linear_bearings.scad>
@ -9,61 +9,7 @@
//////////////////////////////////////////////////////////////////////
include <metric_screws.scad>
// Section: Functions
// Function: get_lmXuu_bearing_diam()
// Description: Get outside diameter, in mm, of a standard lmXuu bearing.
// Arguments:
// size = Inner size of lmXuu bearing, in mm.
function get_lmXuu_bearing_diam(size) = lookup(size, [
[ 4.0, 8.0],
[ 5.0, 10.0],
[ 6.0, 12.0],
[ 8.0, 15.0],
[ 10.0, 19.0],
[ 12.0, 21.0],
[ 13.0, 23.0],
[ 16.0, 28.0],
[ 20.0, 32.0],
[ 25.0, 40.0],
[ 30.0, 45.0],
[ 35.0, 52.0],
[ 40.0, 60.0],
[ 50.0, 80.0],
[ 60.0, 90.0],
[ 80.0, 120.0],
[100.0, 150.0]
]);
// Function: get_lmXuu_bearing_length()
// Description: Get length, in mm, of a standard lmXuu bearing.
// Arguments:
// size = Inner size of lmXuu bearing, in mm.
function get_lmXuu_bearing_length(size) = lookup(size, [
[ 4.0, 12.0],
[ 5.0, 15.0],
[ 6.0, 19.0],
[ 8.0, 24.0],
[ 10.0, 29.0],
[ 12.0, 30.0],
[ 13.0, 32.0],
[ 16.0, 37.0],
[ 20.0, 42.0],
[ 25.0, 59.0],
[ 30.0, 64.0],
[ 35.0, 70.0],
[ 40.0, 80.0],
[ 50.0, 100.0],
[ 60.0, 110.0],
[ 80.0, 140.0],
[100.0, 175.0]
]);
// Section: Generic Linear Bearings
// Module: linear_bearing_housing()
// Description:
@ -125,6 +71,34 @@ module linear_bearing_housing(d=15, l=24, tab=7, gap=5, wall=3, tabwall=5, screw
}
// Module: linear_bearing()
// Description:
// Creates a rough model of a generic linear ball bearing cartridge.
// Arguments:
// l/length = The length of the linear bearing cartridge.
// od = The outer diameter of the linear bearing cartridge.
// id = The inner diameter of the linear bearing cartridge.
// 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:
// linear_bearing(l=24, od=15, id=8);
module linear_bearing(l, od=15, id=8, length, anchor=CTR, spin=0, orient=UP) {
l = first_defined([l, length, 24]);
attachable(anchor,spin,orient, d=od, l=l) {
color("silver") {
tube(id=id, od=od, l=l-1);
tube(id=od-1, od=od, l=l);
tube(id=id, od=id+1, l=l);
tube(id=id+2, od=od-2, l=l);
}
children();
}
}
// Section: lmXuu Linear Bearings
// Module: lmXuu_housing()
// Description:
// Creates a model of a clamp to hold a standard sized lmXuu linear bearing cartridge.
@ -142,8 +116,9 @@ module linear_bearing_housing(d=15, l=24, tab=7, gap=5, wall=3, tabwall=5, screw
// lmXuu_housing(size=10, wall=2, tab=6, screwsize=2.5);
module lmXuu_housing(size=8, tab=7, gap=5, wall=3, tabwall=5, screwsize=3, anchor=BOTTOM, spin=0, orient=UP)
{
d = get_lmXuu_bearing_diam(size);
l = get_lmXuu_bearing_length(size);
info = lmXuu_info(size);
d = info[0];
l = info[1];
linear_bearing_housing(d=d, l=l, tab=tab, gap=gap, wall=wall, tabwall=tabwall, screwsize=screwsize, orient=orient, spin=spin, anchor=anchor) children();
}
@ -159,16 +134,47 @@ module lmXuu_housing(size=8, tab=7, gap=5, wall=3, tabwall=5, screwsize=3, ancho
// Example:
// lmXuu_bearing(size=10);
module lmXuu_bearing(size=8, anchor=CTR, spin=0, orient=UP) {
d = get_lmXuu_bearing_diam(size);
l = get_lmXuu_bearing_length(size);
color("silver") {
tube(id=size, od=d, l=l-1);
tube(id=d-1, od=d, l=l);
tube(id=size, od=size+1, l=l);
tube(id=size+2, od=d-2, l=l);
}
info = lmXuu_info(size);
linear_bearing(l=info[1], id=size, od=info[0], anchor=anchor, spin=spin, orient=orient) children();
}
// Section: lmXuu Linear Bearing Info
// Function: lmXuu_info()
// Description:
// Get dimensional info for a standard metric lmXuu linear bearing cartridge.
// Returns `[DIAM, LENGTH]` for the cylindrical cartridge.
// Arguments:
// size = Inner diameter of lmXuu bearing, in mm.
function lmXuu_info(size) =
let(
data = [
// size, diam, length
[ 4.0, 8.0, 12.0],
[ 5.0, 10.0, 15.0],
[ 6.0, 12.0, 19.0],
[ 8.0, 15.0, 24.0],
[ 10.0, 19.0, 29.0],
[ 12.0, 21.0, 30.0],
[ 13.0, 23.0, 32.0],
[ 16.0, 28.0, 37.0],
[ 20.0, 32.0, 42.0],
[ 25.0, 40.0, 59.0],
[ 30.0, 45.0, 64.0],
[ 35.0, 52.0, 70.0],
[ 40.0, 60.0, 80.0],
[ 50.0, 80.0, 100.0],
[ 60.0, 90.0, 110.0],
[ 80.0, 120.0, 140.0],
[100.0, 150.0, 175.0],
],
found = search([size], data, 1)[0]
)
assert(found, str("Unsupported lmXuu linear bearing size: ", size))
select(data[found], 1, -1);
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap