2010-07-26 02:58:32 -05:00
|
|
|
/*
|
|
|
|
* Bearing model.
|
2010-09-29 10:54:37 -05:00
|
|
|
*
|
2010-07-26 02:58:32 -05:00
|
|
|
* Originally by Hans Häggström, 2010.
|
|
|
|
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
|
|
|
|
*/
|
|
|
|
|
|
|
|
include <units.scad>
|
|
|
|
include <materials.scad>
|
|
|
|
|
2010-07-26 04:57:28 -05:00
|
|
|
// Example, uncomment to view
|
|
|
|
//bearing_test();
|
|
|
|
//bearing_hole_test();
|
|
|
|
|
2010-07-26 02:58:32 -05:00
|
|
|
module bearing_test(){
|
|
|
|
bearing();
|
|
|
|
bearing(pos=[5*cm, 0,0], angle=[90,0,0]);
|
|
|
|
bearing(pos=[-2.5*cm, 0,0], model=Bearing688);
|
|
|
|
}
|
|
|
|
|
2010-07-26 04:57:28 -05:00
|
|
|
module bearing_hole_test(){
|
|
|
|
difference(){
|
|
|
|
translate([0, 0, 3.5]) cube(size=[30, 30, 7-10*epsilon], center=true);
|
|
|
|
bearing(outline=true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-26 02:58:32 -05:00
|
|
|
BEARING_INNER_DIAMETER = 0;
|
|
|
|
BEARING_OUTER_DIAMETER = 1;
|
|
|
|
BEARING_WIDTH = 2;
|
|
|
|
|
2010-09-29 11:03:39 -05:00
|
|
|
//BearingXXX = [inner dia, outer dia, width];
|
2010-07-26 02:58:32 -05:00
|
|
|
Bearing608 = [8*mm, 22*mm, 7*mm];
|
2010-09-29 11:03:39 -05:00
|
|
|
Bearing623 = [3*mm, 10*mm, 4*mm];
|
|
|
|
//Bearing624 = [4*mm, , ];
|
2010-07-26 02:58:32 -05:00
|
|
|
Bearing627 = [7*mm, 22*mm, 7*mm];
|
|
|
|
Bearing688 = [8*mm, 16*mm, 5*mm];
|
|
|
|
SkateBearing = Bearing608;
|
|
|
|
|
|
|
|
function bearingWidth(model) = model[BEARING_WIDTH];
|
|
|
|
function bearingInnerDiameter(model) = model[BEARING_INNER_DIAMETER];
|
|
|
|
function bearingOuterDiameter(model) = model[BEARING_OUTER_DIAMETER];
|
|
|
|
|
2010-07-26 04:57:28 -05:00
|
|
|
module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
|
|
|
|
material=Steel, sideMaterial=Brass) {
|
2010-07-26 02:58:32 -05:00
|
|
|
w = bearingWidth(model);
|
2010-07-26 04:57:28 -05:00
|
|
|
innerD = outline==false ? bearingInnerDiameter(model) : 0;
|
2010-07-26 02:58:32 -05:00
|
|
|
outerD = bearingOuterDiameter(model);
|
2010-09-29 10:54:37 -05:00
|
|
|
|
2010-07-26 02:58:32 -05:00
|
|
|
innerRim = innerD + (outerD - innerD) * 0.2;
|
|
|
|
outerRim = outerD - (outerD - innerD) * 0.2;
|
|
|
|
midSink = w * 0.1;
|
|
|
|
|
2010-07-26 04:57:28 -05:00
|
|
|
translate(pos) rotate(angle) union() {
|
2010-09-29 10:54:37 -05:00
|
|
|
color(material)
|
2010-07-26 04:57:28 -05:00
|
|
|
difference() {
|
|
|
|
// Basic ring
|
|
|
|
Ring([0,0,0], outerD, innerD, w, material, material);
|
2010-07-26 02:58:32 -05:00
|
|
|
|
2010-07-26 04:57:28 -05:00
|
|
|
if (outline==false) {
|
2010-07-26 02:58:32 -05:00
|
|
|
// Side shields
|
|
|
|
Ring([0,0,-epsilon], outerRim, innerRim, epsilon+midSink, sideMaterial, material);
|
|
|
|
Ring([0,0,w-midSink], outerRim, innerRim, epsilon+midSink, sideMaterial, material);
|
|
|
|
}
|
|
|
|
}
|
2010-07-26 04:57:28 -05:00
|
|
|
}
|
2010-07-26 02:58:32 -05:00
|
|
|
|
|
|
|
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])
|
2010-07-26 02:58:32 -05:00
|
|
|
cylinder(r=id/2, h=h+20*epsilon, $fs = 0.01);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-09-29 10:54:37 -05:00
|
|
|
|
2010-07-26 02:58:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|