@@ -17,7 +17,7 @@ use <libraries/scad-utils/lists.scad>
1717use < libraries/scad- utils/shapes.scad>
1818use < libraries/skin.scad>
1919
20- // key shape including dish. used as the ouside and inside shape in hollow_key(). allows for itself to be shrunk in depth and width / height
20+ // key shape including dish. used as the outside and inside shape in hollow_key(). allows for itself to be shrunk in depth and width / height
2121module shape(thickness_difference, depth_difference=0){
2222 dished(depth_difference, $ inverted_dish) {
2323 color ($ primary_color) shape_hull(thickness_difference, depth_difference, $ inverted_dish ? 200 : 0 );
@@ -46,12 +46,13 @@ module minkowski_object() {
4646 }
4747}
4848
49- module envelope(depth_difference=0) {
50- s = 1.5 ;
49+ module envelope(depth_difference=0, extra_floor_depth=0) {
50+ size = 1.5 ;
51+
5152 hull (){
52- cube ([total_key_width( ) * s, total_key_height( ) * s , 0.01 ], center = true );
53+ translate ([ 0 , 0 ,extra_floor_depth]) cube ([key_width_at_progress(extra_floor_depth / $ total_depth ) * size, key_height_at_progress(extra_floor_depth / $ total_depth ) * size , 0.01 ], center = true );
5354 top_placement(SMALLEST_POSSIBLE + depth_difference){
54- cube ([top_total_key_width() * s , top_total_key_height() * s , 0.01 ], center = true );
55+ cube ([top_total_key_width() * size , top_total_key_height() * size , 0.01 ], center = true );
5556 }
5657 }
5758}
@@ -64,12 +65,12 @@ module dished(depth_difference = 0, inverted = false) {
6465 children();
6566 difference (){
6667 union () {
67- // envelope is needed to "fill in" the rest of the keycap
68- envelope(depth_difference);
68+ // envelope is needed to "fill in" the rest of the keycap. intersections with small objects are much faster than differences with large objects
69+ envelope(depth_difference, $ stem_inset );
6970 if (inverted) top_placement(depth_difference) color ($ secondary_color) _dish(inverted);
7071 }
7172 if (! inverted) top_placement(depth_difference) color ($ secondary_color) _dish(inverted);
72- /* %top_placement(depth_difference) _dish(); */
73+ // %top_placement(depth_difference) _dish();
7374 }
7475 }
7576}
@@ -79,6 +80,7 @@ module dished(depth_difference = 0, inverted = false) {
7980module _dish(inverted=$inverted_dish) {
8081 translate ([$ dish_offset_x,0 ,0 ]) color ($ secondary_color)
8182 dish(top_total_key_width() + $ dish_overdraw_width, top_total_key_height() + $ dish_overdraw_height, $ dish_depth, inverted);
83+ // %dish(top_total_key_width() + $dish_overdraw_width, top_total_key_height() + $dish_overdraw_height, $dish_depth, inverted);
8284}
8385
8486// puts its children at each keystem position provided
@@ -239,7 +241,7 @@ module key(inset=false) {
239241 };
240242
241243 if ($ inner_shape_type != "disable" ) {
242- translate ([0 ,0 ,- SMALLEST_POSSIBLE]) {
244+ translate ([0 ,0 ,- SMALLEST_POSSIBLE]) { // avoids moire
243245 inner_total_shape();
244246 }
245247 }
@@ -249,10 +251,12 @@ module key(inset=false) {
249251 };
250252 }
251253
252- // if $stem_inset is less than zero, we add the
254+ // semi-hack to make sure negative inset stems don't poke through the top of the keycap
253255 if ($ stem_inset < 0 ) {
254- stems_and_stabilizers();
255- }
256+ dished(0 , $ inverted_dish) {
257+ stems_and_stabilizers();
258+ }
259+ }
256260}
257261
258262// actual full key with space carved out and keystem/stabilizer connectors
0 commit comments