doggie-door/limit-switch-mount-sideways.scad
2024-04-03 16:04:36 -07:00

52 lines
1.3 KiB
OpenSCAD

switchHeight = 5;
switchWidth = 12;
switchLength = 20;
switchHoleFromFront = 9; // we assume "front" is the left here, adjust for right
switchHoleFromSide = 5.5;
switchHoleSpacing = 9;
baseWidth = 12;
baseLength = 25;
baseThickness = 2;
slotWidth = 3;
slotLength = 15;
slotCenterFromBack = 11;
slotFromSide = 6;
slotSpacing = 9;
filletSize = 3;
$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);
}
}
}
// 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]]
);
}