58 lines
No EOL
1.8 KiB
OpenSCAD
58 lines
No EOL
1.8 KiB
OpenSCAD
// Settings
|
|
//
|
|
th = 2;
|
|
cl = 0.4;
|
|
sp = 1;
|
|
fn=32;
|
|
screwOffset = 30.3*2;
|
|
echo(screwOffset);
|
|
screwD = 3.5;
|
|
screwR = screwD/2;
|
|
switchW = 15;
|
|
switchL = 20;
|
|
lockW = switchW + sp*2 + th*2;
|
|
springAngle = 15;
|
|
springTh = th*1.8;
|
|
|
|
lightlock();
|
|
|
|
module lightlock()
|
|
{
|
|
// Springy lock
|
|
translate([lockW/2-th-cl/4,-screwOffset/2,0]) rotate([0,0,springAngle]) translate([0,screwOffset/2,0]) rotate([0,-90,0]) difference()
|
|
{
|
|
hull()
|
|
{
|
|
translate([switchW/2,-switchW/4,0]) cylinder(r=switchW/3, h=springTh, center=true);
|
|
translate([switchW/4,-switchW/4,0]) cube([switchW/2,switchW/2,springTh], center=true);
|
|
translate([th/2,-screwOffset/2,0]) cube([th,springTh,springTh], center=true);
|
|
}
|
|
rotate([0,0,45]) cube([switchW,switchW/2,springTh*3], center=true);
|
|
}
|
|
difference()
|
|
{
|
|
// Main body
|
|
union()
|
|
{
|
|
// Outline
|
|
hull() { for (i=[0:1]) mirror([0,i,0]) translate([0,screwOffset/2,0]) cylinder(r=lockW/2, h=th, $fn=fn); }
|
|
}
|
|
// Screw holes
|
|
for (i=[0:1]) mirror([0,i,0]) translate([0,screwOffset/2,-cl]) cylinder(r1=screwR, r2=screwR*2, h=th+cl*2, center=false);
|
|
// Carveout for spring, switch
|
|
difference()
|
|
{
|
|
union()
|
|
{
|
|
// Cutout for the switch
|
|
translate([th,-screwOffset/4+switchL/4,0]) cube([switchW+th*2, screwOffset/2+switchL/2, th*3], center=true);
|
|
// Cutout for the springy bit around the screw
|
|
translate([0,-screwOffset/2,0]) cylinder(r=screwR*2+th+sp, h=th*3, center=true);
|
|
}
|
|
// But, we still need the area around the screw!
|
|
translate([0,-screwOffset/2,0]) cylinder(r=screwR*2+th, h=th*4, center=true);
|
|
// And a way to connect that to the main body
|
|
translate([-lockW/2,-screwOffset/2-sp,0]) cube([lockW,(screwR*2+th)*2+sp*2,th*3], center=true);
|
|
}
|
|
}
|
|
} |