3d_print/Forester/key.scad

120 lines
3.9 KiB
OpenSCAD

include <BOSL2/std.scad>
include <BOSL2/screws.scad>
h = 6;
hole1 = [27.577,11.178]; // near key
hole2 = [5.8,-18.6]; // the 2 bottom holes
hole3 = [29.1, -18.6];
// hole4 = [12,15]; // new hole
hole4 = hole1; // new hole
$fn=36;
added_size = 0.5;
keyring_t = false;
keyring = [17.5,22,10,5, 2]; // x, y, d1, d2, h
holes = [hole1, hole2, hole3];
difference() {
union() {
// import key
right(17.5 + 1125) fwd(0 + 1125) up(6+3 + 1.35*added_size) yrot(180) translate([-10.5,-17.5,0]) scale([10,10,20/3 + added_size]) import("key_dl/key_Over2.stl");
left(17.5) scale(10) import("key_dl/key_Under.stl");
// cover unneeded empty space
color("blue") translate([8,-12.5 + 0.2,1]) cuboid([12,12.5,5+added_size*0.9], anchor=BOT);
// make a tab so the immobiliser is always in the correct orientation
color("blue") translate([-9,-4.4,0]) cuboid([2,2,6], anchor=BOTTOM);
// cover original hole1
color("red") {
up(1) right(hole1[0]) fwd(hole1[1]) cyl(d=3, h=h-1, anchor=BOT);
left(hole1[0]) fwd(hole1[1]) {
cyl(d=3, h=h, anchor=BOT);
cyl(d1=7, d2=4, h=h/2, anchor=BOT);
}
}
// cover padlock symbols
translate([18,-12,0]) cuboid([30,10,1], anchor=BOT);
// cover key hole
translate([-23,-13,2]) cuboid([20,15,4], anchor=BOT);
translate([-23,-19,2]) cuboid([5,5,4], anchor=BOT);
if(keyring_t) {
back(keyring[1]-1) left(keyring[0]) cuboid([10,4.8,6], anchor=BOT+BACK);
back(keyring[1]-1) right(keyring[0]) cuboid([10,4.8,6.45], anchor=BOT+BACK);
}
}
// add the new hole and nuts to old holes
color("green") for(i=[hole2, hole3, hole4]) {
right(i[0]) fwd(i[1]) {
cyl(d=3.2, h=h+1, anchor=BOT);
cyl(h=h/2, d1=5.5, d2=3, anchor=BOT);
up(2.5) zrot(30) nut("M3,6", thickness=15, anchor=TOP);
}
left(i[0]) fwd(i[1]) cyl(d=3.2, h=h+1, anchor=BOT);
}
// new hole + chamfer
color("green") left(hole4[0]) fwd(hole4[1]) {
difference() {
cyl(h=3*sqrt(2)/2, d1=6, d2=3, anchor=BOT);
up(1.5) cyl(h=h, d=6, anchor=BOT);
}
cyl(h=h+1, d=3.2, anchor=BOT);
}
// widen and shorten battery holder
color("red") translate([-20.575,5.52,3]) {
cyl(d=16.5, h=20, anchor=BOT);
up(1.6) cyl(d=18, h=20, anchor=BOT);
}
// deepen the PCB hole
color("red") translate([17.5,5.3215 + 0.2,0.8]) cuboid([29+1.2,22+1,10], anchor=BOT);
// widen immo hole
color("red") translate([-3.5,-11.25,3]) cuboid([1,14.5,10], anchor=BOT);
// adapt the space for the metal key
up(0.2) right(1) color("red") {
// key shank
translate([-19.675,-25,3.5]) cuboid([8.5,20,3], anchor=BOT);
// key inside fob
translate([-24.45,-16,3.5]) cuboid([18,4.5,3], anchor=BOT);
}
// new padlock symbols
right(9.6) back(10) zrot(180) linear_extrude(0.25) {
text("\uf3c1", font = "Font Awesome 7 Free:style=Solid", halign = "center", valign = "center", size=8);
}
right(26) back(10) zrot(180) linear_extrude(0.25) {
text("\uf023", font = "Font Awesome 7 Free:style=Solid", halign = "center", valign = "center", size=8);
}
back(keyring[1]) if(keyring_t) {
left(keyring[0]) cyl(d=keyring[2], h=10, anchor=BOT, rounding1=-2);
right(keyring[0]) cyl(d=keyring[2], h=10, anchor=BOT, rounding1=-2);
}
}
back(keyring[1]) if(keyring_t) {
left(keyring[0]) up(6) difference() {
cyl(d=keyring[2], h=keyring[4], anchor=TOP, rounding1=1);
cyl(d=keyring[3], h=keyring[4], anchor=TOP, rounding1=-1);
}
right(keyring[0]) up(6.45) difference() {
cyl(d=keyring[2], h=keyring[4], anchor=TOP, rounding1=1);
cyl(d=keyring[3], h=keyring[4], anchor=TOP, rounding1=-1);
}
}