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.
132 lines
4.1 KiB
132 lines
4.1 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/>.
|
|
*/
|
|
use <switch.scad>;
|
|
use <switch_cutout.scad>;
|
|
use <pcb/amoeba-royale.scad>;
|
|
|
|
include<constant.scad>;
|
|
include<config.scad>;
|
|
|
|
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]);
|
|
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 == "NO" && h == "top") ? [ switch_holder_width/2, switch_holder_width/2,0] :
|
|
(a == "SO" && 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 == "NO" && h == "bot") ? [ switch_holder_width/2, switch_holder_width/2,-switch_holder_height] :
|
|
(a == "SO" && 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 == "O" && 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]);
|
|
}
|