Merge pull request #85 from allaboutmikey/allaboutmikey-patch-1

Update bearing.scad to add centering.
This commit is contained in:
Chow Loong Jin 2021-04-23 13:39:48 +08:00 committed by GitHub
commit a700b7e8cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,8 +25,8 @@ module test_bearing(){
module test_bearing_hole(){ module test_bearing_hole(){
difference(){ difference(){
translate([0, 0, 3.5]) cube(size=[30, 30, 7-10*epsilon], center=true); cube(size=[30, 30, 7-10*epsilon], center=true);
bearing(outline=true); bearing(outline=true, center=true);
} }
} }
@ -106,7 +106,7 @@ function bearingInnerDiameter(model) = bearingDimensions(model)[BEARING_INNER_DI
function bearingOuterDiameter(model) = bearingDimensions(model)[BEARING_OUTER_DIAMETER]; function bearingOuterDiameter(model) = bearingDimensions(model)[BEARING_OUTER_DIAMETER];
module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false, module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
material=Steel, sideMaterial=Brass) { material=Steel, sideMaterial=Brass, center=false) {
// Common bearing names // Common bearing names
model = model =
model == "Skate" ? 608 : model == "Skate" ? 608 :
@ -119,8 +119,9 @@ module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
innerRim = innerD + (outerD - innerD) * 0.2; innerRim = innerD + (outerD - innerD) * 0.2;
outerRim = outerD - (outerD - innerD) * 0.2; outerRim = outerD - (outerD - innerD) * 0.2;
midSink = w * 0.1; midSink = w * 0.1;
newpos = [pos[0], pos[1], center ? pos[2]-(w/2) : pos[2]];
translate(pos) rotate(angle) union() { translate(newpos) rotate(angle) union() {
color(material) color(material)
difference() { difference() {
// Basic ring // Basic ring