MCAD-Library/bearing.scad

121 lines
3.1 KiB
OpenSCAD
Raw Normal View History

/*
* Bearing model.
2010-09-29 10:54:37 -05:00
*
* Originally by Hans Häggström, 2010.
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
*/
2013-06-13 11:56:03 -05:00
/*
change list 13/6/2013
added ,604,606,607,628,629,6200,6201,6202,6203,6205,6206 bearing sizes
*/
include <units.scad>
include <materials.scad>
// Example, uncomment to view
//test_bearing();
//test_bearing_hole();
module test_bearing(){
bearing();
bearing(pos=[5*cm, 0,0], angle=[90,0,0]);
bearing(pos=[-2.5*cm, 0,0], model=688);
}
module test_bearing_hole(){
difference(){
translate([0, 0, 3.5]) cube(size=[30, 30, 7-10*epsilon], center=true);
bearing(outline=true);
}
}
BEARING_INNER_DIAMETER = 0;
BEARING_OUTER_DIAMETER = 1;
BEARING_WIDTH = 2;
// Common bearing names
SkateBearing = 608;
// Bearing dimensions
// model == XXX ? [inner dia, outer dia, width]:
function bearingDimensions(model) =
2013-06-13 11:56:03 -05:00
model == 604 ? [4*mm, 12*mm, 4*mm]:
model == 606 ? [6*mm, 17*mm, 6*mm]:
model == 607 ? [7*mm, 19*mm, 6*mm]:
model == 608 ? [8*mm, 22*mm, 7*mm]:
model == 623 ? [3*mm, 10*mm, 4*mm]:
model == 624 ? [4*mm, 13*mm, 5*mm]:
model == 627 ? [7*mm, 22*mm, 7*mm]:
model == 628 ? [8*mm, 24*mm, 8*mm]:
model == 629 ? [9*mm, 26*mm, 8*mm]:
model == 688 ? [8*mm, 16*mm, 4*mm]:
model == 698 ? [8*mm, 19*mm, 6*mm]:
model == 6200 ? [10*mm, 30*mm, 9*mm]:
model == 6201 ? [12*mm, 32*mm, 10*mm]:
model == 6202 ? [15*mm, 35*mm, 11*mm]:
model == 6203 ? [17*mm, 40*mm, 12*mm]:
model == 6205 ? [25*mm, 52*mm, 15*mm]:
model == 6206 ? [30*mm, 62*mm, 16*mm]:
//
//todo:-
// add
//mr105 5 10 4
//mr115 5 11 4
//mr126 6 12 4
// and other standard sizes
//
[8*mm, 22*mm, 7*mm]; // this is the default
function bearingWidth(model) = bearingDimensions(model)[BEARING_WIDTH];
function bearingInnerDiameter(model) = bearingDimensions(model)[BEARING_INNER_DIAMETER];
function bearingOuterDiameter(model) = bearingDimensions(model)[BEARING_OUTER_DIAMETER];
module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
material=Steel, sideMaterial=Brass) {
// Common bearing names
model =
model == "Skate" ? 608 :
model;
w = bearingWidth(model);
innerD = outline==false ? bearingInnerDiameter(model) : 0;
outerD = bearingOuterDiameter(model);
2010-09-29 10:54:37 -05:00
innerRim = innerD + (outerD - innerD) * 0.2;
outerRim = outerD - (outerD - innerD) * 0.2;
midSink = w * 0.1;
translate(pos) rotate(angle) union() {
2010-09-29 10:54:37 -05:00
color(material)
difference() {
// Basic ring
Ring([0,0,0], outerD, innerD, w, material, material);
if (outline==false) {
// Side shields
Ring([0,0,-epsilon], outerRim, innerRim, epsilon+midSink, sideMaterial, material);
Ring([0,0,w-midSink], outerRim, innerRim, epsilon+midSink, sideMaterial, material);
}
}
}
module Ring(pos, od, id, h, material, holeMaterial) {
color(material) {
translate(pos)
difference() {
cylinder(r=od/2, h=h, $fs = 0.01);
2010-09-29 10:54:37 -05:00
color(holeMaterial)
translate([0,0,-10*epsilon])
cylinder(r=id/2, h=h+20*epsilon, $fs = 0.01);
}
}
}
2010-09-29 10:54:37 -05:00
}