forked from riskable/keycap_playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofiles.scad
1670 lines (1646 loc) · 79.3 KB
/
profiles.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Profiles -- Modules that generate keycaps and stems for various profile types (KAT, DSA, SA, etc).
use <keycaps.scad>
use <stems.scad>
use <utils.scad>
// CONSTANTS
KEY_UNIT = 19.05; // Standard spacing between keys
/* NOTES
* These profile-specific modules allow you to override *most* values via arguments. So if you want say, "DCS but with skinnier tops" you could override that via the top_difference argument.
* The row numbering comes from historical values. So don't assume "row 1" is the Fkeys or the spacebar. In a lot of profiles it's all screwed up (e.g. DCS).
* DSA Spec taken from https://pimpmykeyboard.com/template/images/DSAFamily.pdf
* Neat little FYI:
SA = Spherical All-rows
SS = Spherical Sculptured
DSA = DIN-compliant Spherical All-rows
DSS = DIN-compliant Spherical Sculptured
DCS = DIN-compliant Cylindrical Sculptured
* Riskeycap profile is one I developed specifically for ease of 3D printing. It's similar to DSA but has flat sides that make it easier to print on keycaps on their side (so the layer lines run like this: |||) and come off the printer nice and smooth with no sanding required (except maybe to get rid of first layer squish/elephant's foot on the top right and bottom right corners).
*/
// NOTE: Measured dish_depth in multiple DSA keycaps came out to ~.8
// NOTE: Spec says wall_thickness should be 1mm but the default here is 1.35 since this script will mostly be used in 3D printing. Make sure to set it to 1mm if making an injection mold.
module DSA_keycap(row=1, length=18.41, width=18.41, height_extra=0, wall_thickness=1.35, dish_thickness=1, dish_fn=128, dish_corner_fn=64, dish_depth=.8, dish_invert=false, stem_clips=false, stem_walls_inset=0, stem_walls_tolerance=0.25, top_difference=6.08, key_rotation=[0,0,0], corner_radius=0.5, corner_radius_curve=2, legends=[""], legend_font_sizes=[6], legend_fonts=["Roboto"], legend_trans=[[0,0,0]], legend_trans2=[[0,0,0]], legend_rotation=[[0,0,0]], legend_rotation2=[[0,0,0]], legend_scale=[[0,0,0]], legend_underset=[[0,0,0]], legend_carved=false, homing_dot_length=0, homing_dot_width=0, homing_dot_x=0, homing_dot_y=0, homing_dot_z=0, polygon_layers=10, visualize_legends=false, uniform_wall_thickness=false, debug=false) {
// NOTE: The 0-index values are ignored (there's no row 0 in DSA)
row_height = dish_invert ? 6.3914+height_extra : 7.3914+height_extra; // One less if we're generating a spacebar
// NOTE: 7.3914 is from the Signature Plastics DSA spec which has .291 inches
if (row < 1) {
warning("We only support rows 1 for DSA profile caps!");
}
if (row > 1) {
warning("We only support row 1 for DSA profile caps!");
}
// width = 18.41; // 0.725 inches
dish_type = "sphere";
dish_z = 0.111; // NOTE: Width of the top dish (at widest) should be ~12.7mm
top_y = 0;
poly_keycap(
height=row_height, length=length, width=width, wall_thickness=wall_thickness,
top_difference=top_difference, dish_tilt=0, dish_z=dish_z, dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert, top_y=top_y, dish_depth=dish_depth, dish_type=dish_type,
dish_thickness=dish_thickness, corner_radius=corner_radius,
corner_radius_curve=corner_radius_curve,
stem_clips=stem_clips, stem_walls_inset=stem_walls_inset,
legends=legends, legend_font_sizes=legend_font_sizes, legend_fonts=legend_fonts,
legend_trans=legend_trans, legend_trans2=legend_trans2, legend_scale=legend_scale,
legend_rotation=legend_rotation, legend_rotation2=legend_rotation2,
legend_underset=legend_underset, legend_carved=legend_carved,
polygon_layers=polygon_layers, polygon_layer_rotation=0,
polygon_edges=4, polygon_curve=4.5,
key_rotation=key_rotation,
homing_dot_length=homing_dot_length, homing_dot_width=homing_dot_width,
homing_dot_x=homing_dot_x, homing_dot_y=homing_dot_y, homing_dot_z=homing_dot_z,
uniform_wall_thickness=uniform_wall_thickness,
visualize_legends=visualize_legends, debug=debug);
}
// DSA Stems are pretty simple (don't need anything special)
module DSA_stem(stem_type="box_cherry", key_height=7.3914, key_length=18.41, key_width=18.41, height_extra=0, dish_depth=1, dish_fn=128, dish_corner_fn=64, dish_thickness=1, dish_invert=false, depth=4, top_difference=6, wall_thickness=1.35, wall_extra=0.65, wall_inset=0, wall_tolerance=0.25, corner_radius=0.5, key_corner_radius=0.5, top_x=0, top_y=0, outside_tolerance_x=0.2, outside_tolerance_y=0.2, inside_tolerance=0.25, inset=0, top_thickness=0.6, side_support_thickness=0.8, side_supports=[0,0,0,0], flat_support=true, support_distance=0.2, locations=[[0,0,0]], key_rotation=[0,0,0], polygon_layers=10, polygon_layer_rotation=0, hollow=false, uniform_wall_thickness=false) {
dish_type = "sphere";
dish_z = 0.111; // NOTE: Width of the top dish (at widest) should be ~12.7mm
// adjusted_dish_depth = dish_invert ? 0.5 : dish_depth; // Make it a smaller for inverted dishes
corner_radius_curve = 2;
if (stem_type == "box_cherry") {
stem_box_cherry(
key_height=key_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
dish_z=dish_z,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=4.5,
depth=depth,
dish_tilt=0,
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
corner_radius_curve=corner_radius_curve,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "round_cherry") {
stem_round_cherry(
key_height=key_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_z=dish_z,
polygon_layers=polygon_layers,
polygon_curve=4.5,
dish_invert=dish_invert,
dish_type=dish_type,
depth=depth, dish_tilt=0,
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
corner_radius_curve=corner_radius_curve,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance=outside_tolerance_x,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "alps") {
stem_alps(
key_height=key_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
dish_z=dish_z,
polygon_layers=polygon_layers,
polygon_curve=4.5,
dish_type=dish_type,
key_corner_radius=key_corner_radius,
corner_radius_curve=corner_radius_curve,
depth=depth, dish_tilt=0,
top_thickness=top_thickness,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
hollow=hollow,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "stem_top") {
stem_top(
key_height=key_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
dish_z=dish_z,
polygon_layers=polygon_layers,
polygon_curve=4.5,
corner_radius_curve=corner_radius_curve,
dish_tilt=0,
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
key_rotation=key_rotation,
uniform_wall_thickness=uniform_wall_thickness);
}
}
// NOTE: dish_thickness gets *added* to the default thickness of this profile which is approximately 1mm (depending on the keycap). This is to prevent a low dish_thickness value from making an unusable keycap
module DCS_keycap(row=2, length=18.15, width=18.15, height_extra=0, wall_thickness=1.35, dish_thickness=0.6, dish_fn=128, dish_corner_fn=64, dish_invert=false, stem_clips=false, stem_walls_inset=0, stem_walls_tolerance=0.25, top_difference=6, key_rotation=[0,0,0], corner_radius=0.5, corner_radius_curve=0, legends=[""], legend_font_sizes=[6], legend_fonts=["Roboto"], legend_trans=[[0,0,0]], legend_trans2=[[0,0,0]], legend_rotation=[[0,0,0]], legend_rotation2=[[0,0,0]], legend_scale=[[0,0,0]], polygon_layers=20, legend_underset=[[0,0,0]], legend_carved=false, homing_dot_length=0, homing_dot_width=0, homing_dot_x=0, homing_dot_y=0, homing_dot_z=0, visualize_legends=false, uniform_wall_thickness=false, debug=false) {
// NOTE: The 0-index values are ignored (there's no row 0 in DCS)
row_height = [
0, 9.5, 7.39, 7.39, 9, 12.5
];
dish_tilt = [
0, -1, 3, 7, 16, -6
];
dish_z = [ // Dish needs to cut into the top a unique amount depending on the height and angle
0, -0.11, -0.38, -0.78, 0.6, -0.75
];
dish_thicknesses = [
0, 1.2, 1.6, 2, 3, 2
];
adjusted_dish_thickness = dish_thicknesses[row] + dish_thickness;
if (row < 1) {
warning("We only support rows 1-5 for DCS profile caps!");
}
row = row < 6 ? row : 5; // We only support rows 0-4 (5 total rows)
dish_type = "cylinder";
dish_depth = 1;
top_y = -1.75;
poly_keycap(
height=row_height[row]+height_extra, length=length, width=width,
wall_thickness=wall_thickness,
top_difference=top_difference, dish_tilt=dish_tilt[row], dish_z=dish_z[row],
top_y=top_y, dish_depth=dish_depth, dish_type=dish_type,
stem_clips=stem_clips, stem_walls_inset=stem_walls_inset,
dish_thickness=adjusted_dish_thickness, dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn, dish_invert=dish_invert,
legends=legends, legend_font_sizes=legend_font_sizes, legend_fonts=legend_fonts,
legend_trans=legend_trans, legend_trans2=legend_trans2, legend_scale=legend_scale,
legend_rotation=legend_rotation, legend_rotation2=legend_rotation2,
legend_underset=legend_underset, legend_carved=legend_carved,
corner_radius=corner_radius, corner_radius_curve=corner_radius_curve,
polygon_layers=polygon_layers, polygon_layer_rotation=0, polygon_edges=4,
homing_dot_length=homing_dot_length, homing_dot_width=homing_dot_width,
homing_dot_x=homing_dot_x, homing_dot_y=homing_dot_y, homing_dot_z=homing_dot_z,
uniform_wall_thickness=uniform_wall_thickness,
key_rotation=key_rotation, debug=debug);
}
// DCS stems are a pain in the ass so they need their own special fidding...
// TODO: Fix DCS it's all screwed up
module DCS_stem(row=2, stem_type="box_cherry", key_length=18.15, key_width=18.15, height_extra=0, depth=4, top_difference=6, wall_thickness=1.35, wall_extra=0.65, wall_inset=0, wall_tolerance=0.25, corner_radius=0.5, key_corner_radius=0.5, top_x=0, top_y=-1.75, outside_tolerance_x=0.2, outside_tolerance_y=0.2, inside_tolerance=0.25, inset=0, dish_thickness=0.6, dish_invert=false, dish_fn=32, dish_corner_fn=64, top_thickness=0.6, polygon_layers=10, side_support_thickness=0.8, side_supports=[0,0,0,0], flat_support=true, support_distance=0.2, locations=[[0,0,0]], key_rotation=[0,0,0], hollow=false, uniform_wall_thickness=false) {
row_height = [
0, 9.5, 7.39, 7.39, 9, 12.5
];
dish_thicknesses = [
0, 1.2, 1.6, 2, 4, 2
];
dish_tilt = [
0, -1, 3, 7, 16, -6
];
dish_z = [ // Dish needs to cut into the top a unique amount depending on the height and angle
0, -0.11, -0.38, -0.78, 0.6, -0.75
];
if (row < 1) {
warning("We only support rows 1-5 for DCS profile caps!");
}
dish_type = "cylinder";
row = row < 6 ? row : 5; // We only support rows 0-4 (5 total rows)
adjusted_dish_thickness = dish_thicknesses[row] + dish_thickness;
dish_depth = 1;
if (stem_type == "box_cherry") {
stem_box_cherry(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=adjusted_dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
depth=depth,
dish_tilt=dish_tilt[row],
dish_z=dish_z[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "round_cherry") {
stem_round_cherry(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=adjusted_dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
depth=depth,
dish_tilt=dish_tilt[row],
dish_z=dish_z[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance=outside_tolerance_x,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "alps") {
stem_alps(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=adjusted_dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
depth=depth,
dish_tilt=dish_tilt[row],
dish_z=dish_z[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
hollow=hollow,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "stem_top") {
stem_top(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=adjusted_dish_thickness,
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
dish_tilt=dish_tilt[row],
dish_z=dish_z[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
key_rotation=key_rotation,
uniform_wall_thickness=uniform_wall_thickness);
}
}
module DSS_keycap(row=1, length=18.24, width=18.24, height_extra=0, wall_thickness=1.35, dish_thickness=1.8, dish_fn=128, dish_corner_fn=64, dish_invert=false, stem_clips=false, stem_walls_inset=0, stem_walls_tolerance=0.25, top_difference=5.54, key_rotation=[0,0,0], corner_radius=0.75, corner_radius_curve=1.5, legends=[""], legend_font_sizes=[6], legend_fonts=["Roboto"], legend_trans=[[0,0,0]], legend_trans2=[[0,0,0]], legend_rotation=[[0,0,0]], legend_rotation2=[[0,0,0]], legend_scale=[[0,0,0]], polygon_layers=20, legend_underset=[[0,0,0]], legend_carved=false, homing_dot_length=0, homing_dot_width=0, homing_dot_x=0, homing_dot_y=0, homing_dot_z=0, visualize_legends=false, uniform_wall_thickness=false, debug=false) {
// NOTE: The 0-index values are ignored (there's no row 0 in DSS)
row_height = [
0, 10.4, 8.7, 8.5, 10.6
];
adjusted_row_height = dish_invert ? row_height[row]+height_extra-1 : row_height[row]+height_extra; // One less if we're generating a spacebar (which is always row 3 with DSS)
dish_tilt = [
0, -1, 3, 8, 16
];
dish_y = [ // Dish needs to cut into the top a unique amount depending on the height and angle
0, 1.2, -2.5, -5.7, -11.4
];
dish_z = [ // Dish needs to cut into the top a unique amount depending on the height and angle
0, 0, 0, 0, -1.1
];
dish_thicknesses = [
0, 2.5, 2.5, 2.5, 3.5
];
if (row < 1) {
warning("We only support rows 1-4 for DSS profile caps!");
}
row = row < 5 ? row : 4; // We only support rows 1-4 (4 total rows)
dish_type = "sphere";
dish_depth = 1;
top_y = 0;
poly_keycap(
height=adjusted_row_height, length=length, width=width,
wall_thickness=wall_thickness,
top_difference=top_difference, dish_tilt=dish_tilt[row],
dish_z=dish_z[row], dish_y=dish_y[row],
top_y=top_y, dish_depth=dish_depth, dish_type=dish_type,
stem_clips=stem_clips, stem_walls_inset=stem_walls_inset,
dish_thickness=dish_thicknesses[row], dish_fn=dish_fn, dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
legends=legends, legend_font_sizes=legend_font_sizes, legend_fonts=legend_fonts,
legend_trans=legend_trans, legend_trans2=legend_trans2, legend_scale=legend_scale,
legend_rotation=legend_rotation, legend_rotation2=legend_rotation2,
legend_underset=legend_underset, legend_carved=legend_carved,
corner_radius=corner_radius, corner_radius_curve=corner_radius_curve,
polygon_layers=polygon_layers, polygon_layer_rotation=0, polygon_edges=4,
polygon_curve=4,
homing_dot_length=homing_dot_length, homing_dot_width=homing_dot_width,
homing_dot_x=homing_dot_x, homing_dot_y=homing_dot_y, homing_dot_z=homing_dot_z,
uniform_wall_thickness=uniform_wall_thickness,
key_rotation=key_rotation, debug=debug);
}
module DSS_stem(row=2, stem_type="box_cherry", key_length=18.24, key_width=18.24, height_extra=0, depth=4, top_difference=5.54, wall_thickness=1.35, wall_extra=0.65, wall_inset=0, wall_tolerance=0.25, dish_fn=128, dish_corner_fn=64, corner_radius=0.5, key_corner_radius=0.5, top_x=0, top_y=0, outside_tolerance_x=0.2, outside_tolerance_y=0.2, inside_tolerance=0.25, inset=0, dish_thickness=0.6, dish_invert=false, dish_fn=128, top_thickness=0.6, side_support_thickness=0.8, side_supports=[0,0,0,0], flat_support=true, support_distance=0.2, locations=[[0,0,0]], key_rotation=[0,0,0], polygon_layers=10, hollow=false, uniform_wall_thickness=false) {
row_height = [
0, 10.4, 8.7, 8.5, 10.6
];
adjusted_row_height = dish_invert ? row_height[row]+height_extra-1 : row_height[row]+height_extra; // One less if we're generating a spacebar (which is always row 3 with DSS)
dish_tilt = [
0, -1, 3, 8, 16
];
dish_y = [ // Dish needs to cut into the top a unique amount depending on the height and angle
0, 1.2, -2.5, -5.7, -11.4
];
dish_z = [ // Dish needs to cut into the top a unique amount depending on the height and angle
0, 0, 0, 0, -1.1
];
dish_thicknesses = [
0, 2.5, 2.5, 2.5, 3.5
];
if (row < 1) {
warning("We only support rows 1-5 for DCS profile caps!");
}
row = row < 6 ? row : 5; // We only support rows 0-4 (5 total rows)
dish_type = "sphere";
dish_depth = 1;
if (stem_type == "box_cherry") {
stem_box_cherry(
key_height=adjusted_row_height,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thicknesses[row],
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=4,
dish_z=dish_z[row],
dish_y=dish_y[row],
depth=depth,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "round_cherry") {
stem_round_cherry(
key_height=adjusted_row_height,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thicknesses[row],
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=4,
dish_z=dish_z[row],
dish_y=dish_y[row],
depth=depth,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance=outside_tolerance_x,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "alps") {
stem_alps(
key_height=adjusted_row_height,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thicknesses[row],
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
dish_z=dish_z[row],
dish_y=dish_y[row],
polygon_layers=polygon_layers,
polygon_curve=4,
corner_radius=corner_radius,
depth=depth,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
hollow=hollow,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "stem_top") {
stem_top(
key_height=adjusted_row_height,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thicknesses[row],
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
dish_z=dish_z[row],
dish_y=dish_y[row],
polygon_layers=polygon_layers,
polygon_curve=4,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
key_rotation=key_rotation,
uniform_wall_thickness=uniform_wall_thickness);
}
}
/* NOTES
So here's the deal with the KAT profile: The *dishes* are accurately-placed but the curve that goes up the side of the keycap (front and back) isn't *quite* right because whoever modeled the KAT profile probably started with DSA and then extruded/moved things up/down and forwards/backwards a bit until they had what they wanted. This makes generating these keycaps via an algorithm difficult. Having said that the curve is quite close to the original and you'd have to look *very* closely to be able to tell the difference in real life. As long as the dishes are in the right place that's what matters most.
*/
module KAT_keycap(row=1, length=18.2, width=18.2, height_extra=0, wall_thickness=1.658, dish_thickness=1.658, dish_fn=128, dish_corner_fn=64, dish_depth=0.75, dish_invert=false, stem_clips=false, stem_walls_inset=0, stem_walls_tolerance=0.25, top_difference=6.5, key_rotation=[0,0,0], corner_radius=0.35, corner_radius_curve=2.75, legends=[""], legend_font_sizes=[6], legend_fonts=["Roboto"], legend_trans=[[0,0,0]], legend_trans2=[[0,0,0]], legend_rotation=[[0,0,0]], legend_rotation2=[[0,0,0]], legend_scale=[[0,0,0]], legend_underset=[[0,0,0]], legend_carved=false, homing_dot_length=0, homing_dot_width=0, homing_dot_x=0, homing_dot_y=0, homing_dot_z=0, polygon_layers=10, visualize_legends=false, uniform_wall_thickness=false, debug=false) {
// FYI: I know that the curve up the side of the keycap is a little off... If anyone knows how to calculate the correct curve for KAT profile let me know and I'll fix it!
if (row < 1) {
warning("We only support rows 1-5 for KAT profile caps!");
}
if (row > 5) {
warning("We only support rows 1-5 for KAT profile caps!");
}
// NOTE: KAT profile actually mandates 1.658mm wall thickness but I'm not going to force the user to use that
// NOTE: The 0-index values are ignored (there's no row 0 in KAT)
row_height = [
0, 10.95, 9.15, 10.9, 11.9, 13.8
]; // R1 R2 R3 R4 R5
dish_tilt = [
0, -5, -0.5, 4.5, 1.95, 7.5
];
dish_y = [
0, 4, 0.25, -3.75, -1.65, -6
];
top_y = [
0, 0.75, 0.75, 0.75, 0.65, 0
];
dish_z = [
0, -0.25, 0, -0.25, -0.25, -0.5
];
// Official KAT keycaps have a cylindrical dish when inverted:
dish_type = dish_invert ? "cylinder" : "sphere";
poly_keycap(
height=row_height[row]+height_extra, length=length, width=width,
wall_thickness=wall_thickness,
top_difference=top_difference, dish_tilt=dish_tilt[row],
dish_y=dish_y[row], dish_z=dish_z[row], dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert, top_y=top_y[row], dish_depth=dish_depth, dish_type=dish_type,
dish_thickness=dish_thickness, corner_radius=corner_radius,
corner_radius_curve=corner_radius_curve,
stem_clips=stem_clips, stem_walls_inset=stem_walls_inset,
legends=legends, legend_font_sizes=legend_font_sizes, legend_fonts=legend_fonts,
legend_trans=legend_trans, legend_trans2=legend_trans2, legend_scale=legend_scale,
legend_rotation=legend_rotation, legend_rotation2=legend_rotation2,
legend_underset=legend_underset, legend_carved=legend_carved,
polygon_layers=polygon_layers, polygon_layer_rotation=0,
polygon_edges=4, polygon_curve=7,
key_rotation=key_rotation,
homing_dot_length=homing_dot_length, homing_dot_width=homing_dot_width,
homing_dot_x=homing_dot_x, homing_dot_y=homing_dot_y, homing_dot_z=homing_dot_z,
uniform_wall_thickness=uniform_wall_thickness,
visualize_legends=visualize_legends, debug=debug);
}
// NOTE: I double-checked and KAT profile stems really *do* go all the way to the floor! They're not inset at all (which is different)!
module KAT_stem(row=1, stem_type="box_cherry", key_height=9.15, key_length=18.2, key_width=18.2, height_extra=0, dish_depth=0.75, dish_fn=128, dish_corner_fn=64, dish_thickness=1.658, dish_invert=false, depth=4, top_difference=6, wall_thickness=1.658, wall_extra=0.65, wall_inset=0, wall_tolerance=0.25, corner_radius=0.5, key_corner_radius=0.35, top_x=0, top_y=0, outside_tolerance_x=0.2, outside_tolerance_y=0.2, inside_tolerance=0.25, inset=0, top_thickness=0.6, side_support_thickness=0.8, side_supports=[0,0,0,0], polygon_layers=10, flat_support=true, support_distance=0.2, locations=[[0,0,0]], hollow=false, key_rotation=[0,0,0], uniform_wall_thickness=false) {
if (inset > 0) {
warning("FYI: Official KAT profile keycaps don't have an inset stem. The stems go all the way to the floor (but you don't have to do that if you don't want).");
}
// NOTE: These much match KAT_keycap()
row_height = [
0, 10.95, 9.15, 10.9, 11.9, 13.8
]; // R1 R2 R3 R4 R5
dish_tilt = [
0, -5, -0.5, 4.5, 1.95, 7.5
];
kat_top_y = [
0, 0.75, 0.75, 0.75, 0.65, 0
];
dish_y = [
0, 4, 0.25, -3.75, -1.65, -6
];
dish_z = [
0, -0.25, 0, -0.25, -0.25, -0.5
];
// Official KAT keycaps have a cylindrical dish when inverted:
dish_type = dish_invert ? "cylinder" : "sphere";
if (stem_type == "box_cherry") {
stem_box_cherry(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=7,
dish_y=dish_y[row],
dish_z=dish_z[row],
depth=depth,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
corner_radius=corner_radius,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=kat_top_y[row],
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "round_cherry") {
stem_round_cherry(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=7,
dish_y=dish_y[row],
dish_z=dish_z[row],
depth=depth,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=kat_top_y[row],
outside_tolerance=outside_tolerance_x,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "alps") {
stem_alps(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
dish_y=dish_y[row],
dish_z=dish_z[row],
polygon_layers=polygon_layers,
polygon_curve=7,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
depth=depth,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=kat_top_y[row],
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
hollow=hollow,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "stem_top") {
stem_top(
key_height=row_height[row]+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert,
dish_y=dish_y[row],
dish_z=dish_z[row],
polygon_layers=polygon_layers,
polygon_curve=7,
dish_tilt=dish_tilt[row],
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=kat_top_y[row],
key_rotation=key_rotation,
uniform_wall_thickness=uniform_wall_thickness);
}
}
module KAM_keycap(row=1, length=18.3, width=18.3, height_extra=0, wall_thickness=1.65, dish_thickness=1, dish_fn=128, dish_corner_fn=64, dish_depth=1, dish_invert=false, stem_clips=false, stem_walls_inset=0, stem_walls_tolerance=0.25, top_difference=6.35, key_rotation=[0,0,0], corner_radius=0.5, corner_radius_curve=1.5, legends=[""], legend_font_sizes=[6], legend_fonts=["Roboto"], legend_trans=[[0,0,0]], legend_trans2=[[0,0,0]], legend_rotation=[[0,0,0]], legend_rotation2=[[0,0,0]], legend_scale=[[0,0,0]], legend_underset=[[0,0,0]], legend_carved=false, homing_dot_length=0, homing_dot_width=0, homing_dot_x=0, homing_dot_y=0, homing_dot_z=0, polygon_layers=10, visualize_legends=false, uniform_wall_thickness=false, debug=false) {
row_height = dish_invert ? 8.05 : 9.05; // One less if we're generating a spacebar
if (row < 1) {
warning("We only support rows 1 for DSA profile caps!");
}
if (row > 1) {
warning("We only support row 1 for DSA profile caps!");
}
dish_type = dish_invert ? "cylinder" : "sphere"; // KAM spacebars actually use cylindrical tops
dish_z = 0;
top_y = 0;
poly_keycap(
height=row_height+height_extra, length=length, width=width,
wall_thickness=wall_thickness,
top_difference=top_difference, dish_tilt=0, dish_z=dish_z, dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
dish_invert=dish_invert, top_y=top_y, dish_depth=dish_depth, dish_type=dish_type,
dish_thickness=dish_thickness, corner_radius=corner_radius,
corner_radius_curve=corner_radius_curve,
stem_clips=stem_clips, stem_walls_inset=stem_walls_inset,
legends=legends, legend_font_sizes=legend_font_sizes, legend_fonts=legend_fonts,
legend_trans=legend_trans, legend_trans2=legend_trans2, legend_scale=legend_scale,
legend_rotation=legend_rotation, legend_rotation2=legend_rotation2,
legend_underset=legend_underset, legend_carved=legend_carved,
polygon_layers=polygon_layers, polygon_layer_rotation=0,
polygon_edges=4, polygon_curve=4.5,
homing_dot_length=homing_dot_length, homing_dot_width=homing_dot_width,
homing_dot_x=homing_dot_x, homing_dot_y=homing_dot_y, homing_dot_z=homing_dot_z,
key_rotation=key_rotation,
uniform_wall_thickness=uniform_wall_thickness,
visualize_legends=visualize_legends, debug=debug);
}
// TODO: Figure out why underset mask (stem_top()) isn't at the correct height with KAM stems
// KAM stems are pretty simple (don't need anything special)
module KAM_stem(stem_type="box_cherry", key_height=9.05, key_length=18.3, key_width=18.3, height_extra=0, dish_depth=1, dish_thickness=1, dish_invert=false, dish_fn=128, dish_corner_fn=64, depth=4, top_difference=6.35, wall_thickness=1.65, wall_extra=0.65, wall_inset=0, wall_tolerance=0.25, corner_radius=0.5, key_corner_radius=0.5, corner_radius_curve=1.5, top_x=0, top_y=0, outside_tolerance_x=0.2, outside_tolerance_y=0.2, inside_tolerance=0.25, inset=0, top_thickness=0.6, side_support_thickness=0.8, side_supports=[0,0,0,0], polygon_layers=10, flat_support=true, support_distance=0.2, locations=[[0,0,0]], key_rotation=[0,0,0], hollow=false, uniform_wall_thickness=false) {
row_height = dish_invert ? 8.05 : 9.05; // One less if we're generating a spacebar
dish_type = dish_invert ? "cylinder" : "sphere"; // KAM spacebars actually use cylindrical tops
dish_z = 0;
if (stem_type == "box_cherry") {
stem_box_cherry(
key_height=row_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=4.5,
depth=depth,
dish_tilt=0,
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
corner_radius_curve=corner_radius_curve,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "round_cherry") {
stem_round_cherry(
key_height=row_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=4.5,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
depth=depth,
dish_tilt=0,
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
corner_radius_curve=corner_radius_curve,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance=outside_tolerance_x,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "alps") {
stem_alps(
key_height=row_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=4.5,
dish_type=dish_type,
dish_fn=dish_fn,
dish_corner_fn=dish_corner_fn,
corner_radius=corner_radius,
corner_radius_curve=corner_radius_curve,
depth=depth,
dish_tilt=0,
top_thickness=top_thickness,
key_corner_radius=key_corner_radius,
wall_thickness=wall_thickness,
wall_extra=wall_extra,
wall_inset=wall_inset,
wall_tolerance=wall_tolerance,
top_x=top_x,
top_y=top_y,
outside_tolerance_x=outside_tolerance_x,
outside_tolerance_y=outside_tolerance_y,
inside_tolerance=inside_tolerance,
inset=inset,
flat_support=flat_support,
support_distance=support_distance,
locations=locations,
key_rotation=key_rotation,
side_support_thickness=side_support_thickness,
side_supports=side_supports,
hollow=hollow,
uniform_wall_thickness=uniform_wall_thickness);
} else if (stem_type == "stem_top") {
stem_top(
key_height=row_height+height_extra,
key_length=key_length,
key_width=key_width,
dish_depth=dish_depth,
dish_thickness=dish_thickness,
top_difference=top_difference,
dish_invert=dish_invert,
polygon_layers=polygon_layers,
polygon_curve=4.5,
dish_type=dish_type,
dish_fn=dish_fn,