~kennylevinsen/skadis-brackets

c2d8310053ea76919eb3707231b57f9031fe1a0d — Kenny Levinsen 2 months ago e0fcc62 master
stuff
A curtain-holder-spiral.scad => curtain-holder-spiral.scad +71 -0
@@ 0,0 1,71 @@
$fa=0.01;
$fs=0.01;

module screw(screwhole=3.5) {
        union() {
            translate([0, 0, 0.5]) {
                cylinder(h=5, r=screwhole/2);
                cylinder(h=2.5, r2=screwhole/2, r1=3.5);
            }
            translate([0, 0, -9.5])
                cylinder(h=10, r=3.5);
        }
}

thickness = 3;
hookRadius = 21;
flatExtension = 21;

difference() {
    union() {
        linear_extrude(height=20) {
            translate([3, 0])
                square([35, 3]);
            translate([38 - flatExtension, (hookRadius * 2) - thickness])
                square([flatExtension, 3]);
            difference() {
                translate([3, 0])
                    circle(d=6);
                translate([0, -3])
                    square([6, 3]);
            }
/*            difference() {
                translate([38, hookRadius])
                    circle(r=hookRadius);
                translate([38, hookRadius])
                    circle(r=hookRadius-thickness);
                polygon([ [0,3], [0, 50], [38,50], [38, 20], [38, 3] ]);
            }
            difference() {
                translate([38 - flatExtension, (hookRadius * 2) - thickness + 0.5])
                    circle(d=5);
                translate([38 - flatExtension - 3, (hookRadius * 2) - (thickness * 2)])
                    square([6, 3.5]);
            }
            difference() {
                union() {
                    translate([36 - flatExtension, (hookRadius * 2) - thickness + 0.5])
                        circle(d=1);
                    translate([36 - flatExtension, (hookRadius * 2) - thickness])
                        square([2, 1]);
                }
                translate([38 - flatExtension - 3, (hookRadius * 2) - (thickness * 2) + 4])
                    square([6, 1]);
            }
*/
        }
            linear_extrude(height=20, center=true, twist=180)
                translate([25, 0])
                       square([3, 20]);

    }

    translate([28, 3.1, 10])
        rotate([90, 0, 0])
            screw();

    translate([10, 3.1, 10])
        rotate([90, 0, 0])
            screw();
}


A curtain-holder.scad => curtain-holder.scad +67 -0
@@ 0,0 1,67 @@
$fa=0.01;
$fs=0.01;

module screw(screwhole=3.5) {
        union() {
            translate([0, 0, 0.5]) {
                cylinder(h=5, r=screwhole/2);
                cylinder(h=2.5, r2=screwhole/2, r1=3.5);
            }
            translate([0, 0, -9.5])
                cylinder(h=10, r=3.5);
        }
}

thickness = 3;
hookRadius = 21;
flatExtension = 21;

difference() {
    union() {
        linear_extrude(height=20) {
            translate([3, 0])
                square([35, 3]);
            translate([38 - flatExtension, (hookRadius * 2) - thickness])
                square([flatExtension, 3]);
            difference() {
                translate([3, 0])
                    circle(d=6);
                translate([0, -3])
                    square([6, 3]);
            }
            difference() {
                translate([38, hookRadius])
                    circle(r=hookRadius);
                translate([38, hookRadius])
                    circle(r=hookRadius-thickness);
                polygon([ [0,3], [0, 50], [38,50], [38, 20], [38, 3] ]);
            }
            difference() {
                translate([38 - flatExtension, (hookRadius * 2) - thickness + 0.5])
                    circle(d=5);
                translate([38 - flatExtension - 3, (hookRadius * 2) - (thickness * 2)])
                    square([6, 3.5]);
            }
            difference() {
                union() {
                    translate([36 - flatExtension, (hookRadius * 2) - thickness + 0.5])
                        circle(d=1);
                    translate([36 - flatExtension, (hookRadius * 2) - thickness])
                        square([2, 1]);
                }
                translate([38 - flatExtension - 3, (hookRadius * 2) - (thickness * 2) + 4])
                    square([6, 1]);
            }

        }
    }

    translate([28, 3.1, 10])
        rotate([90, 0, 0])
            screw();

    translate([10, 3.1, 10])
        rotate([90, 0, 0])
            screw();
}


A dock-lifter.scad => dock-lifter.scad +56 -0
@@ 0,0 1,56 @@
$fa=0.1;
$fs=0.1;

switchWidth = 172;
switchDepth = 102;
switchLift = 30;
switchWallThickness = 4;
switchIndentDepth = 22;
rounding = 4;
tabWidth = 10;
tabHeight = 5;
thickness = 3;

difference() {
    union() {
        hull() {
            translate([rounding, rounding])
                cylinder(r=rounding, h=switchLift);
            translate([switchWidth-rounding, rounding])
                cylinder(r=rounding, h=switchLift);
            translate([switchWidth-rounding, switchDepth-rounding])
                cylinder(r=rounding, h=switchLift);
            translate([rounding, switchDepth-rounding])
                cylinder(r=rounding, h=switchLift);
        }

        translate([switchWidth / 6 - (tabWidth/2), switchWallThickness])
            cube([tabWidth, switchWallThickness, switchLift + tabHeight]);

        translate([(switchWidth/6*5) - (tabWidth/2), switchWallThickness])
            cube([tabWidth, switchWallThickness, switchLift + tabHeight]);

        translate([switchWidth / 6 - (tabWidth/2), switchIndentDepth])
            cube([tabWidth, switchWallThickness, switchLift + tabHeight]);

        translate([(switchWidth/6*5) - (tabWidth/2), switchIndentDepth])
            cube([tabWidth, switchWallThickness, switchLift + tabHeight]);

        translate([switchWallThickness, (switchIndentDepth/2)])
            cube([switchWallThickness, tabWidth, switchLift + tabHeight]);

        translate([switchWidth-switchWallThickness*2, (switchIndentDepth/2)])
            cube([switchWallThickness, tabWidth, switchLift + tabHeight]);
    }

    hull() {
        translate([rounding+thickness, rounding+thickness])
            cylinder(r=rounding, h=switchLift-thickness);
        translate([switchWidth-rounding-thickness, rounding+thickness])
            cylinder(r=rounding, h=switchLift-thickness);
        translate([switchWidth-rounding-thickness, switchDepth-rounding-thickness])
            cylinder(r=rounding, h=switchLift-thickness);
        translate([rounding+thickness, switchDepth-rounding-thickness])
            cylinder(r=rounding, h=switchLift-thickness);
    }
}

A gshock.scad => gshock.scad +38 -0
@@ 0,0 1,38 @@
$fa=0.1;
$fs=0.1;

difference() {
    union() {
        difference() {
            hull() {
                cylinder(h=26.6, d=7.8);
                translate([0, -5, 0])
                    cylinder(h=26.6, d=4);
            }
            linear_extrude(26.6)
                polygon(points=[[0,0],[10,10],[-18,10]]);
        }
        cylinder(h=26.6, d=5.6);
    }
    cylinder(h=26.6, d=2);
    cylinder(h=1, d=3.2);
    translate([0, 0, 25.6])
        cylinder(h=1, d=3.2);
    hull() {
        translate([0, 0, (26.6-11.2)/2])
            cylinder(h=11.2, d=5);
        translate([0, 10, (26.6-11.2)/2])
            cylinder(h=11.2, d=5);
    }

    translate([0, -5, 0]) {
        cylinder(h=26.6, d=0.9);
        hull() {
            translate([0, 0, (26.6-22.2)/2])
                cylinder(h=22.2, d=6);
            translate([10, -5, (26.6-22.2)/2])
                cylinder(h=22.2, d=8);
        }
    }
}


A h3pro-plug.scad => h3pro-plug.scad +35 -0
@@ 0,0 1,35 @@
$fa=0.1;
$fs=0.1;

difference() {
    cylinder(d=7.85, h=12);
    for (i=[0:6]) {
        rotate(i*(360/7))
            translate([0, 3.925])
                cylinder(d=0.75, h=12);
    }
    translate([0, 0, 6])
        rotate_extrude(angle=360)
            translate([4.5, 0])
                circle(d=2.5);
    cylinder(d=5, h=12);
}

translate([0, 0, 12]) {
    difference() {
        cylinder(d=10, h=3);
        translate([0, 0, 1.5])
            rotate_extrude(angle=360) {
                translate([5, 0])
                    circle(d=0.75);
            }
        rotate_extrude(angle=360)
            translate([4.85, 0])
                polygon(points=[[0,0], [0.25,0], [0.25,0.25]]);
        translate([0, 0, 2.75])
            rotate_extrude(angle=360)
                translate([4.85, 0])
                    polygon(points=[[0.25,0.25], [0,0.25], [0.25,0]]);
    }
}


M hook-straight.scad => hook-straight.scad +19 -15
@@ 2,7 2,7 @@ $fn = 100;

include <common.scad>;

module frontHook(hook_length=50, hook_angle=45) {
module frontHook(hook_length=50, hook_angle=60, thickness=4, upwards=2.5) {
    radius=2.45;
    firsthook_angle=90;
    secondhook_angle=hook_angle;


@@ 10,7 10,7 @@ module frontHook(hook_length=50, hook_angle=45) {
    hook_radius=10;
    union() {
        translate([0,-7.5, 12.4-radius]) {
            translate([0,0,firsthook_radius-7.5]) {
            translate([0,-thickness,firsthook_radius-7.5]) {
                union() {
                    rotate([90,firsthook_angle,90])
                        rotate_extrude(angle=firsthook_angle)


@@ 18,19 18,23 @@ module frontHook(hook_length=50, hook_angle=45) {
                                circle(r=radius);
                }
            }
            translate([0, 8, -9.6])
                cylinder(h=hook_length+9.6, r=radius);
            rotate([-upwards, 0, 0]) {
		    translate([0, 8-thickness, -9.6])
			cylinder(h=hook_length+9.6, r=radius);
		    translate([0, 8, -9.6])
			cylinder(h=hook_length+9.6+thickness*2, r=radius);

            translate([0,8+10,hook_radius-10+hook_length]) {
                union() {
                    rotate([90,180+secondhook_angle,90])
                        rotate_extrude(angle=secondhook_angle)
                            translate([hook_radius,0,0])
                                circle(r=radius);
                    rotate([270-secondhook_angle,0,0])
                        translate([0, 0, -hook_radius])
                            sphere(r=radius);
                }
		    translate([0,8+10-thickness,hook_radius-10+hook_length]) {
			union() {
			    rotate([90,180+secondhook_angle,90])
				rotate_extrude(angle=secondhook_angle)
				    translate([hook_radius,0,0])
					circle(r=radius);
			    rotate([270-secondhook_angle,0,0])
				translate([0, 0, -hook_radius])
				    sphere(r=radius);
			}
		    }
            }
            translate([0, 8, -7.5]) {
                union() {


@@ 58,5 62,5 @@ module frontHook(hook_length=50, hook_angle=45) {

union() {
    backTabs();
    frontHook(hook_length=40);
    frontHook(hook_length=35,  hook_angle=90, thickness=4);
}

A ph-disc.scad => ph-disc.scad +73 -0
@@ 0,0 1,73 @@
//$fn=72;
$fa=0.5;
$fs=0.5;
thickness=3;
topthickness=2;
diff=6.5;

module rounded_square(dim=[10,10], r=1) {
	hull() {
		translate([0, 0, 0]) circle(r=r);
		translate([dim[0]-r, 0, 0]) circle(r=r);
		translate([dim[0]-r, dim[1]-r, 0]) circle(r=r);
		translate([0, dim[1]-r, 0]) circle(r=r);
	}
}

module thing(angle=18.0) {
	rotate(-angle/2) {
		rotate_extrude(angle=angle)
			translate([11, -1, 0])
				square([13.5, thickness+diff+2]);

		hull() {
			translate([13, 0, -1])
				cylinder(h=thickness+diff+2, d=4);
			translate([22.5, 0, -1])
				cylinder(h=thickness+diff+2, d=4);
		}
		rotate(angle) {
			hull() {
				translate([13, 0, -1])
					cylinder(h=thickness+diff+2, d=4);
				translate([22.5, 0, -1])
					cylinder(h=thickness+diff+2, d=4);
			}
		}
	}
}

module slice() {
	difference() {
		intersection() {
			union(){
				square([28, thickness]);
				square([12, thickness+diff]);
				translate([11.25, -6.5])
					circle(r=16);
			}
			square(28);
		}
		square([5, thickness+diff]);
		difference() {
			square([10, thickness+diff-topthickness]);
			translate([8, 5.5]) {
				difference() {
					square(2);
					circle(d=4);
				}
			}
		}

	}
}

difference() {
	rotate_extrude(){
		slice();
	}
	translate([-3.5, 0, -1])
		cube([7, 100, thickness+diff+2]);
	for (i=[0,45,135,180,225,270,315])
		rotate(i) thing();
}

A ph-dome-2.scad => ph-dome-2.scad +56 -0
@@ 0,0 1,56 @@

$fa=1;
$fs=1;

module slice() {
	difference() {
		polygon(points=[
			[0, 0],
			[26.5, 0],
			[26.5, 1],
			[36, 1],
			[36, 10],
			[0, 10]
		]);

		intersection() {
			scale([1, 0.27])
				translate([43.5, 48.5])
					circle(r=45);
			square([37, 12]);
		}
	}

	intersection() {
		translate([27, -49])
			difference() {
				square(50);
				circle(r=50);
			}
		square([36, 10]);
	}

}

module lightSlot(angle=45, distance=20, width=2) {
	rotate(-angle/2)
		rotate_extrude(angle=angle)
			translate([distance, -1, 0])
				polygon(points=[
					[(-width)/2, 0],
					[(-width)/10, 5],
					[width/10, 5],
					[width/2, 0]
				]);
}

slice();

/*difference() {
	rotate_extrude() slice();
	for (i=[0,120,240])
		rotate(i) lightSlot(distance=22, angle=60, width=3);
	for (i=[60,180,300])
		rotate(i) lightSlot(distance=16, angle=60, width=3);
}
*/

A ph-dome-old.scad => ph-dome-old.scad +56 -0
@@ 0,0 1,56 @@

$fa=1;
$fs=1;

module slice() {
	difference() {
		polygon(points=[
			[0,0],
			[25, 0],
			[25, 1],
			[34, 1],
			[34, 10],
			[0, 10]
		]);

		intersection() {
			scale([1, 0.25])
				translate([41.5, 48])
					circle(r=42);
			square([35, 12]);
		}
	}

	intersection() {
		translate([25, -29])
			difference() {
				square(30);
				circle(r=30);
			}
		square([34, 10]);
	}

}

module lightSlot(angle=45, distance=20, width=2) {
	rotate(-angle/2)
		rotate_extrude(angle=angle)
			translate([distance, -1, 0])
				polygon(points=[
					[(-width)/2, 0],
					[(-width)/10, 5],
					[width/10, 5],
					[width/2, 0]
				]);
}

//slice();

difference() {
	rotate_extrude() slice();
	for (i=[0,120,240])
		rotate(i) lightSlot(distance=22, angle=60, width=3);
	for (i=[60,180,300])
		rotate(i) lightSlot(distance=16, angle=60, width=3);
}


A ph-dome.scad => ph-dome.scad +56 -0
@@ 0,0 1,56 @@

$fa=0.5;
$fs=0.5;

module slice() {
	difference() {
		polygon(points=[
			[0, 0],
			[26.5, 0],
			[26.5, 1],
			[36, 1],
			[36, 10],
			[0, 10]
		]);

		intersection() {
			scale([1, 0.27])
				translate([43.5, 48.5])
					circle(r=45);
			square([37, 12]);
		}
	}

	intersection() {
		translate([27, -49])
			difference() {
				square(50);
				circle(r=50);
			}
		square([36, 10]);
	}

}

module lightSlot(angle=45, distance=20, width=2) {
	rotate(-angle/2)
		rotate_extrude(angle=angle)
			translate([distance, -1, 0])
				polygon(points=[
					[(-width)/2, 0],
					[(-width)/10, 5],
					[width/10, 5],
					[width/2, 0]
				]);
}

//slice();

difference() {
	rotate_extrude() slice();
	for (i=[0,120,240])
		rotate(i) lightSlot(distance=22, angle=60, width=3);
	for (i=[60,180,300])
		rotate(i) lightSlot(distance=16, angle=60, width=3);
}


A ph-hue.scad => ph-hue.scad +11 -0
@@ 0,0 1,11 @@
$fa=0.5;
$fs=0.5;

rotate_extrude()
	translate([27, 0])
		polygon(points=[
			[0,0],
			[1, 1.5],
			[11, -1.5],
			[11, -3],
		]);

A ph-lamp.scad => ph-lamp.scad +23 -0
@@ 0,0 1,23 @@

module cyl(height=50) {
    inner=10;
    outer=18;
    opening=8;
    tolerance=0.25;
    difference() {
        cylinder(h=height, d=outer);
        cylinder(h=height, d=inner+tolerance);
        translate([0, -(opening/2), 0])
            cube([outer, opening, height]);
    }
}

cyl(height=80);
translate([0, 20, 0])
    cyl(height=40);
translate([20, 20, 0])
    cyl(height=20);
translate([20, 0, 0])
    cyl(height=10);
translate([40, 0, 0])
    cyl(height=5);
\ No newline at end of file

A rail-vesa-old.scad => rail-vesa-old.scad +55 -0
@@ 0,0 1,55 @@
$fs=0.1;
$fa=0.1;

roundingRadius=5;

module roundedCube(dim, roundingRadius=10) {
    hull() {
        translate([roundingRadius, roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([dim[0]-roundingRadius, dim[1]-roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([roundingRadius, dim[1]-roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([dim[0]-roundingRadius, roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
    }
}

module vesaHoles(width=100, height=100, holeSize=5, depth=10) {
        cylinder(h=depth, d=holeSize);
        translate([width, 0])
            cylinder(h=depth, d=holeSize);
        translate([0, height])
            cylinder(h=depth, d=holeSize);
        translate([width, height])
            cylinder(h=depth, d=holeSize);
}
difference() {
    union() {
        roundedCube([120, 120, 5]);
            translate([0, -60, 0])
                roundedCube([120, 80, 20]);
        hull() {
            translate([0, -30, 0])
                roundedCube([120, 80, 5]);
            difference() {
                translate([0, -30, 17.5+12-5])
                    roundedCube([120, 50, 10]);
                rotate([0, 2.5, 0])
                    translate([-5, -60, 17.5+12+5])
                        cube([130, 120, 12]);
            }
        }
    }
    rotate([0, 2.5, 0])
        translate([-10, -60, 17.5])
            cube([140, 60, 12]);
    translate([10, 10])
        vesaHoles(depth=100, holeSize=4.5);
    translate([10, 10, 10])
        vesaHoles(depth=100, holeSize=10);
    translate([0, -25, -20])
        rotate([0, 90, 0])
            cylinder(r=30, h=120);
}

A rail-vesa.scad => rail-vesa.scad +131 -0
@@ 0,0 1,131 @@
$fs=0.1;
$fa=0.1;

roundingRadius=5;

module triangle(dim, roundingRadius=10) {
    hull() {
        translate([roundingRadius, roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([roundingRadius, dim[1]-roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([dim[0]-roundingRadius, roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
    }
}

module roundedCube(dim, roundingRadius=10) {
    hull() {
        translate([roundingRadius, roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([dim[0]-roundingRadius, dim[1]-roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([roundingRadius, dim[1]-roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
        translate([dim[0]-roundingRadius, roundingRadius])
            cylinder(h=dim[2], r=roundingRadius);
    }
}

module vesaHoles(width=100, height=100, holeSize=5, depth=10) {
        cylinder(h=depth, d=holeSize);
        translate([width, 0])
            cylinder(h=depth, d=holeSize);
        translate([0, height])
            cylinder(h=depth, d=holeSize);
        translate([width, height])
            cylinder(h=depth, d=holeSize);
}

difference() {
    union() {
        triangle([120, 120, 5]);
        translate([120, 0, 0])
            mirror([1, 0, 0])
                triangle([120, 120, 5]);
        difference() {
            translate([0, -30, 0])
                roundedCube([120, 50, 10+17.5+22.5]);

            // Opening for bracket
            rotate([0, 5, 0])
                translate([-10, -60, 17.5+22.5])
                    rotate([0, 90, 0])
                        roundedCube([22.5, 60, 140], roundingRadius=2);

            // Angled cut on top
            rotate([0, 5, 0])
                translate([-10, -40, 30+17.5+22.5])
                    rotate([0, 90, 0])
                        roundedCube([22.5, 80, 140], roundingRadius=2);

// Ribbing under foot
            difference() {
                rotate([0, 5, 0])
                    translate([-10, -60, 30])
                        rotate([0, 90, 0])
                            roundedCube([30, 60, 140], roundingRadius=2);
                for (i=[0:4]) {
                    translate([110/4 * i, -30, 0])
                        cube([10, 30, 50]);
                } 
            }
        }

        // Extended feet
        difference() {
            translate([0, -60, 0])
                roundedCube([120, 80, 20]);

            // Opening for bracket
            rotate([0, 5, 0])
                translate([-10, -70, 17.5+22.5])
                    rotate([0, 90, 0])
                        roundedCube([22.5, 70, 140], roundingRadius=2);

            // Ribbing under foot
            difference() {
                rotate([0, 5, 0])
                    translate([-10, -90, 30])
                        rotate([0, 90, 0])
                            roundedCube([30, 90, 140], roundingRadius=2);
                for (i=[0:4]) {
                    translate([110/4 * i, -60, 0])
                        cube([10, 60, 50]);
                } 
            }
        }

        // Ribbed body
        difference() {
            hull() {
                // Angled cut on top
                 rotate([0, 5, 0])
                    translate([-5, 15, 22.5+10])
                            cube([120, 5, 5]);
                translate([0, 15, 2.5])
                    rotate([0, 90, 0])
                        cylinder(h=120, d=5);
                translate([0, 52.5, 2.5])
                    rotate([0, 90, -5])
                        cylinder(h=120, d=5);
            }
            translate([-5, 0, 0])
                cube([20, 500, 50]);
            translate([20, 0, 0])
                cube([37.5, 500, 50]);
            translate([62.5, 0, 0])
                cube([37.5, 500, 50]);
            translate([105, 0, 0])
                cube([20, 500, 50]);
        }

    }

    // Vesa mounting holes
    translate([10, 10])
        vesaHoles(depth=100, holeSize=4.5);
    translate([10, 10, 10])
        vesaHoles(depth=100, holeSize=14);
}


M skadis-mount.scad => skadis-mount.scad +1 -1
@@ 17,7 17,7 @@ difference() {
}


translate([0, 0, board_depth+wall_dist])
translate([0, 0, board_depth+wall_dist+0.5])
	difference() {
		union() {
			cylinder(h=support_height, d1=support_size, d2=support_size/6*5);

A speaker-foot.scad => speaker-foot.scad +32 -0
@@ 0,0 1,32 @@
$fa=0.5;
$fs=0.1;

union() {
	cylinder(h=5, d=7.5);
	cylinder(h=2.5, d=15);
};

translate([0,16,0]) {
	difference() {
		cylinder(h=0.5, d=15);
		translate([0,0,-0.1])
		cylinder(h=5.25, d=7.5);
	}
};

translate([16,0,0]) {
	difference() {
		cylinder(h=1, d=15);
		translate([0,0,-0.1])
		cylinder(h=5.25, d=7.5);
	}
};

translate([16,16,0]) {
	difference() {
		cylinder(h=2, d=15);
		translate([0,0,-0.1])
		cylinder(h=5.25, d=7.5);
	}
};


A table-adjustment.scad => table-adjustment.scad +22 -0
@@ 0,0 1,22 @@
$fa=0.5;
$fs=0.1;


height=2.5;
rounding=5;

module plate(sideA=45, sideB=45) {
    hull() {
        cube([sideA-rounding,sideB,height]);
        translate([sideA-rounding, sideB-rounding, 0])
            cylinder(h=height, r=rounding);
        translate([sideA-rounding, rounding, 0])
            cylinder(h=height, r=rounding);
    }
}

plate(sideA=45);
translate([0, 50, 0])
    plate(sideA=45);
translate([50, 0, 0])
    plate(sideA=45, sideB=95);

A wall-ring.scad => wall-ring.scad +101 -0
@@ 0,0 1,101 @@
$fn=360;

module wedge(h, r, a, $fn=50)
{
    th=(a%360)/2;
    difference()
    {
        cylinder(h=h,r=r,center=true, $fn=$fn);
        if(th<90)
        {
            for(n=[-1,1])rotate(-th*n)translate([(r+0.5)*n,0,0])
                cube(size=[r*2+1,r*2+1,h+1],center=true);
        }
        else
        {
            intersection()
            {
                rotate(-th)translate([(r+0.5),(r+0.5),0])
                    cube(size=[r*2+1,r*2+1,h+1],center=true);
                rotate(th)translate([-(r+0.5),(r+0.5),0])
                    cube(size=[r*2+1,r*2+1,h+1],center=true);
            }
        }
    }
}

module torus(r1=1, r2=2, angle=360, endstops=0, $fn=50){
    if(angle < 360){
        intersection(){
            rotate_extrude(convexity=10, $fn=$fn)
            translate([r2, 0, 0])
            circle(r=r1, $fn=$fn);

            color("blue")
            wedge(h=r1*3, r=r2*2, a=angle);
        }
    }else{
        rotate_extrude(convexity=10, $fn=$fn)
        translate([r2, 0, 0])
        circle(r=r1, $fn=$fn);
    }

    if(endstops && angle < 360){
        rotate([0,0,angle/2])
        translate([0,r2,0])
        sphere(r=r1);

        rotate([0,0,-angle/2])
        translate([0,r2,0])
        sphere(r=r1);
    }
}

module rounded_cylinder(d=1, h=1, r=0.1, center=true, $fn=100){
    translate([0,0,(center==true)?-h/2:0]){
        union(){
            // bottom edge
            translate([0,0,r])torus(r1=r, r2=(d-r*2)/2, $fn=$fn);
            // top edge
            translate([0,0,h-r])torus(r1=r, r2=(d-r*2)/2, $fn=$fn);
            // main cylinder outer
            translate([0,0,r])cylinder(d=d, h=h-r*2, center=false, $fn=$fn);
            // main cylinder inner
            translate([0,0,0])cylinder(d=d-r*2, h=h, center=false, $fn=$fn);
        }
    }
}


diameter = 33;
depth = 20;
thickness = 4;

difference() {
	union() {
		// Cylinder
		cylinder(h=depth, d=diameter);

		// Top rounding
		rotate_extrude(convexity=10)
			translate([(diameter/2)+1.5, 0, 0])
				union() {
					square(size=[1,6], center=true);
					translate([-0.5, 0, 0])
						circle(r=3);
					translate([0.5, 0, 0])
						circle(r=3);
				}

		// Bottom rounding
		translate([0, 0, depth])
			torus(r2=(diameter/2)+1, r1=3);
	}
	union() {
		difference() {
			cylinder(h=depth+10, d=diameter+10);
			cylinder(h=depth+10, d=diameter);
		}
		cylinder(h=depth+20, d=diameter-thickness);
	}
}