mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2024-11-26 14:54:21 +00:00
118 lines
3.1 KiB
OpenSCAD
118 lines
3.1 KiB
OpenSCAD
include <util.scad>
|
|
include <supports.scad>
|
|
|
|
stem_depth = 240;
|
|
|
|
//whole connector, alps or cherry, trimmed to fit
|
|
module connector(stem_profile, has_brim, slop, support_type){
|
|
echo(slop);
|
|
if (stem_profile == "alps") {
|
|
alps_stem(has_brim, slop);
|
|
} else if (stem_profile == "cherry_rounded") {
|
|
cherry_stem_rounded(has_brim, slop);
|
|
} else if (stem_profile == "cherry") {
|
|
cherry_stem(has_brim, slop, support_type);
|
|
} else if (stem_profile == "filled") {
|
|
filled_stem();
|
|
}
|
|
}
|
|
|
|
|
|
module brim(has_brim) {
|
|
//brim radius. 11 ensconces normal keycap stem in normal keycap
|
|
brim_radius = 6;
|
|
//brim depth
|
|
brim_depth = .3;
|
|
|
|
if (has_brim) color([0,1,0]) cube([brim_radius, brim_radius, brim_depth]);
|
|
}
|
|
|
|
module cherry_stem(has_brim, slop, support_type) {
|
|
stem_width = 7.2 - slop * 2;
|
|
stem_height = 5.5 - slop * 2;
|
|
|
|
vertical_cross_width = 1.25;
|
|
vertical_cross_length = 3.93;
|
|
|
|
horizontal_cross_width = 1.15;
|
|
horizontal_cross_length = 4.03;
|
|
|
|
cross_depth = 4;
|
|
|
|
stem = [stem_width, stem_height];
|
|
vertical_cross = [vertical_cross_width, vertical_cross_length + slop + 12];
|
|
horizontal_cross = [horizontal_cross_length + slop, horizontal_cross_width];
|
|
|
|
translate([0,0,stem_inset]) {
|
|
brim(has_brim);
|
|
difference(){
|
|
linear_extrude(height = stem_depth) {
|
|
roundedSquare(stem, 1, center=true);
|
|
}
|
|
linear_extrude(height = cross_depth) {
|
|
square(vertical_cross, center=true);
|
|
square(horizontal_cross, center=true);
|
|
}
|
|
}
|
|
// flared support
|
|
echo(support_type);
|
|
if (support_type == "flared") {
|
|
cherry_flared(cross_depth, (stem_depth - cross_depth), [stem_width, stem_height]);
|
|
} else if (support_type == "flat") {
|
|
flat(cross_depth, (stem_depth - cross_depth), [stem_width, stem_height]);
|
|
} else if (support_type == "bars") {
|
|
bars(cross_depth, (stem_depth - cross_depth), [stem_width, stem_height]);
|
|
}
|
|
}
|
|
}
|
|
|
|
module cherry_stem_rounded(has_brim, slop) {
|
|
// cross length
|
|
cross_length = 4.4;
|
|
//dimensions of connector
|
|
// outer cross extra length in y
|
|
extra_outer_cross_height = 1.1;
|
|
// dimensions of cross
|
|
// horizontal cross bar width
|
|
horizontal_cross_width = 1.4;
|
|
// vertical cross bar width
|
|
vertical_cross_width = 1.3;
|
|
// cross depth, stem height is 3.4mm
|
|
cross_depth = 4;
|
|
|
|
difference(){
|
|
union(){
|
|
cylinder(
|
|
d = cross_length+extra_outer_cross_height,
|
|
h = stem_depth
|
|
);
|
|
brim(has_brim);
|
|
}
|
|
//the cross part of the steam
|
|
translate([0,0,(cross_depth)/2 + stem_inset]){
|
|
cube([vertical_cross_width,cross_length,cross_depth], center=true );
|
|
cube([cross_length,horizontal_cross_width,cross_depth], center=true );
|
|
}
|
|
}
|
|
}
|
|
|
|
module alps_stem(has_brim, slop){
|
|
cross_depth = 40;
|
|
width = 4.45;
|
|
height = 2.25;
|
|
|
|
base_width = 12;
|
|
base_height = 15;
|
|
|
|
brim(has_brim);
|
|
translate([0,0,cross_depth/2 + stem_inset]){
|
|
cube([width,height,cross_depth], center = true);
|
|
}
|
|
}
|
|
|
|
module filled_stem() {
|
|
// this is mostly for testing. we don't pass the size of the keycp in here
|
|
// so we can't make this work for all keys
|
|
cube(100, center=true);
|
|
}
|