/* * 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 . */ use ; use ; use ; include; include; switch($t=0, "none", 4); switch_holder_with_cutouts("V"); if($show_switch_pcb == true) translate([0,0,-switch_holder_height-amoeba_royale_pcb_h-$c]) %amoeba_royale_pcb(); module switch_holder_with_cutouts(type="C") { difference() { switch_holder(borders=[1,1,1,1],thickness=switch_extra_keycap_width, type=type); color("red") switch_cutout(); } } module switch_holder(borders=[0,1,0,0,0],thickness=2.5,type="C") { w=switch_cutout_width; w2=w+thickness*2; //north echo(borders[1]); if(borders[0]==1) translate([-w2/2,w/2,-switch_holder_height]) cube([w2,(w2-w)/2,switch_holder_height]); //south if(borders[1]==1) translate([-w2/2,-(w2-w)/2-w/2,-switch_holder_height]) cube([w2,(w2-w)/2,switch_holder_height]); //east if(borders[2]==1) translate([-(w2-w)/2-w/2,-w2/2,-switch_holder_height]) cube([(w2-w)/2,w2,switch_holder_height]); //west if(borders[3]==1) translate([w/2,-w2/2,-switch_holder_height]) cube([(w2-w)/2,w2,switch_holder_height]); // b if(borders[4]==1) if($switch_with_pcb == false) difference() { translate([-w2/2,-w2/2,-switch_holder_height-1]) cube([w2,w2,1]); // 5. pins color("orange"){ translate([-3.77,2.7,0]) cylinder(d=3,h=100, center=true); translate([2.7,5.2,0]) //steam + top + bottom (measured 5.5) cylinder(d=3,h=100, center=true); translate([0,0,0]) //steam + top + bottom (measured 5.5) cylinder(d=4.1, h=100, center=true); translate([4.95,0,0]) //steam + top + bottom (measured 5.5) cylinder(d=1.8, h=100, center=true); translate([-4.95,0,0]) //steam + top + bottom (measured 5.5) cylinder(d=1.8, h=100, center=true); } } } // returns the coordinates of the switch holder function switch_point(a, h) = ( (a == "NW" && h == "top") ? [-switch_holder_width/2, switch_holder_width/2,0] : (a == "SW" && h == "top") ? [-switch_holder_width/2,-switch_holder_width/2,0] : (a == "NE" && h == "top") ? [ switch_holder_width/2, switch_holder_width/2,0] : (a == "SE" && h == "top") ? [ switch_holder_width/2,-switch_holder_width/2,0] : (a == "NW" && h == "bot") ? [-switch_holder_width/2, switch_holder_width/2,-switch_holder_height] : (a == "SW" && h == "bot") ? [-switch_holder_width/2,-switch_holder_width/2,-switch_holder_height] : (a == "NE" && h == "bot") ? [ switch_holder_width/2, switch_holder_width/2,-switch_holder_height] : (a == "SE" && h == "bot") ? [ switch_holder_width/2,-switch_holder_width/2,-switch_holder_height] : (a == "N" && h == "top") ? [0, switch_holder_width/2,0] : (a == "S" && h == "top") ? [0,-switch_holder_width/2,0] : (a == "E" && h == "top") ? [ switch_holder_width/2,0,0] : (a == "w" && h == "top") ? [-switch_holder_width/2,0,0] : undef ); module switch_connector_brim(borders=[1,1]) { w=switch_holder_width; w2=w+switch_extra_keycap_width*2; //north if(borders[0]==1) translate([-w2/2,w/2+(w2-w)/2,-switch_holder_height]) cube([w2,$e,switch_holder_height]); //south if(borders[0]==-1) translate([-w2/2,-(w2-w)/2-w/2,-switch_holder_height]) cube([w2,$e,switch_holder_height]); //east if(borders[1]==1) translate([-(w2-w)/2-w/2,-w2/2,-switch_holder_height]) cube([$e,w2,switch_holder_height]); //west if(borders[1]==-1) translate([w/2+(w2-w)/2,-w2/2,-switch_holder_height]) cube([$e,w2,switch_holder_height]); }