From c8036815625948fa1c4fbce9796cdd796776cb94 Mon Sep 17 00:00:00 2001 From: Elmom Date: Mon, 26 Jul 2010 10:58:32 +0300 Subject: [PATCH] Replaced bearings.scad with bearing.scad (from http://github.com/zzorn/FunRap) --- README | 4 +++- bearing.scad | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ bearings.scad | 11 --------- 3 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 bearing.scad delete mode 100644 bearings.scad diff --git a/README b/README index c3d93f5..c9aafec 100644 --- a/README +++ b/README @@ -20,12 +20,14 @@ Currently Provided Tools: Other tools (alpha quality): * nuts_and_bolts.scad: for creating metric and imperial bolt/nut holes -* bearings.scad: standard/custom bearings +* bearing.scad: standard/custom bearings * screw.cad: screws and augers +* materials.scad: color definitions for different materials Utils: * math.scad: general math functions * constants.scad: mathematical constants * curves.scad: mathematical functions defining curves +* units.scad: easy metric units You are welcome to fork this project in github and request pulls. I will try to accomodate the community as much as possible in this. diff --git a/bearing.scad b/bearing.scad new file mode 100644 index 0000000..4b0b20d --- /dev/null +++ b/bearing.scad @@ -0,0 +1,66 @@ +/* + * Bearing model. + * + * Originally by Hans Häggström, 2010. + * Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later + */ + +include +include + +module bearing_test(){ + bearing(); + bearing(pos=[5*cm, 0,0], angle=[90,0,0]); + bearing(pos=[-2.5*cm, 0,0], model=Bearing688); +} + +BEARING_INNER_DIAMETER = 0; +BEARING_OUTER_DIAMETER = 1; +BEARING_WIDTH = 2; + +Bearing608 = [8*mm, 22*mm, 7*mm]; +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]; + +module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, material=Steel, sideMaterial=Brass) { + w = bearingWidth(model); + innerD = bearingInnerDiameter(model); + outerD = bearingOuterDiameter(model); + + innerRim = innerD + (outerD - innerD) * 0.2; + outerRim = outerD - (outerD - innerD) * 0.2; + midSink = w * 0.1; + + color(material) + translate(pos) + rotate(angle) { + difference() { + // Basic ring + Ring([0,0,0], outerD, innerD, w, material, material); + + // 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); + color(holeMaterial) + translate([0,0,-10*epsilon]) + cylinder(r=id/2, h=h+20*epsilon, $fs = 0.01); + } + } + } + +} + + diff --git a/bearings.scad b/bearings.scad deleted file mode 100644 index e3d02c6..0000000 --- a/bearings.scad +++ /dev/null @@ -1,11 +0,0 @@ -// License: GPL 2.0 - -//Todo: placeholder; should generate standard + cusom bearing mounting holes -module bearing_hole(outer_radius, hole=true, mochup=true) -{ - union() - { - if (mochup==true) %translate([0,0,-1.5])cylinder(r=outer_radius,h=3); - if (hole==true) circle(r=outer_radius); - } -}