You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

103 lines
2.9 KiB

/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
include<constant.scad>;
include<config.scad>;
use<pcb/amoeba-royale.scad>;
//
// cutout types
//
// C H
// _________ _________
// | | _| |_
// | | |_ _|
// | | _| |_
// | | |_ _|
// |_________| |_________|
//
// V _ _ B _ _
// _| |_| |_ _| |_| |_
// | | _| |_
// | | |_ _|
// | | _| |_
// | | |_ _|
// |_ _ _| |_ _ _|
// |_| |_| |_| |_|
//
switch_cutout(,extra=0.01);
translate([0,0,-switch_holder_height-amoeba_royale_pcb_h-$c])
%amoeba_royale_pcb();
module switch_cutout(extra=0.01) {
h = switch_holder_height;
s_x=switch_dim_x+extra*2;
s_y=switch_dim_y+extra*2;
w=switch_cutout_width;
w2=w + switch_extra_keycap_width*2;
translate([-s_x/2 , -s_y/2,-h])
cube([s_x,s_y,h]);
for(x=[-1,1])
for(y=[-1,1])
translate([x/2 * s_x , y/2 * s_y,-h])
cylinder(d=0.5,h=h);
switch_holder_cuts(switch_cutout_type);
}
module switch_holder_cuts(type="C",borders=[1,1,1,1]) {
w=switch_cutout_width;
w2=w+switch_extra_keycap_width*2;
if (type=="C" || type=="c") {
// nothing
}
if (type=="H" || type=="h") {
// cutout for opening the switch
for(x=[1,0], r=[0,180])
rotate([0,0,r])
mirror([x,0,0])
translate([w/2-$e,w/2-switch_cutout_side_width- switch_cutout_side_offset,-switch_holder_height-$e])
cube([switch_cutout_side_dept+$e,
switch_cutout_side_width,
switch_holder_height +$e*2 ]);
// cut out to reduce place for
// clamp on front/back of switch
for(r=[0,180])
rotate([0,0,r]) {
translate([-6/2,w/2-$e,-switch_holder_height-$e])
cube([6,1.5,switch_holder_height - switch_clamp_height+$e]);
}
// screw cutout for pcb
if(switch_pcb_with_screws==true)
for(y=[1,0])
mirror([0,y,0]) {
translate([-1,9.5,-switch_holder_height-amoeba_royale_pcb_h-$e-m2_head_h]) {
cylinder(d=m2_screw_d,h=amoeba_royale_pcb_screw_h);
cylinder(d=m2_head_d,h=m2_head_h);
}
}
}
if (type=="V" || type =="v") {
rotate([0,0,90])
switch_holder_cuts("H",borders);
}
if (type=="B" || type =="b") {
switch_holder_cuts("V",borders);
switch_holder_cuts("H",borders);
}
}