doggie-door/archive/limit-switch-mount.scad
2024-05-15 18:14:51 -07:00

57 lines
1.5 KiB
OpenSCAD

switchHeight = 20;
switchWidth = 12;
switchLength = 20;
switchHoleFromFront = 9; // we assume "front" is the left here, adjust for right
switchHoleFromSide = 5.5;
switchHoleSpacing = 9;
baseWidth = 20;
baseLength = 25;
baseThickness = 2;
slotWidth = 2;
slotLength = 15;
slotCenterFromBack = 11;
slotFromSide = 5.5;
slotSpacing = 9;
filletSize = 5;
$fn=10;
// switch mount
difference(){
cube([switchWidth,switchLength,switchHeight]);
translate([switchHoleFromFront, switchHoleFromSide, 10/2+switchHeight/2+0.1]) {
#cylinder(h=10, r=1, center=true);
}
translate([switchHoleFromFront, switchHoleFromSide+switchHoleSpacing, 10/2+switchHeight/2+0.1]) {
#cylinder(h=10, r=1, center=true);
}
}
// base
translate([0,-baseLength,0]){
difference(){
cube([baseWidth,baseLength,baseThickness]);
translate([slotFromSide,slotCenterFromBack,baseThickness/2]){
cube([slotWidth,slotLength,baseThickness+0.2], center=true);
}
translate([slotFromSide+slotSpacing,slotCenterFromBack,baseThickness/2]){
cube([slotWidth,slotLength,baseThickness+0.2], center=true);
}
}
}
// fillet
translate([0,-filletSize,baseThickness]) {
prism(baseWidth,filletSize,filletSize);
}
module prism(l, w, h){
polyhedron(//pt 0 1 2 3 4 5
points=[[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],
faces=[[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]
);
}