2017-12-20 00:47:03 -05:00
|
|
|
// kind of a catch-all at this point for any directive that doesn't fit in the other files
|
|
|
|
|
2018-02-06 01:26:19 -05:00
|
|
|
//TODO duplicate def to not make this a special var. maybe not worth it
|
|
|
|
unit = 19.05;
|
|
|
|
|
|
|
|
module translate_u(x=0, y=0, z=0){
|
|
|
|
translate([x * unit, y*unit, z*unit]) children();
|
|
|
|
}
|
|
|
|
|
2020-01-11 23:02:43 -05:00
|
|
|
module no_stem_support() {
|
|
|
|
$stem_support_type = "disable";
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2018-06-30 20:14:49 -04:00
|
|
|
module brimmed_stem_support(height = 0.4) {
|
|
|
|
$stem_support_type = "brim";
|
|
|
|
$stem_support_height = height;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module tined_stem_support(height = 0.4) {
|
|
|
|
$stem_support_type = "tines";
|
|
|
|
$stem_support_height = height;
|
2017-12-20 00:47:03 -05:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2018-09-07 11:39:46 -04:00
|
|
|
module unsupported_stem() {
|
|
|
|
$stem_support_type = "disable";
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2017-12-20 00:47:03 -05:00
|
|
|
module rounded() {
|
|
|
|
$rounded_key = true;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module inverted() {
|
|
|
|
$inverted_dish = true;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module rotated() {
|
2018-06-04 21:13:09 -04:00
|
|
|
$stem_rotation = 90;
|
|
|
|
children();
|
2017-12-20 00:47:03 -05:00
|
|
|
}
|
|
|
|
|
2018-09-05 03:33:42 -04:00
|
|
|
module stabilized(mm=12, vertical = false, type=undef) {
|
2017-12-20 00:47:03 -05:00
|
|
|
if (vertical) {
|
2019-10-12 18:46:31 -04:00
|
|
|
$stabilizer_type = (type ? type : ($stabilizer_type ? $stabilizer_type : "costar_stabilizer"));
|
2018-06-25 00:41:02 -04:00
|
|
|
$stabilizers = [
|
2017-12-20 00:47:03 -05:00
|
|
|
[0, mm],
|
|
|
|
[0, -mm]
|
|
|
|
];
|
|
|
|
|
|
|
|
children();
|
|
|
|
} else {
|
2019-10-12 18:46:31 -04:00
|
|
|
$stabilizer_type = (type ? type : ($stabilizer_type ? $stabilizer_type : "costar_stabilizer"));
|
|
|
|
|
2018-09-05 03:33:42 -04:00
|
|
|
|
2018-06-25 00:41:02 -04:00
|
|
|
$stabilizers = [
|
2017-12-20 00:47:03 -05:00
|
|
|
[mm, 0],
|
|
|
|
[-mm, 0]
|
|
|
|
];
|
|
|
|
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module dishless() {
|
2018-06-30 20:14:49 -04:00
|
|
|
$dish_type = "disable";
|
2017-12-20 00:47:03 -05:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module inset(val=1) {
|
2018-06-04 21:13:09 -04:00
|
|
|
$stem_inset = val;
|
|
|
|
children();
|
2017-12-20 00:47:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
module filled() {
|
2018-06-04 21:13:09 -04:00
|
|
|
$stem_type = "filled";
|
|
|
|
children();
|
2017-12-20 00:47:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
module blank() {
|
2018-06-30 20:14:49 -04:00
|
|
|
$stem_type = "disable";
|
2017-12-20 00:47:03 -05:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2018-06-24 20:26:19 -04:00
|
|
|
module cherry(slop) {
|
|
|
|
$stem_slop = slop ? slop : $stem_slop;
|
2018-02-04 14:33:12 -05:00
|
|
|
$stem_type = "cherry";
|
2017-12-20 00:47:03 -05:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2018-06-24 20:26:19 -04:00
|
|
|
module alps(slop) {
|
|
|
|
$stem_slop = slop ? slop : $stem_slop;
|
2018-02-04 14:33:12 -05:00
|
|
|
$stem_type = "alps";
|
2017-12-20 00:47:03 -05:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2018-06-24 20:26:19 -04:00
|
|
|
module rounded_cherry(slop) {
|
|
|
|
$stem_slop = slop ? slop : $stem_slop;
|
2018-06-27 01:12:43 -04:00
|
|
|
$stem_type = "rounded_cherry";
|
2017-12-20 00:47:03 -05:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2018-06-30 20:14:49 -04:00
|
|
|
module box_cherry(slop) {
|
|
|
|
$stem_slop = slop ? slop : $stem_slop;
|
|
|
|
$stem_type = "box_cherry";
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2017-12-20 00:47:03 -05:00
|
|
|
module flared_support() {
|
|
|
|
$support_type = "flared";
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module bar_support() {
|
|
|
|
$support_type = "bars";
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module flat_support() {
|
|
|
|
$support_type = "flat";
|
|
|
|
children();
|
|
|
|
}
|
2018-02-25 00:21:42 -05:00
|
|
|
|
2018-06-03 20:17:22 -04:00
|
|
|
module legend(text, position=[0,0], size=undef) {
|
|
|
|
font_size = size == undef ? $font_size : size;
|
|
|
|
$legends = [for(L=[$legends, [[text, position, font_size]]], a=L) a];
|
2018-02-25 00:21:42 -05:00
|
|
|
children();
|
|
|
|
}
|
2018-02-25 22:26:27 -05:00
|
|
|
|
2020-02-16 02:23:24 -05:00
|
|
|
module legend_front(text, position=[0,0], size=undef) {
|
|
|
|
font_size = size == undef ? $font_size : size;
|
|
|
|
$legends_front = [for(L=[$legends_front, [[text, position, font_size]]], a=L) a];
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2018-02-25 22:26:27 -05:00
|
|
|
module bump(depth=undef) {
|
|
|
|
$key_bump = true;
|
|
|
|
$key_bump_depth = depth == undef ? $key_bump_depth : depth;
|
|
|
|
children();
|
|
|
|
}
|
2020-01-10 03:07:35 -05:00
|
|
|
|
|
|
|
// kinda dirty, but it works
|
|
|
|
// might not work great with fully sculpted profiles yet
|
|
|
|
module upside_down() {
|
2020-01-31 00:34:22 -05:00
|
|
|
if ($stem_inner_slop != 0) {
|
|
|
|
echo("it is recommended you set inner stem slop to 0 when you use upside_down()");
|
|
|
|
}
|
2020-01-10 03:07:35 -05:00
|
|
|
// $top_tilt*2 because top_placement rotates by top_tilt for us
|
2020-01-11 23:29:40 -05:00
|
|
|
// first rotate 180 to get the keycaps to face the same direction
|
|
|
|
rotate([0,0,180]) top_placement() rotate([180+$top_tilt*2,0,0]) {
|
2020-01-10 03:07:35 -05:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|