Added a switch to generate bearing outlines for hole cutting etc.
This commit is contained in:
parent
c803681562
commit
50426f01ef
29
bearing.scad
29
bearing.scad
|
@ -8,12 +8,23 @@
|
|||
include <units.scad>
|
||||
include <materials.scad>
|
||||
|
||||
// Example, uncomment to view
|
||||
//bearing_test();
|
||||
//bearing_hole_test();
|
||||
|
||||
module bearing_test(){
|
||||
bearing();
|
||||
bearing(pos=[5*cm, 0,0], angle=[90,0,0]);
|
||||
bearing(pos=[-2.5*cm, 0,0], model=Bearing688);
|
||||
}
|
||||
|
||||
module bearing_hole_test(){
|
||||
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;
|
||||
|
@ -27,27 +38,29 @@ 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) {
|
||||
module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
|
||||
material=Steel, sideMaterial=Brass) {
|
||||
w = bearingWidth(model);
|
||||
innerD = bearingInnerDiameter(model);
|
||||
innerD = outline==false ? bearingInnerDiameter(model) : 0;
|
||||
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);
|
||||
translate(pos) rotate(angle) union() {
|
||||
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) {
|
||||
|
|
|
@ -20,5 +20,5 @@ M8 = 8*mm;
|
|||
|
||||
|
||||
// When a small distance is needed to overlap shapes for boolean cutting, etc.
|
||||
epsilon = 0.0001*mm;
|
||||
epsilon = 0.01*mm;
|
||||
|
||||
|
|
Loading…
Reference in a new issue