Compare commits

..

229 Commits

Author SHA1 Message Date
Bob 19f0d2faad quick fix spacebar dishes
hull() was not working properly with such a wide bottom shape - since envelope was using a bottom square that was 6.25uX6.25u. that might spell trouble for 2x2 POS keycaps though... this should be changed to a skin() function down the line
2022-11-27 23:25:03 -05:00
Bob 7a5d2f00ab
Merge pull request #173 from bear454/per-legend-fonts
Font can be explicitly set on a legend
2022-10-14 23:52:27 -04:00
Bob 0a29b1bff8
Merge pull request #172 from rsheldiii/fix-iso-sculpting
Add corner and side sculpting to iso_enter
2022-10-14 20:05:02 -04:00
Bob 5be792e270 add corner and side sculpting to iso_enter 2022-10-14 20:01:29 -04:00
Bob b172788ddd
Merge pull request #161 from limitium/master
Align ASA profile with the Akko implementation
2022-10-14 18:30:28 -04:00
Bob bfed8b8779
Merge pull request #169 from RyuKojiro/hhkb
Add HHKB layout
2022-10-14 18:23:49 -04:00
Bob 46833f9e42
Merge pull request #171 from rsheldiii/hex-style
Hex style
2022-10-14 18:21:12 -04:00
Bob 8b0a6c57f1 don't use 3d surface for DSA even though its cool 2022-10-14 18:16:57 -04:00
Bob 6b444fd5d3 don't modify keys.scad 2022-10-14 18:11:12 -04:00
Bob e88a398f7a lots of stuff
* added new hex key shape
* moved corner and side sculpting functions into special variables
* fixed negative inset stems sticking out the top
* added corner smoothing functionality to 3d surface dishes
2022-10-07 12:48:07 -04:00
Daniel Loffgren 1907b87dc5 Add HHKB layout 2022-09-21 22:06:23 -07:00
Daniel Loffgren 1935944ec5 key_types.scad uses stabilized() without including key_transformations.scad 2022-09-21 21:08:29 -07:00
Daniel Loffgren fe960c2f2a key_types.scad uses u functions without including key_sizes.scad 2022-09-21 20:52:14 -07:00
Daniel Loffgren 9665d5d6a0 layout.scad uses thinks like lshift() without including key_types.scad 2022-09-21 20:43:58 -07:00
Daniel Loffgren 7907d2cd4e layout.scad uses u() without including key_sizes.scad 2022-09-20 23:34:30 -07:00
Daniel Loffgren 80c35b04c3 All of the key_profiles use settings without including at least the default settings 2022-09-20 23:33:32 -07:00
Daniel Loffgren 93f883036f functions.scad uses $double_sculpt_radius without including settings.scad 2022-09-20 23:16:28 -07:00
Daniel Loffgren c4b622efc6 All of the key profiles use use side_tilt() without including functions.scad 2022-09-20 23:12:54 -07:00
Daniel Loffgren 4c6dbc4306 layout.scad uses key_transformations.scad for translate_u(), and key_transformations.scad for key_profile() 2022-09-20 22:30:54 -07:00
James Mason 8fdd3dcb43
Font can be explicitly set on a legend
... instead of using one font for all legends. Super handy for using a
clear text font alongside an icon font.
2022-08-31 19:31:48 -07:00
Sergey Belov b0eb0d030c
Update asa.scad
Remove comments
2022-05-16 13:54:59 +03:00
Sergey Belov ca3daeec64
Merge pull request #1 from limitium/fix_asa_profile
Asa profile aligned with the Akko implementation
2022-05-16 13:51:55 +03:00
Sergey Belov 9842ce6ff4
Asa profile aligned with the Akko implementation 2022-05-16 13:51:18 +03:00
Bob ec44ef76de
Merge pull request #155 from rsheldiii/typewriter-style
Typewriter style keys
2022-02-28 02:46:50 -05:00
Bob 19de89dc6e typewriter style keys 2022-02-28 02:45:11 -05:00
Bob 2b8a238f8a TODO.md 2022-02-24 17:50:55 -05:00
Bob ed0c201894
Merge pull request #153 from rsheldiii/3d_surface_upgrades
Use function literals to make surface functions more fun
2022-02-22 21:05:47 -05:00
Bob 703015dc51 use function literals to make surface functions more fun 2022-02-22 21:00:03 -05:00
Bob f0e339966f tweak corner rounding and size on mt3 2022-02-22 20:58:22 -05:00
Bob 263bd8ebbf
Merge pull request #115 from lvisintini/asa-profile
Add new ASA profile (by Akko)
2022-02-22 16:44:52 -05:00
Bob 1c3960aaff
Merge pull request #151 from rsheldiii/v2/backside-frontside
add backside() and fontside() helpers
2022-02-22 16:42:05 -05:00
Bob 4bce68dfbb add backside() and fontside() helpers 2022-02-22 13:11:13 -05:00
Bob dbe5bca1a9
Merge pull request #150 from rsheldiii/v2/resin
Resin settings, some tines support tweaks
2022-02-22 00:39:26 -05:00
Bob 0c9d05e270
Merge pull request #149 from rsheldiii/hipro-and-mt3
Hipro and MT3 profiles
2022-02-22 00:12:26 -05:00
Bob 8ef5bad891 tweaks on mt3/hipro support 2022-02-22 00:04:21 -05:00
Bob 1a8dd314e4
Merge pull request #106 from mrebersv/master
Two new dishes; clone of MT3 profile; second HiPro clone with more accurate dishes
2022-02-21 16:36:24 -05:00
Bob cc8892364c fix minkowski top_placement and additive artisans 2022-02-21 16:34:06 -05:00
Bob 2429384b51 resin settings, some tines support tweaks 2022-02-21 16:02:37 -05:00
Bob 1a10d1e5bc
Merge pull request #124 from Michal-Szczepaniak/patch-1
Fix preonic_default example
2022-02-21 13:30:18 -05:00
Bob 41381ed376
Merge pull request #148 from rsheldiii/v2/propogate-stem-inner-slop
Correctly support $stem_inner_slop
2022-02-21 13:29:28 -05:00
Bob 08f17a4e1f add stem_inner_slop to all places where it is supposed to be 2022-02-21 13:28:36 -05:00
Bob 4766e3eca6
Merge pull request #117 from AberDerBart/master
Fix rounded_cherry stem to properly use $stem_inner_slop
2022-02-21 13:24:19 -05:00
Bob 19cdb2d9ae
Merge pull request #145 from rsheldiii/dependabot/npm_and_yarn/copy-props-2.0.5
Bump copy-props from 2.0.4 to 2.0.5
2022-02-21 13:16:38 -05:00
Bob 75cfa2a856
Merge pull request #147 from rsheldiii/v2/offset-stem-support
V2: Make tine support work for offset stems, remove $extra_long_stem_support
2022-02-21 13:12:24 -05:00
Bob feb9ec6a71 Make tine support work for offset stems
Also remove extra_long_stem_support as it doesn't work with the new
structure
2022-02-21 12:55:52 -05:00
Bob 4ba88df064
Merge pull request #49 from Xuis/InstructionsModification
Added clear instructions for line you should modify
2022-02-21 12:44:24 -05:00
Bob 315bc83039
Merge branch 'master' into InstructionsModification 2022-02-21 12:44:00 -05:00
dependabot[bot] 077de5ac87
Bump copy-props from 2.0.4 to 2.0.5
Bumps [copy-props](https://github.com/gulpjs/copy-props) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/gulpjs/copy-props/releases)
- [Changelog](https://github.com/gulpjs/copy-props/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/copy-props/compare/2.0.4...2.0.5)

---
updated-dependencies:
- dependency-name: copy-props
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-21 17:27:07 +00:00
Bob aad8ddc558
Merge pull request #111 from rsheldiii/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2022-02-21 12:26:10 -05:00
Bob 5ccd4b7f8d
Merge pull request #102 from rsheldiii/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.8.8 to 2.8.9
2022-02-21 12:26:04 -05:00
Bob e35d5d354a
Merge pull request #97 from rsheldiii/dependabot/npm_and_yarn/y18n-3.2.2
Bump y18n from 3.2.1 to 3.2.2
2022-02-21 12:25:57 -05:00
Bob 47f17efcf1 quick iso enter edits 2022-02-20 02:58:45 -05:00
Bob d3001e7da0 missing $ 2022-02-20 02:11:19 -05:00
Bob 378af54056
Merge pull request #135 from rsheldiii/force-iso-enter-render
Force ISO enter to render as it does not show in preview
2022-02-19 21:05:06 -05:00
Bob 397a3b84fc force ISO enter to render as it does not show in preview 2022-02-19 21:01:19 -05:00
Bob 2c85ea5c07 add todo 2022-02-19 20:41:41 -05:00
Bob 6e5955ed8c
Merge pull request #134 from rsheldiii/v2/lexical-scoping-sculpted-fix
V2: Fix lexical scoping in sculpted square in V2.x.x
2022-02-19 20:36:56 -05:00
Bob 065787ee99 fix lexical scoping in sculpted square in V2.x.x 2022-02-19 20:36:26 -05:00
Bob 6f1ae47011
Merge pull request #133 from rsheldiii/v2/g20-spacebar-fix
V2: fix spacebar() assuming sideways_cylindrical
2022-02-19 20:33:57 -05:00
Bob db30aa2066 fix spacebar() assuming sideways_cylindrical 2022-02-19 20:32:57 -05:00
Bob 9b52a91db9
Merge pull request #128 from rsheldiii/v2.0.0
Merging in V2.0.0
2022-02-19 19:20:37 -05:00
Bob 4ad1814d02 regenerate customizer 2022-02-19 19:18:17 -05:00
Bob 2a71b0618b remove TODO from CHANGELOG, should be git issues 2022-02-19 19:17:26 -05:00
Bob 3675509456 re-enable rounded keys, they sometimes work now 2022-02-19 16:02:49 -05:00
Bob b36bf13b3e fix stem helper functions unhelpfully registering 0 stem slop as false 2022-02-19 15:42:36 -05:00
Bob 0d807f3b14 fix stab support and hulled keycaps with stem_support disabled 2022-02-19 15:38:43 -05:00
Bob e8ce3f5c5e account for support stems properly 2022-02-19 15:05:06 -05:00
Bob 75ec333e1f update readme to let ppl know about v2.0.0 2022-02-19 14:57:41 -05:00
Bob f7b5f382fa skin extrude thickness fix 2022-02-19 14:57:31 -05:00
Bob cc336c0c41 cleanup 2022-02-19 14:45:12 -05:00
Bob 8fb65aca70 Merge branch 'master' into v2.0.0 2022-02-19 14:40:29 -05:00
Michał Szczepaniak 38bfbfa61c
Fix preonic_default example 2022-01-11 20:43:41 +01:00
Luis Visintini 2d03e5dd4b Updates made after review by @limitium 2021-11-06 14:02:02 +00:00
Jonas Grosse-Holz 7ee9e61412 Fix rounded_cherry stem to properly use $stem_inner_slop 2021-09-27 20:45:47 +02:00
Luis Visintini 665698771f Add new ASA profile (by Akko) 2021-08-30 13:59:43 +01:00
dependabot[bot] f63de1caf2
Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-12 09:30:58 +00:00
dependabot[bot] c6bae9460c
Bump y18n from 3.2.1 to 3.2.2
Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-25 03:16:47 +00:00
dependabot[bot] 3fb34bc663
Bump hosted-git-info from 2.8.8 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-25 03:16:41 +00:00
Bob ed2ed9c2c7
Merge pull request #108 from rsheldiii/dependabot/npm_and_yarn/yargs-parser-5.0.1
Bump yargs-parser from 5.0.0 to 5.0.1
2021-07-24 23:16:23 -04:00
dependabot[bot] 57da045abb
Bump yargs-parser from 5.0.0 to 5.0.1
Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/yargs/yargs-parser/releases)
- [Changelog](https://github.com/yargs/yargs-parser/blob/v5.0.1/CHANGELOG.md)
- [Commits](https://github.com/yargs/yargs-parser/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: yargs-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-25 03:16:09 +00:00
Bob 3ef9857bc1
Merge pull request #75 from rsheldiii/dependabot/npm_and_yarn/ini-1.3.8
Bump ini from 1.3.5 to 1.3.8
2021-07-24 23:15:34 -04:00
Bob 9c10403421
Merge pull request #101 from superhappychris/patch-1
Fix typo in Printing Help section of README
2021-07-24 23:04:37 -04:00
Bob 1dbd31d697
Merge pull request #100 from mahksy/add-key-sizes
Added 2.5u and 2.75u key widths
2021-07-24 22:58:54 -04:00
Matthew Ebersviller 1f1f6a62d2
Added deep_dish to matty3 profile 2021-07-21 11:52:19 -06:00
Matthew Ebersviller fdce624cb1
Update squared_spherical.scad 2021-07-21 11:51:22 -06:00
Matthew Ebersviller 762e45ba3d
Fixing 60% row offset the correct way 2021-07-21 09:48:08 -06:00
Matthew Ebersviller d7ea2bf7cc
Editing comment for clarity 2021-07-09 12:26:42 -06:00
Matthew Ebersviller 3fca4e26ca Merge branch 'master' of https://github.com/mrebersv/KeyV2 2021-07-09 12:23:37 -06:00
Matthew Ebersviller cdf75654a6 fixing 60 percent layout
60 percent layout needed array of [0] for row 0 (Function keys).  Without it, every row was getting the wrong depth/angle.
2021-07-09 12:22:33 -06:00
Matthew Ebersviller e7b92cf52b
Update squared_scoop.scad
Fixed some formatting to be easier to read
2021-07-09 10:57:06 -06:00
mebers200 29f5cd2468 Fixing squared_scoop dish to work with keycaps other than 1u sizing 2021-07-09 10:41:34 -06:00
mebers200 d3c26dfaca fixing squared_spherical dish to work with all sizes 2021-07-09 10:22:03 -06:00
mebers200 13520c54e3 Adding new dishes, a profile clone of MT3 (Matty3), and a second HiPro clone with more accurate dishes. 2021-07-08 20:30:12 -06:00
superhappychris 3047614d95
Fix typo in Printing Help section of README
The printing help section referred to the `brimmed()` modifier when it should actually be `brimmed_stem_support()`
2021-05-02 13:07:17 -05:00
Mahksy 8d69ec6c21 Added 2.5u and 2.75u key widths 2021-04-08 19:28:43 +02:00
dependabot[bot] 024eb8a7d4
Bump ini from 1.3.5 to 1.3.8
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-12 16:19:31 +00:00
Bob d1fec7e065
Merge pull request #57 from colegleason/add-dss-profile
Add DSS profile based on spec in PDF
2020-10-01 15:21:57 -04:00
Bob a3f1d605c6
Merge pull request #66 from rsheldiii/auto-place
Add slightly disappointing auto-placement functionality
2020-09-30 17:34:15 -04:00
Bob 12c228fbdf Add auto-placement 2020-09-30 17:14:13 -04:00
Bob 33794d3ea9
Merge pull request #65 from rsheldiii/choc-bois-2-choc-men
Add (experimental) Kailh Choc support
2020-09-30 01:53:34 -04:00
Bob 961e940f26 reinstate keys.scad 2020-09-30 01:49:15 -04:00
Bob f2f080a51b Update CHANGELOG.md 2020-09-30 01:35:16 -04:00
Bob dfbd88e065 Update choc for prime time
mostly just tweaks
2020-09-30 01:35:11 -04:00
Bob 35fbe9067e
Merge pull request #59 from melmaliacone/patch-1
Update README.md links
2020-09-29 17:24:39 -04:00
Robert Sheldon b73b9346a4 more tweaks but this is looking less likely 2020-09-29 16:29:41 -04:00
Robert Sheldon 2972f7f322 tweak 2020-09-29 16:29:32 -04:00
Robert Sheldon d4aa75fc14 in implementing choc stem 2020-09-29 16:29:23 -04:00
Bob 55d196448c
Merge pull request #64 from rsheldiii/regular-polygon-shape
Add regular polygon shape
2020-09-29 15:58:11 -04:00
Bob 92c1856712 Increase polygonal tolerance
the caps are a little tight after testing
2020-09-29 15:35:39 -04:00
Bob 78a69feff1 add regular polygon shape
also tweak a few things to get them to work
2020-09-29 15:25:20 -04:00
Bob 8a7a302ac8
Merge pull request #52 from rsheldiii/new-key-structure
key.scad restructuring
2020-09-29 12:05:54 -04:00
Cole Gleason 26f42b7a62 Add DSS profile based on spec in PDF, match other parameters to DSA 2020-09-07 22:07:39 -04:00
Bob d9c9cf776f
Merge pull request #60 from rsheldiii/polyRound-everything
Use polyRound for all skin shapes
2020-08-28 20:38:38 -04:00
Bob 3e76968a03 Use polyRound for all skin shapes
slightly faster it seems!
2020-08-28 10:10:30 -04:00
Mel Cone 6be5f8f644
Update README.md 2020-08-24 21:58:25 -04:00
Bob 2b341af540
Merge pull request #58 from rsheldiii/iso-enter-tweak
Iso enter tweak
2020-08-23 23:30:52 -04:00
Bob 5d36c545a7 Use polyround to round ISO enter
exciting times, my friends
2020-08-23 18:26:11 -04:00
Bob d4321abd40 tweak ISO_enter.scad
backporting some changes I made a while ago on the new key structure branch
2020-08-23 17:42:30 -04:00
Bob 7ee27737c8
Merge pull request #54 from rsheldiii/grid-updates
grid updates
2020-08-23 17:13:48 -04:00
Bob e6dd35fca0 Update linear_extrude.scad
mostly for iso enter
2020-07-21 13:51:04 -04:00
Bob 24e280fe3c quick stem updates
probably best to pass the stem throw to the stems eh?
2020-07-10 00:46:06 -04:00
Bob 5de61f8b04 grid updates 2020-07-09 01:02:27 -04:00
Bob 24c80cb735 Couple tweaks for doubleshot 2020-07-08 13:58:06 -04:00
Bob e29bb46dfa hull fix 2020-06-18 20:33:51 -04:00
Bob 57fbf6044d ISO enter small fix 2020-06-18 17:22:58 -04:00
Bob 2eed004407 skin_rounded_square_fix 2020-06-18 17:22:39 -04:00
Bob 8b4b9ae687 hull_shape_type 2020-06-18 17:22:29 -04:00
Bob c7168eae68 remove unnecessary changes 2020-06-18 16:54:54 -04:00
Bob 69175f08e4
Merge pull request #53 from rsheldiii/cherry-profile
Add cherry profile
2020-06-18 16:14:40 -04:00
Bob f4f595c651 Add cherry profile 2020-06-18 16:11:35 -04:00
Bob c1bbaed9a2 large key.scad restructuring 2020-06-17 14:37:00 -04:00
Will Harris c81889b298
removed more extraneous space for formatting 2020-06-12 16:18:06 -06:00
Will Harris 0a246489ec removed extra space 2020-06-12 16:14:55 -06:00
Will Harris 654874fb5f Added clear instructions to which line you should modify to generate a key
Addition to the README and a slight change in formatting to accommodate
the extra information
2020-06-12 16:07:31 -06:00
Bob fa49ee0c70
Merge pull request #46 from rsheldiii/3d_surface
Add 3d surface beta dish
2020-05-13 00:43:48 -04:00
Bob 9e3f5f4bcd Add 3d surface beta dish 2020-05-12 22:25:51 -04:00
Bob a523c45f4a
Merge pull request #44 from rsheldiii/key-features
Key features are a full feature
2020-05-12 16:46:10 -04:00
Bob b29a5f3c5f
Merge branch 'v2.0.0' into key-features 2020-05-12 16:43:50 -04:00
Bob c7602e2ce9
Merge pull request #45 from rsheldiii/improving-shapes-a-bit
Add rounding facets and more skin shapes
2020-05-12 16:22:38 -04:00
Bob f98c0d4a4f
update link in readme
to point to sha so it's perpetually right, even if I update the code
2020-05-12 14:01:06 -04:00
Bob 18892c02b0 add minkowski facets 2020-05-12 12:02:07 -04:00
Bob 9cb3e12b9b Add rounding facets and more skin shapes 2020-05-12 11:57:40 -04:00
Bob a61411258b break features into their own dir 2020-05-12 10:52:19 -04:00
Bob 0a07212aff fix filled-in stem bug
whoops
2020-05-07 16:52:44 -04:00
Bob e0e225a778
Merge pull request #42 from rsheldiii/no-artisan-inside-key
Difference inside from artisan()
2020-05-07 11:57:27 -04:00
Bob 1174b45788 Difference inside from artisan()
If you are making an artisan with a shape on the outside, it'd be pretty helpful if that shape didn't intrude on the stem or underside of the key
2020-05-07 11:55:16 -04:00
Robert Sheldon 40eb527135 switch to yarn 2020-05-03 12:25:44 -04:00
Bob 654935123e
Update README.md 2020-05-01 18:33:29 -04:00
Bob 9103603067
Merge pull request #41 from rsheldiii/security-fixes
Security fixes
2020-05-01 16:47:52 -04:00
Bob ad70dd8853 Make github stop bellyaching
none of these security updates should affect anyone. I don't use the npm build pipeline anymore, but it just ran a gulp file to recompile stls
2020-05-01 16:47:20 -04:00
Bob 6492259941 Merge branch 'master' of https://github.com/rsheldiii/KeyV2 2020-05-01 16:35:28 -04:00
Bob a32556275f add legends example 2020-05-01 16:35:25 -04:00
Bob aa276f380d
Merge pull request #40 from rsheldiii/examples-extraordinaire
Common use case examples
2020-05-01 16:15:42 -04:00
Bob f5c92c7ec8 Merge branch 'examples-extraordinaire' of https://github.com/rsheldiii/KeyV2 into examples-extraordinaire 2020-05-01 16:13:06 -04:00
Bob 30e82fc442 Add common examples
I want to keep the primary documentation digestible, but there are a lot of common use-cases that are a little tricky to figure out. I'm going to start adding those to the examples directory
2020-05-01 16:12:32 -04:00
Bob cacbcc6d9c Add common examples
I want to keep the primary documentation digestible, but there are a lot of common use-cases that are a little tricky to figure out. I'm going to start adding those to the examples directory
2020-05-01 16:11:37 -04:00
Bob 65b464ed3e
Merge pull request #39 from rsheldiii/colors
Promote colors to first-party
2020-05-01 16:08:09 -04:00
Bob 851ececdb2 Promote colors to first-party
now you can modify the colors used to render different parts of the keycaps! This will be used in some examples to draw ghostly outlines of components.
2020-05-01 16:06:58 -04:00
Bob 67d96391e8
Merge pull request #33 from rsheldiii/flat-sided-keycaps
flat-sided keycaps
2020-05-01 13:11:17 -04:00
Bob 842866e427 Merge branch 'master' into flat-sided-keycaps 2020-05-01 13:06:50 -04:00
Bob 08034be328 Add example 2020-05-01 13:03:55 -04:00
Bob 2172278b72 make sideways() transformation
Also make the keytop width changes less dramatic, by centering them around the center of the sides of the keycap. Now instead of choosing the front or back of the keycap and shrinking / expanding the back or front to fit, we shrink / expand both evenly. This actually cleans up the logic too! hooray.
2020-05-01 12:57:58 -04:00
Bob 8d9785fdf7
Update run descriptions to reflect autogenerated customizer.scad 2020-04-25 11:45:56 -04:00
Bob ab933053c9
Merge pull request #36 from rsheldiii/fix-up-customizer
Fix up custimzer.scad
2020-04-24 21:17:19 -04:00
Bob 45940e8059 Fix up custimzer.scad
also add git post-commit hook to generate it, so I don't have to do this again
2020-04-24 19:51:43 -04:00
Bob 555a7874bf
add ko-fi link
This has been and will remain a passion project of mine. I've always struggled with donation links for, I hope, the same complicated reasons most people would: is bringing money into a hobby worth it, that hobby's "worthiness" to carry a donation link, whether the link gives off a sense of entitlement, etc etc. All that aside, I've really come to appreciate the support from the community - I love encountering uses of KeyV2 in the wild, any PR requests submitted, and some people have said such nice things. Donations for open source projects has a storied history, in my opinion all the more normalized by the recent trend of Twitch subscriptions / patreon / etc. Far be it from me to let my awkwardness stop someone from supporting this project in that way - besides, we're at a point where that money could easily be put back into the project via purchases of keys or switches to implement, or bounties.

So yeah, those are my thoughts on this. Donations are very welcome and super appreciated, and completely voluntary and optional.
2020-04-22 14:12:25 -04:00
Bob 0c1e17c1bb
Make recommendations about running the code more explicit
I _highly_ recommend running the code properly in OpenSCAD, though I'm going to put roadmap enhancements for making this library more accessible to people who don't want to do that.
2020-04-10 18:28:48 -04:00
Bob 8557d19b02 fix negative top tilt keytop tucking 2020-03-21 13:45:49 -04:00
Bob 4b9cb50e48 flat-sided keycaps
make square_shape and rounded_square_shape use trapezoids as their top surface, perfectly shaped so that the sides of the keycap are flat, and can be used as a printing surface
2020-03-20 19:10:24 -04:00
Bob ed1b8841fb
Merge pull request #32 from rsheldiii/nominal-skinned-iso-enter
nominally support skinned ISO enter
2020-03-18 17:40:28 -04:00
Bob b2c8cecd71
Merge pull request #13 from rsheldiii/dependabot/npm_and_yarn/extend-3.0.2
Bump extend from 3.0.1 to 3.0.2
2020-03-17 18:04:05 -04:00
Bob d6adf5669c nominally support skin ISO enter 2020-03-17 17:16:04 -04:00
Bob 321e3fa22f
Merge pull request #30 from rsheldiii/rsheldiii-patch-1
Add GPL V3 license
2020-03-17 11:37:05 -04:00
Bob 549d44b7e2
Add license 2020-03-17 11:29:36 -04:00
Bob 19abd521f2
Merge pull request #27 from ihatemyisp/dual_legend
Dual legends and Dactyl Manuform
2020-03-17 11:25:09 -04:00
IhatemyISP 71a45540f9
Merge branch 'master' into dual_legend 2020-03-07 13:56:49 -05:00
IhatemyISP 251298e2df
Rework dual legends
Use len instead of if dual
2020-03-07 13:54:47 -05:00
Bob 16a6e6c324 Add plate generator
it only generates unibody plates with hull(), but it does a pretty good job!
2020-03-05 13:03:17 -05:00
IhatemyISP 86fab3b4a2
Merge branch 'master' into dual_legend 2020-02-26 21:01:02 -05:00
IhatemyISP aebd17e60a
Deconflicting PR 2020-02-26 20:56:25 -05:00
Bob e87bd2ad49 fix blank() and filled()
not sure where but `depth_difference` for  `shape()` is being left out. defaulting to 0 (which should be fine for a delta variable anyways) fixes the issue
2020-02-25 12:04:05 -05:00
Bob f205359e27 helpful comment 2020-02-22 21:44:59 -05:00
Bob 7bc382ab26 you need this if you're gonna print it
unless you print it upside down, then you can disable it again
2020-02-22 21:38:35 -05:00
Bob 0cbb9167a9
Merge pull request #28 from rsheldiii/examples
Add examples and sa_ergo
2020-02-22 21:33:37 -05:00
Bob 19326150ad quick fix for multimaterial 2020-02-22 21:28:11 -05:00
Bob b05405b2b9 add comments 2020-02-22 21:21:48 -05:00
Bob 2c69695958 Add examples and sa_ergo 2020-02-22 21:11:33 -05:00
IhatemyISP e44186e570
Adding example image
Showing off dual legends
2020-02-16 18:46:56 -05:00
IhatemyISP f5429b330a
Support for dual legends
Adds support for adding front and top legends
2020-02-16 02:23:24 -05:00
IhatemyISP 3f5ca9aa42
Merge branch 'master' into dactyl_manuform_4x6 2020-02-15 16:14:58 -05:00
IhatemyISP 7ea4b8fe8a
Dactyl Manuform 4x6 w/ Legends
Adding layout for legends on Dactyl Manuform 4x6
2020-02-15 15:17:43 -05:00
Ian 48378d5759
Dactyl Manuform 4x6
Initial commit of Dactyl Manuform 4x6 layout
2020-02-15 01:02:23 -05:00
Bob ce2e5855fe quick updates
oem support for full sculpting and planck default full sculpt profile support
2020-02-14 23:20:30 -05:00
Bob f9b1c079d1 Update default.scad 2020-01-31 00:34:37 -05:00
Bob e2f59c8541 Merge branch 'master' of https://github.com/rsheldiii/KeyV2 2020-01-31 00:34:24 -05:00
Bob 9df8fec295 add stem_inner_slop warning
I'm at a bit of a crossroads as without the elephant's foot brought about by printing the keycaps right side up, with no stem inset, I can print these stems with no inner slop and they fit _fantastic_. But we've had slop in the stem for printing right-side-up since inception, so switching  now is probably not a good idea. this warning might be good enough
2020-01-31 00:34:22 -05:00
Bob ba7b44d64d
Update TIPS_AND_TRICKS.md 2020-01-20 15:14:46 -05:00
Bob 8b4b895669 README and TIPS_AND_TRICKS updates 2020-01-12 19:20:38 -05:00
Bob 5ea14af9e9 no double sculpting by default
probably pretty frustrating if you're not into that
2020-01-12 19:20:21 -05:00
Bob e475ee7b6e layouts (mostly) accept children 2020-01-12 19:20:05 -05:00
Bob 9a7740cdfb double_sculpting=false turns off extra height 2020-01-12 19:19:30 -05:00
Bob 44cd516304 Update TIPS_AND_TRICKS.md
doubleshot letters explanation
2020-01-11 23:56:33 -05:00
Bob c2e6caabe6 Create TIPS_AND_TRICKS.md 2020-01-11 23:41:39 -05:00
Bob 8ffad43706
Merge pull request #22 from rsheldiii/front-pacement
Front (AKA side) legends
2020-01-11 23:41:08 -05:00
Bob 48377ee749 Update settings.scad 2020-01-11 23:34:29 -05:00
Bob f6762031db front placement
now you can put labels on the front of keycaps!
2020-01-11 23:32:14 -05:00
Bob 425ae8af34 Layout allows children
now you can do stuff like:

```
gherkin_bump_layout("g20") {
  upside_down() key();
};
```

and it'll work! you still have to specify the profile in the layout itself because row and column are not special variables... hm
2020-01-11 23:31:01 -05:00
Bob cb7a301052 fix upside_down
rotate 180 degrees so the labels are correct
2020-01-11 23:29:40 -05:00
Bob c06b548201 no stem support 2020-01-11 23:02:43 -05:00
Bob 925c6c4819 fix dsa full sculpt 2020-01-11 23:00:54 -05:00
Bob c11e8a653d flat dish
not super useful tbh, but I was testing linear extruded keycaps and I needed them to be cut off correctly
2020-01-11 22:59:30 -05:00
Bob 70df63e145 upside_down()
also g20 fixes
2020-01-10 03:07:35 -05:00
Bob 60c71c4c86 Fix tines poking out 2020-01-10 01:42:17 -05:00
Bob d5a1d17adb add $inset_legend_depth 2020-01-10 01:38:31 -05:00
Bob 2c89a884da break out stem_inner_slop 2020-01-10 01:24:17 -05:00
Bob 60de6b8394
Merge pull request #19 from rsheldiii/full-sculpting-skin-extrusion-and-supports-oh-my
Better full sculpting, preliminary skin extrusion, better supports
2020-01-01 18:58:38 -05:00
Bob f0a7b27e8c Better full sculpting, preliminary skin extrusion, better supports 2020-01-01 18:36:23 -05:00
Bob 0e3e1a9ecb Update readme and welcome banner 2019-12-16 17:20:12 -05:00
Bob 6429f168e1 Layout updates
rediscovered my old keysets file, adapted the functionality to make a flexible base layout tool.

also tweaked double sculpting to generically sculpt to both hands. it works, but it still needs more refinement, and the best layouts are going to be hand-generated anyways
2019-12-16 16:45:03 -05:00
Bob 2ddd7acc8c make double_sculpted default false 2019-12-16 17:38:28 -05:00
Bob 68013d3fad
Merge pull request #15 from rsheldiii/double-sculpted-keycaps
Add double-sculpting
2019-12-16 00:48:21 -05:00
Bob 7a8302fe55 Add double-sculpting 2019-12-16 00:40:43 -05:00
dependabot[bot] d4fd5e898b
Bump extend from 3.0.1 to 3.0.2
Bumps [extend](https://github.com/justmoon/node-extend) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/justmoon/node-extend/releases)
- [Changelog](https://github.com/justmoon/node-extend/blob/master/CHANGELOG.md)
- [Commits](https://github.com/justmoon/node-extend/compare/v3.0.1...v3.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-02 18:34:12 +00:00
Bob 38e30689d4
Merge pull request #11 from rsheldiii/artisan-needs-depth
artisan() needs depth
2019-10-12 23:58:53 -04:00
Bob cbfba43077 artisan() needs depth
also translate([x,y,x]) where _any_ argument is undef silently translates nowhere
2019-10-12 23:56:37 -04:00
Bob 60d92f62a8 Merge branch 'master' of https://github.com/rsheldiii/KeyV2 2019-10-12 18:46:42 -04:00
Bob e05fc69e35 reinstitute stabilizer logic
need to check the blame on this
2019-10-12 18:46:31 -04:00
Bob 6d64b67a5a
Merge pull request #9 from rsheldiii/fix-incorrect-cherry-cross
fix incorrect cherry cross
2019-10-12 18:32:41 -04:00
Bob 9ce5f032c6 fix incorrect cherry cross 2019-10-12 18:29:17 -04:00
96 changed files with 23421 additions and 5631 deletions

1
.tool-versions Normal file
View File

@ -0,0 +1 @@
nodejs 14.1.0

16
CHANGELOG.md Normal file
View File

@ -0,0 +1,16 @@
CHANGELOG:
V2.0.0:
* added $fa values for minkowski and shape - so you can customize how much rounding there is
* rejiggered `key.scad` pipeline for more clarity and less shapes
* implemented "3d_surface" dish - still in beta
* super cool though, you can even change the distribution of points on the surface! just make sure you use monotonically increasing functions
* created "hull" folder to house different ways of creating the overall key shape
* promoted "feature" folder to first-class folder with keytext and switch clearance as new residents
* wrote this changelog!
* implemented `$inner_shape_type`, use "flat" for less geometry or "disable" to make a completely solid key easily. didn't help render rounded keys though
* side-printed keycaps are first class! you can use the `sideways()` modifier to set up sideways keycaps that have flat sides to print on.
* it's much easier to make quick artisans now that the inside of the keycap is differenced from any additive features placed on top
* `$linear_extrude_shape` and `$skin_extrude_shape` retired in favor of `$hull_shape_type`
* added regular_polygon shape and octagonal and hexagonal key profiles
* added beta kailh choc
* Finally got ISO Enter working correctly!

675
LICENSE.md Normal file
View File

@ -0,0 +1,675 @@
### GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
### Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program--to make sure it remains
free software for all its users. We, the Free Software Foundation, use
the GNU General Public License for most of our software; it applies
also to any other work released this way by its authors. You can apply
it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS
#### 0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
#### 1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
#### 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
#### 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
#### 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
- a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- b) The work must carry prominent notices stating that it is
released under this License and any conditions added under
section 7. This requirement modifies the requirement in section 4
to "keep intact all notices".
- c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
#### 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
- c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
"normally used" refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
#### 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
#### 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
#### 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
#### 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
#### 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
#### 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree to
terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
#### 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
#### 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If the
Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free
Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
#### 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
#### 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#### 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively state
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper
mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands \`show w' and \`show c' should show the
appropriate parts of the General Public License. Of course, your
program's commands might be different; for a GUI interface, you would
use an "about box".
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the
GNU Lesser General Public License instead of this License. But first,
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.

111
README.md
View File

@ -1,64 +1,113 @@
# Parametric Mechanical Keycap Library
![Welcome!](assets/welcome.png)
![a slightly askew welcome picture](assets/welcome.png)
This library is a keycap and keyset construction library for mechanical keyboards, written in openSCAD.
Relevant links:
* Thingiverse: https://www.thingiverse.com/thing:2783650
* Shapeways: https://www.shapeways.com/designer/rsheldiii/creations
* Buy me a coffee: https://ko-fi.com/rsheldiii, but only if you want to!
# V2.0.0 Cutover
As of February 19th, 2022, the v2.0.0 branch has been merged into master.
This branch completely rewrote key.scad to be much simpler and faster. If you're just starting out, please use master and report any bugs you find.
If you branched off this repo previously, merging to master will probably break any additions you've made. If you need the prior version of the code for whatever reason, v1.1.0 is master just before the v2.0.0 merge. I will be backporting bugfixes to the v1 branch, so if you see v1.1.1 or higher, use that instead.
## How to run
#### Thingiverse Customizer
#### OpenSCAD Proper (recommended way)
The easiest (though not the best) way to run this program is to boot it up in [Thingiverse's Customizer](https://www.thingiverse.com/apps/customizer/run?thing_id=2783650). Explanations of each option are provided, as well as some default variables. Twiddle the variables to see how the keycap changes!
If you are technically inclined at all, this is definitely the best way to run the code. It's not very hard!
#### OpenSCAD Customizer
First, you'll need OpenSCAD: http://www.openscad.org/downloads.html. I highly recommend installing the development snapshot, as they generally support more features and are relatively stable. Development snapshots are listed in their own section on the downloads page.
If you find that the Thingiverse Customizer is timing out, but you're not technically inclined enough to start programming in OpenSCAD, you can look into [getting OpenSCAD's customizer working](https://github.com/rsheldiii/KeyV2/wiki/Getting-the-OpenSCAD-Customizer-working).
After you have openSCAD installed, you need to download the code and run it. running `git clone https://github.com/rsheldiii/openSCAD-projects.git` if you have git, or downloading [this zip](https://github.com/rsheldiii/openSCAD-projects/archive/master.zip) and extracting the directory should do it.
#### OpenSCAD Proper
To make your own key, all you need to do is open `keys.scad` with openSCAD and modify this line:
First, you'll need OpenSCAD: http://www.openscad.org/downloads.html. I highly recommend installing the development snapshot, as they are much further along than the current stable release (as of writing, 2015.03-3).
```
dcs_row(5) legend("⇪", size=9) key();
```
After you have openSCAD installed, you need to download the code and run it. running `git clone https://github.com/rsheldiii/openSCAD-projects.git` if you have git, or downloading [this zip](https://github.com/rsheldiii/openSCAD-projects/archive/master.zip) and extracting the code should do it. Then all you need to do is open `keys.scad` with openSCAD and you are set! It is possible to edit this project with an external editor by checking off Design => Automatic Reload and Preview in OpenSCAD.
To be whatever you want. For example, this is for a ctrl key on an OEM keyboard:
```u(1.25) oem_row(3) legend("ctrl", size=4.5) key();```
It is possible to edit this project with an external editor by checking off Design => 'Automatic Reload and Preview' in OpenSCAD.
All examples below assume you are running the library on your computer with OpenSCAD.
## Let's Go! I wanna make a custom keycap!
#### OpenSCAD Customizer
At the highest level this library supports Cherry and Alps switches, and has pre-defined key profiles for SA, DSA, DCS, G20 and (some form of) OEM keycaps. `keys.scad` is meant as an entry point for everything but the most technical use. Pre-programmed key profiles can be found at the `key_profiles` directory.
If you're not technically inclined enough to start programming in OpenSCAD (it's easier than you think), you can look into [getting OpenSCAD's customizer working](https://github.com/rsheldiii/KeyV2/wiki/Getting-the-OpenSCAD-Customizer-working).
Every key starts with defaults that are overridden by each function call. The simplest cherry key you can make would be:
`customizer.scad` is auto-generated from the other files in this repository due to a quirk with how OpenSCAD shows customizer settings. It should be perpetually kept up to date, but there may be some bugs. feel free to open an issue if you find one!
#### Thingiverse Customizer
The easiest and buggiest way to run this program is to boot it up in [Thingiverse's Customizer](https://www.thingiverse.com/apps/customizer/run?thing_id=2783650). Explanations of each option are provided, as well as some default variables. Twiddle the variables to see how the keycap changes!
Unfortunately I don't think I can update the Thingiverse customizer without breaking it, so you don't get all the cool new features I've been developing over the past couple years.
## High-level overview
This library supports Cherry and Alps switches, and has pre-defined key profiles for SA, DSA, DCS, G20, Hi-Pro and (some form of) OEM keycaps. `keys.scad` is the entry point for everything but the most technical use. Pre-programmed key profiles can be found in the `key_profiles` directory.
Every key starts with default settings (provided in `settings.scad`) that are overridden by each function call. The simplest key you can make would be:
```
cherry() key();
key();
```
![a bog-standard cherry key](assets/example1.JPG)
which is a bog-standard DCS row 5 keycap. To change key profile or make varying width keys, you can use the row and unit length functions, like so:
which is a bog-standard DCS row 5 (number / function row) keycap. To change how the key is generated, you can modify the settings directly or add predefined modifier functions like so:
```
sa_row(2) 2u() cherry() key();
// directly modified setting
$stem_inset = 1;
// settings changed through modifier function
sa_row(2) 2u() key();
```
You can chain as many modifier functions as you like!
![a 2 unit SA row 2 cherry key](assets/example2.JPG)
## What if I want to customize my keycaps?
## Modifier functions
There is a bevy of supporting functions to customize your keycaps. You can add a brim to more easily print the stem, switch up the stem support type, make 2x2 keycaps for a POS system, add legends, rotate stems, and more. These functions can be found in `key_profiles/`, `key_sizes.scad`, `key_transformations.scad`, and `key_types.scad` currently, and can be referenced directly in `keys.scad`. For a full list of helper functions with explanations, [Check out the wiki!](https://github.com/rsheldiii/KeyV2/wiki/KeyV2-Helper-Documentation)
There is a bevy of supporting functions to customize your keycaps. You can add a brim to more easily print the stem with `brimmed_stem_support`, make 2x2 keycaps with `2u() 2uh()`, add legends, rotate stems, and more. All these functions manipulate the settings available to you in [`settings.scad`](https://github.com/rsheldiii/KeyV2/blob/master/src/settings.scad), though [some of them](https://github.com/rsheldiii/KeyV2/blob/851ececdb297c77bfbcd0a7cb4cdbc5e21970396/src/key_transformations.scad#L128) are quite complex.
These modifier functions can be found in [`key_profiles/`](https://github.com/rsheldiii/KeyV2/blob/master/src/key_profiles) for different keycap profiles, [`key_types.scad`](https://github.com/rsheldiii/KeyV2/blob/master/src/key_types.scad) for predefined settings for common keys (spacebar, left shift, etc), [`key_sizes.scad`](https://github.com/rsheldiii/KeyV2/blob/master/src/key_sizes.scad) for common unit sizes, and [`key_transformations.scad`](https://github.com/rsheldiii/KeyV2/blob/master/src/key_transformations.scad) for everything else. I encourage you to do some sleuthing but for a list of (most) helper functions with explanations, [Check out the wiki!](https://github.com/rsheldiii/KeyV2/wiki/KeyV2-Helper-Documentation)
These modifier functions may not cover every use case; in that case, you may have to write some SCAD yourself.
## Layouts
new to the library and still in a beta state, layouts allows you to generate an entire layout for a keyboard!
It is recommended to print layouts with a brim that extends to the next key.
```
60_percent_default("dcs") key();
```
![a standard 60 percent layout](assets/layout.png)
layouts accept children, so you can use them as a chained function like other modifiers. Be wary of accidentally overriding something the layout does for you though.
#### Example customizations
If you wanted to generate some 2u stabilized keycaps for an Ergodox for instance, you could do something like this:
Let's say you wanted to generate some 2u stabilized keycaps for an Ergodox, you could do something like this:
```
legends = ["Enter", "Escape", "Tab", "Shift"];
for(y=[0:3]) {
translate_u(0,y) 2u() dsa_row() stabilized() cherry() key(inset=true) { keytext(legends[y], [0,0], 6); }
translate_u(0,y) 2u() dsa_row() stabilized() cherry() legend(legends[y], [0,0, 6]) key();
}
```
@ -78,19 +127,21 @@ cherry() key() {
Artisan support also supports _subtracting_ children by doing `key(inset=true) { ... }`, which is super helpful if you want to make keycaps with legends that are not text. The children will be placed just above the middle of the dish as per usual; you will need to translate them downwards (`ex translate([0,0,-1])`) to get them to 'dig in' to the top of the key.
## Tips and tricks
Looking for information or something specific? you could try checking out the [tips and tricks](TIPS_AND_TRICKS.md) section, or the [examples](/examples) directory.
## What if I want to get _really_ technical?
At the base level this library should function well as a key profile design library. by loading up `src/key.scad` (notice no s) you can tweak variables in `src/settings.scad` to prototype your own profiles. There are currently 44 different settings to tweak in `src/settings.scad` including width height and depth of the keycap, dish tilt, top skew, fonts, wall thickness, etc. If you want to see the full list of settings, feel free to browse the file itself: [settings.scad](https://github.com/rsheldiii/KeyV2/blob/master/src/settings.scad) it has lots of comments to help you get started.
### What if I want to get _even_ more technical than that?
Now we're talkin!
This library should be abstract enough to handle new dish types, keystems, and key shapes, in case you want to design your own Typewriter-style keycaps, support buckling spring keyboards or design some kind of triangular dished profile. `src/shapes.scad` `src/stems.scad` and `src/dishes.scad` all have a 'selector' module that should allow you to implement your own creations alongside what already exists in their constituent folders.
At the base level this project should function well as an intensive key profile design library. by loading up `src/key.scad` (notice no s) you can tweak variables in `src/settings.scad` to prototype your own profiles. `key.scad` There are currently ~~44~~ a lot of different settings to tweak in `src/settings.scad` including width height and depth of the keycap, dish tilt, top skew, fonts, wall thickness, etc. If you want to see the full list of settings, feel free to browse the file itself: [settings.scad](https://github.com/rsheldiii/KeyV2/blob/master/src/settings.scad) it has lots of comments to help you get started.
This library should also be abstract enough to handle new dish types, keystems, key layouts, key profiles, and key shapes, in case you want to design your own Typewriter-style keycaps, support buckling spring keyboards or design some kind of triangular dished profile. `src/shapes.scad` `src/stems.scad` and `src/dishes.scad` all have a 'selector' module that should allow you to implement your own creations alongside what already exists in their constituent folders.
If you're interested in this, it may help to read the [Technical Design of a keycap](https://github.com/rsheldiii/KeyV2/wiki/Technical-Design-of-a-Keycap) wiki page.
Here's an example of tweaking the settings and code to make a 'stoinstancep sign' key profile:
Here's an example of tweaking the settings and code to make a 'stop sign' key profile:
In `key_shape()` in `shapes.scad`:
@ -138,7 +189,7 @@ Prints from this library are still challenging, despite all efforts to the contr
1. If your stem isn't fitting in the switch, try upping the slop factor, accessed by giving your keystem function a numeric value (eg `cherry(0.5) key()`). This will lengthen the cross and decrease the overall size of the keystem. The default value is 0.3, and represents millimeters. Note that even if you have a resin printer, you should probably keep the default value; keys printed with 0 slop will barely fit on the stem.
2. If your keystem breaks off the bed mid-print, you can enable a brim by adding the `brimmed()` modifier. This will give a solid base for the keystem to anchor into.
2. If your keystem breaks off the bed mid-print, you can enable a brim by adding the `brimmed_stem_support()` modifier. This will give a solid base for the keystem to anchor into.
3. If you are unsatisfied with the quality of the top surface, you can try printing the keycap on a different surface than the bottom, though it may impact the quality of the stem.
@ -147,6 +198,8 @@ Prints from this library are still challenging, despite all efforts to the contr
That's it, if you have any questions feel free to open an issue or leave a comment on thingiverse!
## TODO:
* replace linear_extrude_shape_hull with skin_extrude_shape_hull or something, to enable concave extrusions
* replace current ISO enter shape with one that works for `skin()`
* generate dishes via math?
moved to [TODO doc](./TODO.md)
## Contributions welcome
My lists of key profiles and layouts are not exhaustive at all, if you want to contribute feel free to make a PR with your changes and we can work together on getting it merged!

73
TIPS_AND_TRICKS.md Normal file
View File

@ -0,0 +1,73 @@
# WIP Tips and Tricks section
just want to make sure I put this here, I'm going to make this a much better document later
## Fully sculpted caps
Fully sculpted keycaps are caps that also tilt inwards / outwards, cupping your fingers a bit.
Most profiles should support this now; you pass in a "column" value after the row value, and the cap will calculate how much extra height and tilt for that column.
the way this works is the program projects a large, imaginary cylinder that it inscribes the top of the keycaps into. Thus, the height and tilt can be tweaked by changing the `$double_sculpt_radius`, which changes the radius of that imaginary cylinder.
At the end of the day though, all the columnular sculpting is doing is adding extra height and y tilt to the top of the key. if you have some other aim than fitting to a cylinder you can control this directly with appropriate changes to `$top_tilt_y` and `$total_depth`, or perhaps changing the `side_tilt()` and `extra_side_tilt_height()` functions in [`functions.scad`](https://github.com/rsheldiii/KeyV2/blob/master/src/functions.scad) which are what the row profiles use.
## skin mode
SA, HiPro and DSA keycaps take _forever_ to render. This is a multifaceted issue that I don't want to get into here, but suffice to say _one_ of the reasons it takes so long is how the keycap is constructed from multiple, smaller slices. OpenSCAD takes more time to render the more objects you have, regardless of how they interact. Enter `$hull_shape_type = "skin"`.
`skin()` is a list comprehension function available [here](https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad). The gist of it is that instead of having x number of keycap slices unioned together, we give `skin()` a set of profiles and it makes a single object out of it for us. This reduces the number of objects per keycap, which makes it easier to render them.
One current limitation of `skin()` is that I suck at math and can't translate [rounded_square](https://github.com/rsheldiii/KeyV2/blob/master/src/shapes/rounded_square.scad) into a function, which means that we miss out on the very nice bowing exhibited on these profiles. once we can translate that to math however, we'll be in business.
## Printing upside down
still in beta, but using `upside_down()` in a method chain will rotate keycaps to be upside down. This makes the stem print better and requires no support, but generally the top of the keycap comes out worse - unless it is flat. Worth noting that you can probably set `$stem_inner_slop` to 0 if you print upside down - elephant's foot is the largest contributor to stems not fitting correctly.
### "doubleshot" letters with a regular printer
While printing upside down, you can do yourself a favor and embed some legends! use code like below:
```
legends = ["F1", "1", "q", "a", "z", ""];
for (x = [0:1:4]) {
translate_u(0,-x) legend(legends[x]) g20_row(3, 0) upside_down() {
$stem_support_type = "disable";
key(true);
dished() {
legends($inset_legend_depth);
}
}
}
```
and comment out either `key(true)` or the whole `dished` segment. This code generates keycaps with inset legends and the legends that fit inside those insets.
Run just the legends through your slicer first and make sure to turn off anything like skirts or brims, it should print your legends in a single layer on your print bed. Leave them there, swap filaments, and then print the rest of the keycaps around them in a different color. The result is pretty impressive. They aren't quite doubleshot, since the main benefit of doubleshots is the plastic goes all the way through the keycap, but they look incredibly impressive for what they are.
### No stem support
If you're printing updside down you'll want to disable stem supports. you can change the `$stem_support_type`, or just use the `no_stem_support()` modifier function
## front print legends and location / font size
still in beta, set `$front_print_legends = true` to have legends print on the front instead of the top of the keycaps.
## Clearance check
doing some funky stuff and want to make sure your keycap won't hit the keyswitch? set `$clearance_check = true` and a red-colored depressed switch will show up in preview, cutting away at what contacts the switch.
## Envelope
the 'envelope' of a keycap is used to clip geometry - most notably the dishing at the top of the keycap. if something doesn't look right, you can drop `%envelope()` right next to `key()` to see if it's the envelope cutting things off:
```
g20_row() legend("Q", [0,0], 3) {
key();
%envelope();
}
```
## stem inset
If you want the more refined top surface that printing upright brings, but you are having a bad time with elephant's foot, you can enable some `$stem_inset` and see if that helps. you'll have to figure out what support works best for you.

13
TODO.md Normal file
View File

@ -0,0 +1,13 @@
TODO:
* implement key_shape_at_progress which allows you to query for the exact 2d outline of the keycap at a given height
* this makes certain functions easier - building the envelope for instance
* requires breaking out shape_slice, and creating a polygon of the skin_shape_slice slices
* dishes add / remove height from keycaps, particularly spherical dishes
* a bandaid solution would be to allow you to modify where the keytop is along the progression of the keycap
* you can't just set a new total_depth because of how width_difference and height_difference work
* the true solution would be to rewrite how the dishes work to make them very graduated at the edges
* implement regular polygon for skin extrusions
* switch to skin-shaped extrusions by default
* kailh choc has a non-square key unit; should I get that working for layouts etc?
* move everything over to layouts requiring a child key
* add an "errors" or "warnings" or "suggestions" echo section in key.scad, right when the key is being made, so the errors don't get lost / repeated

BIN
assets/dual_legends.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
assets/layout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 7.3 MiB

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,8 @@ row = 1; // [5,1,2,3,4,0]
// What does the top of your key say?
legend = "";
$using_customizer = true;
include <src/settings.scad>
include <src/key_sizes.scad>
@ -18,8 +20,7 @@ include <src/key_profiles.scad>
include <src/key_types.scad>
include <src/key_transformations.scad>
include <src/key_helpers.scad>
use <src/key.scad>
include <src/key.scad>
key_profile(key_profile, row) legend(legend) {
key();

32
examples/legends.scad Normal file
View File

@ -0,0 +1,32 @@
include <../includes.scad>
/* here's how to use the legends() command.
The first argument is the legend itself, which can also be a whole string.
The second argument is the "position" of the legend relative to center.
Legends currently have to all be inset or outset at the same time, but you
can have as many of them as you want.
The numbers used are some magic constant, so just fudge them until it looks good.
*/
/* $outset_legends = true; */
legends = [
["a", "b", "c", "d"],
["e", "f", "g", "h"],
["i", "j", "k", "l"],
];
$font_size = 4;
for (x=[0:len(legends)-1]) {
translate_u(x,0) {
legend(legends[x][0], [-1,-1]) {
legend(legends[x][1], [-1,1]) {
legend(legends[x][2], [1,-1]) {
front_legend(legends[x][3]) {
key();
}
}
}
}
}
}

View File

@ -0,0 +1,29 @@
include <../includes.scad>
/* use this file to generate multimaterial models for making keycaps with a
different material for the key top.
This would be great to use with flexible filament, to make squishy-topped
keys.
You don't need a multimaterial printer to use these files since it's hard
height cutoff. You could print the bottom, leave the prints on the bed, and
then print the top in a different material. Be careful though! your start
gcode may crash into the prints.
*/
depth = 1;
// swap the debug()s to render opposite part
/* debug() */ difference() { // intersection() {
key();
top_of_key() {
translate([-total_key_width(),-total_key_height(),-$total_depth - depth]) cube([total_key_width()*2, total_key_height()*2, $total_depth]);
}
}
debug() intersection() {
key();
top_of_key() {
translate([-total_key_width(),-total_key_height(),-$total_depth - depth]) cube([total_key_width()*2, total_key_height()*2, $total_depth]);
}
}

View File

@ -0,0 +1,16 @@
include <../includes.scad>
/* in this example we'll use some openSCAD to generate files for printing inset
legends with a multimaterial printer.
*/
legends = ["F1", "1", "q", "a", "z", ""];
for (x = [0:1:4]) {
translate_u(0,-x) legend(legends[x]) dcs_row(x, 0) {
// swap the debug()s to render opposite part
debug() key(true);
/* debug() */ dished() {
legends($inset_legend_depth);
}
}
}

View File

@ -0,0 +1,6 @@
include <../includes.scad>
// plates are currently generated via the same layout arrays as layouts are.
// just pass the layout to plate() and it'll do it's job using hull().
// still in beta
plate(60_percent_default_layout);

View File

@ -0,0 +1,28 @@
include <../includes.scad>
/* Printing keycaps on their side is an easy way to get a nice, smooth top
surface, with some caveats:
1. one of the sides won't look as good as the other
2. any amount of top tilt makes the sides of the keycap not flat, so we have
to force them to be flat by making the keytop a trapezoid
sideways() does the magic for you.
Note that this won't work at all with side sculpted keycaps, skin_shape_hull,
and double sculpted aka full sculpted keycaps either. Getting it to work with
skin_shape_hull is the easiest, getting it to work with full sculpting is a
lot harder, and side sculpting is obviously impossible by nature
*/
legends = ["F1", "1", "q", "a", "z"];
for (x = [0:4]) {
translate_u(0,-x) dcs_row(x) sideways() front_legend(legends[x], size=5) {
$stem_support_type = "disable";
$dish_type = "disable";
/* $top_tilt = 30; */
union() {
key();
}
}
}

53
examples/sa_ergo.scad Normal file
View File

@ -0,0 +1,53 @@
include <../includes.scad>
/*
In this example, we harness full sculpting and simple_layout to make a set of SA
keys that look a lot like the key wells on a dactyl, dactyl manuform, or kinesis
SA keys render faster with skin_extrude_shape = true, but then they don't get
the nice flaring on the sides... yet.
*/
// to turn on full sculpting
$double_sculpted = true;
// to make the font fit
$font_size = 4;
// change this to make the full sculpting more or less aggressive. 200 is default
$double_sculpt_radius = 200;
// This is the exact column stagger from the dactyl transposed onto the
// rows of the preonic default layout. the second array is for modifying the
// values up or down - making all the 0's -1's would make each key 1mm lower
// for instance. I'd suggest going as low as you can without cutting off any stems
extra_column_height = [5.64, 5.64, 0, -3, 0, 0, 0, 0, 0, -3, 0, 5.64, 5.64] + [0,0,0,0,0,0,0,0,0,0,0,0,0];
// required for double_sculpted_column
row_length = len(preonic_default_layout[0]);
simple_layout(preonic_default_layout) {
// this union is here because, for some reason, you cannot modify special variables
// that are modified in the scope directly above.
union() {
// row declarations treat column 0 as perfectly center, so if we just used
// $column we'd have a ridiculously looking left-leaning keyboard.
// this function transforms the actual column value into a "2hands" column
// value, aka for a board with 2 "keywells", one for each hand
column_value = double_sculpted_column($column, row_length, "2hands");
/* echo("column value", column_value); */
sa_row($row+1, column_value){
// uh oh, now I need two of them...
union() {
// uncomment when prototyping for faster prototypes!
/* $dish_type = "disable"; */
/* $stem_support_type = "disable"; */
// here's where the magic happens and we actually add the extra column height
$total_depth = $total_depth + extra_column_height[$column];
key();
// this generates separate legends for the keys
/* legend(preonic_default_legends[$row][$column]) legends(); */
}
}
}
}

View File

@ -0,0 +1,34 @@
include <../includes.scad>
/* Don't have a multimaterial printer but still want cool "doubleshot" legends?
with a couple tricks, you can! We just have to print upside down with no
dish.
Here's how to use this file:
1. modify it as you see fit
2. render the legends and the keycaps separately
3. run the legends through your 3d printer. make sure they are a single layer
4. LEAVE THEM on the bed
5. change filaments
6. run the keycaps over the legends. MAKE SURE they line up! PrusaSlicer
centers models on the bed
7. voila!
8. use a powder-coated bed for extra points
*/
legends = ["F1", "1", "q", "a", "z", ""];
for (x = [0:1:4]) {
translate_u(0,-x) dcs_row(x, 0) upside_down() legend(legends[x]) {
$dish_type = "disable";
$inset_legend_depth = 0.2; // whatever layer height you use
union() {
// swap the debug()s to render opposite part
debug() key(true);
/* debug() */ dished() {
legends($inset_legend_depth);
}
}
}
}

0
gulpfile.js Executable file → Normal file
View File

9
includes.scad Normal file
View File

@ -0,0 +1,9 @@
use <src/key.scad>
include <src/settings.scad>
include <src/key_sizes.scad>
include <src/key_profiles.scad>
include <src/key_types.scad>
include <src/key_transformations.scad>
include <src/key_helpers.scad>
include <src/key_layouts.scad>

View File

@ -5,24 +5,16 @@
// without having to rely on this file. Unfortunately that means setting tons of
// special variables, but that's a limitation of SCAD we have to work around
use <src/key.scad>
include <src/settings.scad>
include <src/key_sizes.scad>
include <src/key_profiles.scad>
include <src/key_types.scad>
include <src/key_transformations.scad>
include <src/key_helpers.scad>
include <./includes.scad>
// example key
dcs_row(5) legend("⇪", size=9) key();
u(1) choc() {
flared_support() tined_stem_support() sa_row(1){
$stem_support_height = 2;
low_profile() {
key();
}
}
}
// example row
/* for (x = [0:1:4]) {
translate_u(0,-x) dcs_row(x) key();
} */
/* translate_u(1,0) u(1) choc() row_profile("oem") low_profile() key(); */
// example layout
/* preonic_default("dcs") key(); */

View File

@ -1,36 +0,0 @@
/*use <key.scad>*/
// NEED to include, not use this, even with the default variables set. don't know why
include <keys.scad>
60_percent = [
[1,1,1,1,1,1,1,1,1,1,1,1,1,2],
[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25],
[2.25,1,1,1,1,1,1,1,1,1,1,2.75],
[1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25]
];
function sum(list, x=0) =
len(list) <= 1 ?
x + list[0] :
sum([for (x = [1: len(list) - 1]) list[x]], x+list[0]);
for (row = [0:len(60_percent)-1]){
for(column = [0:len(60_percent[row])-1]) {
columnDist = sum([for (x = [0 : column]) 60_percent[row][x]]);
a = 60_percent[row][column];
translate_u(columnDist - (a/2), -row) g20_row(3) u(a) cherry() { // (row+4) % 5 + 1
if (a == 6.25) {
spacebar() key();
} else if (a == 2.25) {
lshift() key();
} else if (a == 2) {
backspace() key();
} else if (a == 2.75) {
rshift() key();
} else {
key();
}
}
}
}

View File

@ -5,12 +5,10 @@ module OpenSCAD
Dir.chdir File.dirname(filename)
lines = lines.flat_map do |line|
# please note we do not implement `use` at all
if line =~ /(include|use)\s*<(.*)>/
# File.readlines("./#{$2}")
expand("./#{$2}")
# in lieu of actually implementing `use`, we can just cull this final line from key.scad
elsif line =~ /example\_key\(\);/
""
else
line
end

4410
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,9 +23,9 @@
"dependencies": {
"gulp-changed": "^3.2.0",
"gulp-changed-in-place": "^2.3.0",
"gulp-shell": "^0.6.5"
"gulp-shell": "^0.8.0"
},
"devDependencies": {
"gulp": "github:gulpjs/gulp#4.0"
"gulp": "4.0.2"
}
}

View File

@ -1 +1,4 @@
// a safe theoretical distance between two vertices such that they don't collapse. hard to use
SMALLEST_POSSIBLE = 1/128;
$fs=0.1;
$unit=19.05;

View File

@ -4,6 +4,10 @@ include <dishes/cylindrical.scad>
include <dishes/old_spherical.scad>
include <dishes/sideways_cylindrical.scad>
include <dishes/spherical.scad>
include <dishes/squared_spherical.scad>
include <dishes/squared_scoop.scad>
include <dishes/flat.scad>
include <dishes/3d_surface.scad>
//geodesic looks much better, but runs very slow for anything above a 2u
geodesic=false;
@ -12,17 +16,22 @@ geodesic=false;
module dish(width, height, depth, inverted) {
if($dish_type == "cylindrical"){
cylindrical_dish(width, height, depth, inverted);
}
else if ($dish_type == "spherical") {
} else if ($dish_type == "spherical") {
spherical_dish(width, height, depth, inverted);
}
else if ($dish_type == "sideways cylindrical"){
} else if ($dish_type == "sideways cylindrical"){
sideways_cylindrical_dish(width, height, depth, inverted);
}
else if ($dish_type == "old spherical") {
} else if ($dish_type == "old spherical") {
old_spherical_dish(width, height, depth, inverted);
} else if ($dish_type == "3d surface") {
3d_surface_dish(width, height, depth, inverted);
} else if ($dish_type == "flat") {
flat_dish(width, height, depth, inverted);
} else if ($dish_type == "disable") {
// else no dish
} else if ($dish_type == "squared spherical") {
squared_spherical_dish(width, height, depth, inverted=inverted);
} else if ($dish_type == "squared scoop") {
squared_scoop_dish(width, height, depth, inverted=inverted);
} else {
echo("WARN: $dish_type unsupported");
}

View File

@ -0,0 +1,16 @@
include <../libraries/3d_surface.scad>
module 3d_surface_dish(width, height, depth, inverted) {
echo(inverted ? "inverted" : "not inverted");
// scale_factor is dead reckoning
// it doesn't have to be dead reckoning for anything but sculpted sides
// we know the angle of the sides from the width difference, height difference,
// skew and tilt of the top. it's a pain to calculate though
scale_factor = 1.05;
// the edges on this behave differently than with the previous dish implementations
scale([width*scale_factor/$3d_surface_size/2,height*scale_factor/$3d_surface_size/2,depth])
rotate([inverted ? 0:180,0,180])
polar_3d_surface(size=$3d_surface_size, step=$3d_surface_step, bottom=-10);
/* %scale([width*scale_factor/$3d_surface_size/2,height*scale_factor/$3d_surface_size/2,depth]) rotate([180,0,0]) polar_3d_surface(bottom=-10); */
}

3
src/dishes/flat.scad Normal file
View File

@ -0,0 +1,3 @@
module flat_dish(width, height, depth, inverted){
cube([width + 100,height + 100, depth], center=true);
}

View File

@ -1,4 +1,8 @@
module spherical_dish(width, height, depth, inverted){
// these variables take into account corner_radius and corner_sculpting, resulting in a more correct dish
// they don't fix the core issue though (dishes adding / subtracting height on the edges of the keycap), so I've disabled them
// new_width = $key_shape_type == "sculpted_square" ? width - distance_between_circumscribed_and_inscribed($corner_radius + $corner_sculpting(1)) : width;
// new_height = $key_shape_type == "sculpted_square" ? height - distance_between_circumscribed_and_inscribed($corner_radius + $corner_sculpting(1)) : height;
//same thing as the cylindrical dish here, but we need the corners to just touch - so we have to find the hypotenuse of the top
chord = pow((pow(width,2) + pow(height, 2)),0.5); //getting diagonal of the top

View File

@ -0,0 +1,34 @@
module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=4, den=5){
// changable numerator/denoninator on where to place the square's corners
// for example, num=2, den=3 means the dish will happen at 1/3 and 2/3 the
// width and the height. Defaults to 4/5. Customizable when calling
// this module
//
// This was initially intended for the scoop on the HiPro, since that's what
// it uses. Use "hipro_row()" if that's what you'd like. However, I do NOT
// know how close the inner square is for the HiPro keycaps. In fact, it could
// just be a sphere, in which the "squared spherical" scoop is more appropriate.
// If, however, it the "squared scoop" makes sense, you can adjust where the square
// lands with the num (numerator) and den (denominator) variables. For instance,
// "3" and "4" mean 3/4 of the width/height is where the flat part starts.
chord = pow(pow(height/2, 2) + pow(width/2, 2),0.5);
direction = inverted ? -1 : 1;
//This is the set of points to hull around for the scoop
points=[
[height/den - height/2, width/den - width/2, -chord],
[num*height/den - height/2, width/den - width/2, -chord],
[height/den - height/2, num*width/den - width/2, -chord],
[num*height/den - height/2, num*width/den - width/2, -chord]
];
resize([height,width,depth])
hull() {
shape_slice(1,0,0);
for(i=[0:len(points)-1]) {
translate(points[i])
sphere(r=r,$fn=64);
}
}
}

View File

@ -0,0 +1,22 @@
module squared_spherical_dish(width, height, depth, inverted=false) {
chord = pow(pow(height / 2, 2) + pow(width / 2, 2),0.5);
direction = inverted ? -1 : 1;
r=max(height,width,chord) / 5;
// ^^^^^ Nothing special about this code to figure out r.
// I just modeled up 1u, 1.25u, 1.5u, 2u, 2.25u, and 2.75u
// keys and messed around until I came up with something that
// looked reasonable for all key sizes. This just seems to work
// well for all sizes
translate([-width / 2, -height / 2, 0 * direction]) {
resize([width, height, depth])
hull() {
cube([chord,chord,0.001]);
// Use something larger in this translate than -depth
// (like -chord) if you want more of a defined circle
// in the keywell
translate([chord/2, chord/2, -depth])
sphere(r=r, $fn=128);
}
}
}

5
src/features.scad Normal file
View File

@ -0,0 +1,5 @@
// features are any premade self-contained objects that go on top or inside
include <features/key_bump.scad>
include <features/clearance_check.scad>
include <features/legends.scad>

View File

@ -0,0 +1,24 @@
// a fake cherry keyswitch, abstracted out to maybe replace with a better one later
module cherry_keyswitch() {
union() {
hull() {
cube([15.6, 15.6, 0.01], center=true);
translate([0,1,5 - 0.01]) cube([10.5,9.5, 0.01], center=true);
}
hull() {
cube([15.6, 15.6, 0.01], center=true);
translate([0,0,-5.5]) cube([13.5,13.5,0.01], center=true);
}
}
}
//approximate (fully depressed) cherry key to check clearances
module clearance_check() {
if($stem_type == "cherry" || $stem_type == "cherry_rounded"){
color($warning_color){
translate([0,0,3.6 + $stem_inset - 5]) {
cherry_keyswitch();
}
}
}
}

26
src/features/legends.scad Normal file
View File

@ -0,0 +1,26 @@
module keytext(text, position, font_size, font_face, depth) {
woffset = (top_total_key_width()/3.5) * position[0];
hoffset = (top_total_key_height()/3.5) * -position[1];
translate([woffset, hoffset, -depth]){
color($tertiary_color) linear_extrude(height=$dish_depth + depth){
text(text=text, font=font_face, size=font_size, halign="center", valign="center");
}
}
}
module legends(depth=0) {
if (len($front_legends) > 0) {
front_of_key() {
for (i=[0:len($front_legends)-1]) {
rotate([90,0,0]) keytext($front_legends[i][0], $front_legends[i][1], $front_legends[i][2], $front_legends[i][3], depth);
}
}
}
if (len($legends) > 0) {
top_of_key() {
for (i=[0:len($legends)-1]) {
keytext($legends[i][0], $legends[i][1], $legends[i][2], $legends[i][3], depth);
}
}
}
}

View File

@ -1,9 +1,12 @@
include <constants.scad>
include <settings.scad>
// I use functions when I need to compute special variables off of other special variables
// functions need to be explicitly included, unlike special variables, which
// just need to have been set before they are used. hence this file
function stem_height() = $total_depth - ($dish_depth * ($inverted_dish ? -1 : 1)) - $stem_inset;
// cherry stem dimensions
function outer_cherry_stem(slop) = [7.2 - slop * 2, 5.5 - slop * 2];
@ -16,11 +19,15 @@ function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .005 purely for aesthetics, to get rid of that ugly crosshatch
function cherry_cross(slop, extra_vertical = 0) = [
// horizontal tine
[4.03 + slop, 1.15 + slop / 3],
[4.03 + slop, 1.25 + slop / 3],
// vertical tine
[1.25 + slop / 3, 4.23 + extra_vertical + slop / 3 + SMALLEST_POSSIBLE],
[1.15 + slop / 3, 4.23 + extra_vertical + slop / 3 + SMALLEST_POSSIBLE],
];
// TODO add side_sculpting
function key_width_at_progress(progress = 0) = $bottom_key_width + ($unit * ($key_length - 1)) - $width_difference;
function key_height_at_progress(progress = 0) = $bottom_key_height + ($unit * ($key_height - 1)) - $height_difference + $side_sculpting(progress);
// actual mm key width and height
function total_key_width(delta = 0) = $bottom_key_width + $unit * ($key_length - 1) - delta;
function total_key_height(delta = 0) = $bottom_key_height + $unit * ($key_height - 1) - delta;
@ -28,3 +35,24 @@ function total_key_height(delta = 0) = $bottom_key_height + $unit * ($key_height
// actual mm key width and height at the top
function top_total_key_width() = $bottom_key_width + ($unit * ($key_length - 1)) - $width_difference;
function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1)) - $height_difference;
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
// tan of 0 is 0, division by 0 is nan, so we have to guard
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
// (I think) extra length of the side of the keycap due to the keytop being tilted.
// necessary for calculating flat sided keycaps
function vertical_inclination_due_to_top_tilt() = sin($top_tilt) * (top_total_key_height() - $corner_radius * 2) * 0.5;
// how much you have to expand the front or back of the keytop to make the side
// of the keycap a flat plane. 1 = front, -1 = back
// I derived this through a bunch of trig reductions I don't really understand.
function extra_keytop_length_for_flat_sides() = ($width_difference * vertical_inclination_due_to_top_tilt()) / ($total_depth);
// adds uniform rounding radius for round-anything polyRound
function add_rounding(p, radius)=[for(i=[0:len(p)-1])[p[i].x,p[i].y, radius]];
// computes millimeter length from unit length
function unit_length(length) = $unit * (length - 1) + 18.16;
// if you have a radius of an inscribed circle, this function gives you the extra length for the radius of the circumscribed circle
// and vice versa. used to find the edge of a rounded_square
function distance_between_circumscribed_and_inscribed(radius) = (pow(2, 0.5) - 1) * radius;

19
src/hulls.scad Normal file
View File

@ -0,0 +1,19 @@
include <hulls/skin.scad>
include <hulls/linear_extrude.scad>
include <hulls/hull.scad>
// basic key shape, no dish, no inside
// which is only used for dishing to cut the dish off correctly
// $height_difference used for keytop thickness
// extra_slices is a hack to make inverted dishes still work
module shape_hull(thickness_difference, depth_difference, extra_slices = 0){
render() {
if ($hull_shape_type == "skin") {
skin_extrude_shape_hull(thickness_difference, depth_difference, extra_slices);
} else if ($hull_shape_type == "linear extrude") {
linear_extrude_shape_hull(thickness_difference, depth_difference, extra_slices);
} else {
hull_shape_hull(thickness_difference, depth_difference, extra_slices);
}
}
}

37
src/hulls/hull.scad Normal file
View File

@ -0,0 +1,37 @@
module hull_shape_hull(thickness_difference, depth_difference, extra_slices = 0) {
for (index = [0:$height_slices - 1 + extra_slices]) {
hull() {
placed_shape_slice(index / $height_slices, thickness_difference, depth_difference);
placed_shape_slice((index + 1) / $height_slices, thickness_difference, depth_difference);
}
}
}
module placed_shape_slice(progress, thickness_difference, depth_difference) {
skew_this_slice = $top_skew * progress;
x_skew_this_slice = $top_skew_x * progress;
depth_this_slice = ($total_depth - depth_difference) * progress;
tilt_this_slice = -$top_tilt / $key_height * progress;
y_tilt_this_slice = $double_sculpted ? (-$top_tilt_y / $key_length * progress) : 0;
translate([x_skew_this_slice, skew_this_slice, depth_this_slice]) {
rotate([tilt_this_slice,y_tilt_this_slice,0]){
shape_slice(progress, thickness_difference, depth_difference);
}
}
}
module shape_slice(progress, thickness_difference, depth_difference) {
linear_extrude(height = SMALLEST_POSSIBLE, scale = 1){
key_shape(
[
total_key_width(thickness_difference),
total_key_height(thickness_difference)
],
[$width_difference, $height_difference],
progress
);
}
}

View File

@ -0,0 +1,18 @@
// corollary is hull_shape_hull
// extra_slices unused, only to match argument signatures
module linear_extrude_shape_hull(thickness_difference, depth_difference, extra_slices = 0){
height = $total_depth - depth_difference;
width_scale = top_total_key_width() / total_key_width();
height_scale = top_total_key_height() / total_key_height();
translate([0,$linear_extrude_height_adjustment,0]){
linear_extrude(height = height, scale = [width_scale, height_scale]) {
translate([0,-$linear_extrude_height_adjustment,0]){
key_shape(
[total_key_width(), total_key_height()],
[thickness_difference, thickness_difference]
);
}
}
}
}

34
src/hulls/skin.scad Normal file
View File

@ -0,0 +1,34 @@
// use skin() instead of successive hulls. much more correct, and looks faster
// too, in most cases. successive hull relies on overlapping faces which are
// not good. But, skin works on vertex sets instead of shapes, which makes it
// a lot more difficult to use
module skin_extrude_shape_hull(thickness_difference, depth_difference, extra_slices = 0 ) {
skin([
for (index = [0:$height_slices + extra_slices])
let(
progress = (index / $height_slices),
skew_this_slice = $top_skew * progress,
x_skew_this_slice = $top_skew_x * progress,
depth_this_slice = ($total_depth - depth_difference) * progress,
tilt_this_slice = -$top_tilt / $key_height * progress,
y_tilt_this_slice = $double_sculpted ? (-$top_tilt_y / $key_length * progress) : 0
)
skin_shape_slice(progress, thickness_difference, skew_this_slice, x_skew_this_slice, depth_this_slice, tilt_this_slice, y_tilt_this_slice)
]);
}
function skin_shape_slice(progress, thickness_difference, skew_this_slice, x_skew_this_slice, depth_this_slice, tilt_this_slice, y_tilt_this_slice) =
transform(
translation([x_skew_this_slice,skew_this_slice,depth_this_slice]),
transform(
rotation([tilt_this_slice,y_tilt_this_slice,0]),
skin_key_shape([
total_key_width(0) - thickness_difference,
total_key_height(0) - thickness_difference,
],
[$width_difference, $height_difference],
progress,
thickness_difference
)
)
);

View File

@ -1,190 +1,89 @@
// files
include <constants.scad>
include <functions.scad>
include <shapes.scad>
include <stems.scad>
include <stem_supports.scad>
include <dishes.scad>
include <supports.scad>
include <key_features.scad>
include <features.scad>
include <hulls.scad>
include <libraries/geodesic_sphere.scad>
// for skin hulls
use <libraries/scad-utils/transformations.scad>
use <libraries/scad-utils/lists.scad>
use <libraries/scad-utils/shapes.scad>
use <libraries/skin.scad>
/* [Hidden] */
SMALLEST_POSSIBLE = 1/128;
$fs = .1;
$unit = 19.05;
blue = [.2667,.5882,1];
color2 = [.5412, .4784, 1];
purple = [.4078, .3569, .749];
yellow = [1, .6941, .2];
transparent_red = [1,0,0, 0.15];
// key shape including dish. used as the ouside and inside shape in keytop(). allows for itself to be shrunk in depth and width / height
module shape(thickness_difference, depth_difference){
// 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
module shape(thickness_difference, depth_difference=0){
dished(depth_difference, $inverted_dish) {
color(blue) shape_hull(thickness_difference, depth_difference, $inverted_dish ? 2 : 0);
color($primary_color) shape_hull(thickness_difference, depth_difference, $inverted_dish ? 200 : 0);
}
}
// shape of the key but with soft, rounded edges. much more realistic, MUCH more complex. orders of magnitude more complex
module rounded_shape() {
color(blue) minkowski(){
color($primary_color) minkowski(){
// half minkowski in the z direction
shape($minkowski_radius * 2, $minkowski_radius/2);
minkowski_object();
}
}
// minkowski places this object at every vertex of the other object then mashes
// it all together
module minkowski_object() {
// alternative minkowski shape that needs the bottom of the keycap to be trimmed
/* sphere(1); */
difference(){
sphere(r=$minkowski_radius, $fn=20);
sphere(r=$minkowski_radius, $fa=360/$minkowski_facets);
translate([0,0,-$minkowski_radius]){
cube($minkowski_radius * 2, center=true);
}
}
}
}
module envelope(depth_difference=0, extra_floor_depth=0) {
size = 1.5;
// basic key shape, no dish, no inside
// which is only used for dishing to cut the dish off correctly
// $height_difference used for keytop thickness
// extra_slices is a hack to make inverted dishes still work
module shape_hull(thickness_difference, depth_difference, extra_slices = 0){
render() {
if ($linear_extrude_shape) {
linear_extrude_shape_hull(thickness_difference, depth_difference, extra_slices);
} else {
hull_shape_hull(thickness_difference, depth_difference, extra_slices);
}
}
}
// corollary is hull_shape_hull
// extra_slices unused, only to match argument signatures
module linear_extrude_shape_hull(thickness_difference, depth_difference, extra_slices = 0){
height = $total_depth - depth_difference;
width_scale = top_total_key_width() / total_key_width();
height_scale = top_total_key_height() / total_key_height();
translate([0,$linear_extrude_height_adjustment,0]){
linear_extrude(height = height, scale = [width_scale, height_scale]) {
translate([0,-$linear_extrude_height_adjustment,0]){
key_shape(total_key_width(thickness_difference), total_key_height(thickness_difference));
}
}
}
}
module hull_shape_hull(thickness_difference, depth_difference, extra_slices = 0) {
for (index = [0:$height_slices - 1 + extra_slices]) {
hull(){
shape_slice(index / $height_slices, thickness_difference, depth_difference);
shape_slice((index + 1) / $height_slices, thickness_difference, depth_difference);
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);
top_placement(SMALLEST_POSSIBLE + depth_difference){
cube([top_total_key_width() * size, top_total_key_height() * size, 0.01], center = true);
}
}
}
module shape_slice(progress, thickness_difference, depth_difference) {
skew_this_slice = $top_skew * progress;
depth_this_slice = ($total_depth - depth_difference) * progress;
tilt_this_slice = -$top_tilt / $key_height * progress;
translate([0, skew_this_slice, depth_this_slice]) {
rotate([tilt_this_slice,0,0]){
linear_extrude(height = SMALLEST_POSSIBLE){
key_shape(
[
total_key_width(thickness_difference),
total_key_height(thickness_difference)
],
[$width_difference, $height_difference],
progress
);
}
}
}
}
// for when you want something to only exist inside the keycap.
// used for the support structure
module inside() {
// for when you want to take the dish out of things
// used for adding the dish to the key shape and making sure stems don't stick out the top
// creates a bounding box 1.5 times larger in width and height than the keycap.
module dished(depth_difference = 0, inverted = false) {
intersection() {
shape($wall_thickness, $keytop_thickness);
children();
difference(){
union() {
// envelope is needed to "fill in" the rest of the keycap. intersections with small objects are much faster than differences with large objects
envelope(depth_difference, $stem_inset);
if (inverted) top_placement(depth_difference) color($secondary_color) _dish(inverted);
}
}
// put something at the top of the key, with no adjustments for dishing
module top_placement(depth_difference) {
translate([$dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){
rotate([-$top_tilt / $key_height,0,0]){
children();
if (!inverted) top_placement(depth_difference) color($secondary_color) _dish(inverted);
// %top_placement(depth_difference) _dish();
}
}
}
// just to DRY up the code
module _dish() {
dish(top_total_key_width() + $dish_overdraw_width, top_total_key_height() + $dish_overdraw_height, $dish_depth, $inverted_dish);
}
module envelope(depth_difference) {
s = 1.5;
hull(){
cube([total_key_width() * s, total_key_height() * s, 0.01], center = true);
top_placement(SMALLEST_POSSIBLE + depth_difference){
cube([top_total_key_width() * s, top_total_key_height() * s, 0.01], center = true);
}
}
}
module dished_for_show() {
difference(){
union() {
envelope();
if ($inverted_dish) top_placement(0) _dish();
}
if (!$inverted_dish) top_placement(0) _dish();
}
}
// for when you want to take the dish out of things
// used for adding the dish to the key shape and making sure stems don't stick out the top
// creates a bounding box 1.5 times larger in width and height than the keycap.
module dished(depth_difference, inverted = false) {
intersection() {
children();
difference(){
union() {
envelope(depth_difference);
if (inverted) top_placement(depth_difference) _dish();
}
if (!inverted) top_placement(depth_difference) _dish();
}
}
}
// puts it's children at the center of the dishing on the key, including dish height
// more user-friendly than top_placement
module top_of_key(){
// if there is a dish, we need to account for how much it digs into the top
dish_depth = ($dish_type == "disable") ? 0 : $dish_depth;
// if the dish is inverted, we need to account for that too. in this case we do half, otherwise the children would be floating on top of the dish
corrected_dish_depth = ($inverted_dish) ? -dish_depth / 2 : dish_depth;
top_placement(corrected_dish_depth) {
children();
}
}
module keytext(text, position, font_size, depth) {
woffset = (top_total_key_width()/3.5) * position[0];
hoffset = (top_total_key_height()/3.5) * -position[1];
translate([woffset, hoffset, -depth]){
linear_extrude(height=$dish_depth){
text(text=text, font=$font, size=font_size, halign="center", valign="center");
}
}
// TODO is putting special vars in function signatures legal
module _dish(inverted=$inverted_dish) {
translate([$dish_offset_x,0,0]) color($secondary_color)
dish(top_total_key_width() + $dish_overdraw_width, top_total_key_height() + $dish_overdraw_height, $dish_depth, inverted);
// %dish(top_total_key_width() + $dish_overdraw_width, top_total_key_height() + $dish_overdraw_height, $dish_depth, inverted);
}
// puts its children at each keystem position provided
module keystem_positions(positions) {
for (connector_pos = positions) {
translate(connector_pos) {
@ -197,120 +96,166 @@ module keystem_positions(positions) {
module support_for(positions, stem_type) {
keystem_positions(positions) {
color(yellow) supports($support_type, stem_type, $stem_throw, $total_depth - $stem_throw);
color($tertiary_color) supports($support_type, stem_type, $stem_throw, $total_depth - $stem_throw);
}
}
module stems_for(positions, stem_type) {
keystem_positions(positions) {
color(yellow) stem(stem_type, $total_depth, $stem_slop);
color($tertiary_color) stem(stem_type, stem_height(), $stem_slop, $stem_throw);
if ($stem_support_type != "disable") {
color(color2) stem_support($stem_support_type, stem_type, $stem_support_height, $stem_slop);
color($quaternary_color) stem_support($stem_support_type, stem_type, $stem_support_height, $stem_slop);
}
}
}
// a fake cherry keyswitch, abstracted out to maybe replace with a better one later
module cherry_keyswitch() {
union() {
hull() {
cube([15.6, 15.6, 0.01], center=true);
translate([0,1,5 - 0.01]) cube([10.5,9.5, 0.01], center=true);
}
hull() {
cube([15.6, 15.6, 0.01], center=true);
translate([0,0,-5.5]) cube([13.5,13.5,0.01], center=true);
// put something at the top of the key, with no adjustments for dishing
module top_placement(depth_difference=0) {
top_tilt_by_height = -$top_tilt / $key_height;
top_tilt_y_by_length = $double_sculpted ? (-$top_tilt_y / $key_length) : 0;
// minkowski_height = $rounded_key ? $minkowski_radius : 0;
translate([$top_skew_x + $dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){
rotate([top_tilt_by_height, top_tilt_y_by_length,0]){
children();
}
}
}
//approximate (fully depressed) cherry key to check clearances
module clearance_check() {
if($stem_type == "cherry" || $stem_type == "cherry_rounded"){
color(transparent_red){
translate([0,0,3.6 + $stem_inset - 5]) {
cherry_keyswitch();
}
}
}
}
// puts its children at the center of the dishing on the key, including dish height
// more user-friendly than top_placement
module top_of_key(){
// if there is a dish, we need to account for how much it digs into the top
dish_depth = ($dish_type == "disable") ? 0 : $dish_depth;
// if the dish is inverted, we need to account for that too. in this case we do half, otherwise the children would be floating on top of the dish
corrected_dish_depth = ($inverted_dish) ? -dish_depth / 2 : dish_depth;
// legends / artisan support
module artisan(depth) {
top_of_key() {
// outset legend
if (len($legends) > 0) {
for (i=[0:len($legends)-1]) {
keytext($legends[i][0], $legends[i][1], $legends[i][2], depth);
}
}
// artisan objects / outset shape legends
top_placement(corrected_dish_depth) {
children();
}
}
// key with hollowed inside but no stem
module keytop() {
difference(){
if ($rounded_key) {
module front_of_key() {
// all this math is to take top skew and tilt into account
// we need to find the new effective height and depth of the top, front lip
// of the keycap to find the angle so we can rotate things correctly into place
total_depth_difference = sin(-$top_tilt) * (top_total_key_height()/2);
total_height_difference = $top_skew + (1 - cos(-$top_tilt)) * (top_total_key_height()/2);
angle = atan2(($total_depth - total_depth_difference), ($height_difference/2 + total_height_difference));
hypotenuse = ($total_depth -total_depth_difference) / sin(angle);
translate([0,-total_key_height()/2,0]) {
rotate([-(90-angle), 0, 0]) {
translate([0,0,hypotenuse/2]){
children();
}
}
}
}
module outer_shape() {
if ($rounded_key == true) {
rounded_shape();
} else {
shape(0, 0);
}
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-SMALLEST_POSSIBLE]) {
shape($wall_thickness, $keytop_thickness);
}
module inner_shape(extra_wall_thickness = 0, extra_keytop_thickness = 0) {
if ($inner_shape_type == "flat") {
/* $key_shape_type="square"; */
$height_slices = 1;
// if inner_shape is flat, keytop_thickness will be dish_depth less than it should be, since the dish digs in that far.
// so, we add dish_depth here
color($primary_color) shape_hull($wall_thickness + extra_wall_thickness, $keytop_thickness + extra_keytop_thickness + $dish_depth, 0);
} else {
shape($wall_thickness + extra_wall_thickness, $keytop_thickness + extra_keytop_thickness);
}
}
// The final, penultimate key generation function.
// takes all the bits and glues them together. requires configuration with special variables.
module key(inset = false) {
difference() {
union(){
// the shape of the key, inside and out
keytop();
if($key_bump) top_of_key() keybump($key_bump_depth, $key_bump_edge);
// additive objects at the top of the key
if(!inset) artisan() children();
module additive_features(inset) {
top_of_key() {
if($key_bump) keybump($key_bump_depth, $key_bump_edge);
if(!inset && $children > 0) color($secondary_color) children();
}
if($outset_legends) legends(0);
// render the clearance check if it's enabled, but don't have it intersect with anything
if ($clearance_check) %clearance_check();
}
// subtractive objects at the top of the key
if (inset) artisan(0.3) children();
module subtractive_features(inset) {
top_of_key() {
if (inset && $children > 0) color($secondary_color) children();
}
if(!$outset_legends) legends($inset_legend_depth);
// subtract the clearance check if it's enabled, letting the user see the
// parts of the keycap that will hit the cherry switch
if ($clearance_check) clearance_check();
// this is a little confusing as it eats the stem too
/* if ($clearance_check) clearance_check(); */
}
// both stem and support are optional
if ($stem_type != "disable" || ($stabilizers != [] && $stabilizer_type != "disable")) {
dished($keytop_thickness, $inverted_dish) {
// features inside the key itself (stem, supports, etc)
module inside_features() {
// Stems and stabilizers are not "inside features" unless they are fully
// contained inside the cap. otherwise they'd be cut off when they are
// differenced with the outside shape. this only matters if $stem_inset
// is negative
if ($stem_inset >= 0) stems_and_stabilizers();
if ($support_type != "disable") translate([0, 0, $stem_inset]) support_for($stem_positions, $stem_type);
if ($stabilizer_type != "disable") translate([0, 0, $stem_inset]) support_for($stabilizers, $stabilizer_type);
}
// all stems and stabilizers
module stems_and_stabilizers() {
translate([0, 0, $stem_inset]) {
/* if ($stabilizer_type != "disable") stems_for($stabilizers, $stabilizer_type); */
if ($stem_type != "disable") {
stems_for($stabilizers, $stabilizer_type);
}
stems_for($stem_positions, $stem_type);
}
if ($stabilizer_type != "disable") stems_for($stabilizers, $stabilizer_type);
if ($stem_type != "disable") stems_for($stem_positions, $stem_type);
}
}
if ($support_type != "disable"){
inside() {
translate([0, 0, $stem_inset]) {
if ($stabilizer_type != "disable") support_for($stabilizers, $stabilizer_type);
// always render stem support even if there isn't a stem.
// rendering flat support w/no stem is much more common than a hollow keycap
// so if you want a hollow keycap you'll have to turn support off entirely
support_for($stem_positions, $stem_type);
// helpers for doubleshot keycaps for now
module inner_total_shape() {
difference() {
inner_shape();
inside_features();
}
}
module outer_total_shape(inset=false) {
outer_shape();
additive_features(inset) {
children();
};
}
// The final, penultimate key generation function.
// takes all the bits and glues them together. requires configuration with special variables.
module key(inset=false) {
difference(){
outer_total_shape(inset) {
children();
};
if ($inner_shape_type != "disable") {
translate([0,0,-SMALLEST_POSSIBLE]) { // avoids moire
inner_total_shape();
}
}
subtractive_features(inset) {
children();
};
}
// semi-hack to make sure negative inset stems don't poke through the top of the keycap
if ($stem_inset < 0) {
dished(0, $inverted_dish) {
stems_and_stabilizers();
}
}
}
@ -321,4 +266,6 @@ module example_key(){
key();
}
if (!$using_customizer) {
example_key();
}

20
src/key_layouts.scad Normal file
View File

@ -0,0 +1,20 @@
include <layouts/layout.scad>
include <layouts/preonic/default.scad>
include <layouts/preonic/mit.scad>
include <layouts/planck/default.scad>
include <layouts/planck/mit.scad>
include <layouts/lets_split/default.scad>
include <layouts/project_zen/default.scad>
include <layouts/60_percent/default.scad>
include <layouts/gherkin/default.scad>
include <layouts/gherkin/gherkin_bump.scad>
include <layouts/dactyl_manuform/4x6.scad>
include <layouts/dactyl_manuform/4x6_legends.scad>
include <layouts/plate.scad>

View File

@ -7,19 +7,48 @@ include <key_profiles/oem.scad>
include <key_profiles/dsa.scad>
include <key_profiles/sa.scad>
include <key_profiles/g20.scad>
include <key_profiles/hipro.scad>
include <key_profiles/mt3.scad>
include <key_profiles/grid.scad>
include <key_profiles/regular_polygon.scad>
include <key_profiles/cherry.scad>
include <key_profiles/dss.scad>
include <key_profiles/asa.scad>
include <key_profiles/typewriter.scad>
include <key_profiles/hex.scad>
// man, wouldn't it be so cool if functions were first order
module key_profile(key_profile_type, row) {
module key_profile(key_profile_type, row, column=0) {
if (key_profile_type == "dcs") {
dcs_row(row) children();
dcs_row(row, column) children();
} else if (key_profile_type == "oem") {
oem_row(row) children();
oem_row(row, column) children();
} else if (key_profile_type == "dsa") {
dsa_row(row) children();
dsa_row(row, column) children();
} else if (key_profile_type == "dss") {
dss_row(row, column) children();
} else if (key_profile_type == "sa") {
sa_row(row) children();
sa_row(row, column) children();
} else if (key_profile_type == "asa") {
asa_row(row, column) children();
} else if (key_profile_type == "g20") {
g20_row(row) children();
g20_row(row, column) children();
} else if (key_profile_type == "hipro") {
hipro_row(row, column) children();
} else if (key_profile_type == "grid") {
grid_row(row, column) children();
} else if (key_profile_type == "typewriter") {
typewriter_row(row, column) children();
} else if (key_profile_type == "hex") { // reddit.com/r/MechanicalKeyboards/comments/kza7ji
hex_row(row, column) children();
} else if (key_profile_type == "hexagon") {
hexagonal_row(row, column) children();
} else if (key_profile_type == "octagon") {
octagonal_row(row, column) children();
} else if (key_profile_type == "cherry") {
cherry_row(row, column) children();
} else if (key_profile_type == "mt3") {
mt3_row(row, column) children();
} else if (key_profile_type == "disable") {
children();
} else {

44
src/key_profiles/asa.scad Normal file
View File

@ -0,0 +1,44 @@
use <../functions.scad>
include <../settings.scad>
module asa_row(row=3, column = 0) {
$key_shape_type = "sculpted_square";
$bottom_key_height = 18.15;
$bottom_key_width = 18.10; // Default (R3)
$total_depth = 10.75; // Default (R3)
$top_tilt = 1.5; // Default (R3)
$width_difference = 6.20;
$height_difference = 6.55;
$dish_type = "spherical";
$dish_depth = 1.3;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 1.75;
$stem_inset = 1.2;
$height_slices = 10;
$corner_radius = 1;
$more_side_sculpting_factor = 0.4;
$side_sculpting = function(progress) (1 - progress) * 4.5;
$corner_sculpting = function(progress) pow(progress, 2);
// this is _incredibly_ intensive
//$rounded_key = true;
if (row == 1){
$total_depth = 10.5;
$top_tilt = 9.33;
children();
} else if (row == 2) {
$total_depth = 9.95;
$top_tilt = 4;
children();
} else if (row == 4){
$total_depth = 12.55;
$top_tilt = 0.43;
children();
}else{
children();
}
}

View File

@ -0,0 +1,51 @@
use <../functions.scad>
include <../settings.scad>
// based off GMK keycap set
module cherry_row(row=3, column=0) {
$bottom_key_width = 18.16;
$bottom_key_height = 18.16;
$width_difference = $bottom_key_width - 11.85;
$height_difference = $bottom_key_height - 14.64;
$dish_type = "cylindrical";
$dish_depth = 0.65;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 2;
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
// NOTE: cherry keycaps have this stem inset, but I'm reticent to turn it on
// since it'll be surprising to folks. the height has been adjusted accordingly
// $stem_inset = 0.6;
extra_stem_inset_height = max(0.6 - $stem_inset, 0);
// <= is a hack so you can do these in a for loop. function row = 0
if (row <= 1) {
$total_depth = 9.8 - extra_stem_inset_height + extra_height;
$top_tilt = 0;
children();
} else if (row == 2) {
$total_depth = 7.45 - extra_stem_inset_height + extra_height;
$top_tilt = 2.5;
children();
} else if (row == 3) {
$total_depth = 6.55 - extra_stem_inset_height + extra_height;
$top_tilt = 5;
children();
} else if (row == 3) {
$total_depth = 6.7 + 0.65 - extra_stem_inset_height + extra_height;
$top_tilt = 11.5;
children();
} else if (row >= 4) {
$total_depth = 6.7 + 0.65 - extra_stem_inset_height + extra_height;
$top_tilt = 11.5;
children();
} else {
children();
}
}

View File

@ -1,33 +1,47 @@
module dcs_row(n=3) {
// names, so I don't go crazy
use <../functions.scad>
include <../settings.scad>
module dcs_row(row=3, column=0) {
$bottom_key_width = 18.16;
$bottom_key_height = 18.16;
$width_difference = 6;
$height_difference = 4;
$dish_type = "cylindrical";
$dish_depth = 1;
$dish_depth = 0.5;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 1.75;
if (n == 5) {
$total_depth = 11.5;
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
// this dish depth should match the depth of the uberdishing in fully sculpted mode
// but it doesn't, and it's very slight for any reasonable double sculpting
/* $dish_depth = $double_sculpt_radius - sin(acos(top_total_key_width()/2 /$double_sculpt_radius)) * $double_sculpt_radius; */
/* echo("DISH DEPTH", $dish_depth, "column", column); */
// 5/0 is a hack so you can do these in a for loop
if (row == 5 || row == 0) {
$total_depth = 11.5 + extra_height;
$top_tilt = -6;
children();
} else if (n == 1) {
$total_depth = 8.5;
} else if (row == 1) {
$total_depth = 8.5 + extra_height;
$top_tilt = -1;
children();
} else if (n == 2) {
$total_depth = 7.5;
} else if (row == 2) {
$total_depth = 7.5 + extra_height;
$top_tilt = 3;
children();
} else if (n == 3) {
$total_depth = 6;
} else if (row == 3) {
$total_depth = 6 + extra_height;
$top_tilt = 7;
children();
} else if (n == 4) {
$total_depth = 6;
} else if (row == 4) {
$total_depth = 6 + extra_height;
$top_tilt = 16;
children();
} else {

View File

@ -1,36 +1,44 @@
module dsa_row(n=3) {
use <../functions.scad>
include <../settings.scad>
module dsa_row(row=3, column = 0) {
$key_shape_type = "sculpted_square";
$bottom_key_width = 18.24; // 18.4;
$bottom_key_height = 18.24; // 18.4;
$width_difference = 6; // 5.7;
$height_difference = 6; // 5.7;
$top_tilt = n == 5 ? -21 : (n-3) * 7;
$top_tilt = row == 5 ? -21 : (row-3) * 7;
$top_skew = 0;
$dish_type = "spherical";
$dish_depth = 1.2;
$dish_skew_x = 0;
$dish_skew_y = 0;
$height_slices = 10;
$enable_side_sculpting = true;
// might wanna change this if you don't minkowski
// do you even minkowski bro
$corner_radius = 0.25;
$side_sculpting = function(progress) (1 - progress) * 4.5;
$corner_sculpting = function(progress) pow(progress, 2);
$corner_radius = 1;
$more_side_sculpting_factor = 0.4;
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
depth_raisers = [0, 3.5, 1, 0, 1, 3];
if (n == 5) {
$total_depth = 8.1 + depth_raisers[n];
if (row < 1 || row > 4) {
$total_depth = 8.1 + depth_raisers[row] + extra_height;
children();
} else if (n == 1) {
$total_depth = 8.1 + depth_raisers[n];
} else if (row == 1) {
$total_depth = 8.1 + depth_raisers[row] + extra_height;
children();
} else if (n == 2) {
$total_depth = 8.1 + depth_raisers[n];
} else if (row == 2) {
$total_depth = 8.1 + depth_raisers[row] + extra_height;
children();
} else if (n == 3) {
$total_depth = 8.1 + depth_raisers[n];
} else if (row == 3) {
$total_depth = 8.1 + depth_raisers[row] + extra_height;
children();
} else if (n == 4) {
$total_depth = 8.1 + depth_raisers[n];
} else if (row == 4) {
$total_depth = 8.1 + depth_raisers[row] + extra_height;
children();
} else {
children();

55
src/key_profiles/dss.scad Normal file
View File

@ -0,0 +1,55 @@
use <../functions.scad>
include <../settings.scad>
module dss_row(n=3, column=0) {
$key_shape_type = "sculpted_square";
$bottom_key_width = 18.24;
$bottom_key_height = 18.24;
$width_difference = 6;
$height_difference = 6;
$dish_type = "spherical";
$dish_depth = 1.2;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 0;
$height_slices = 10;
// might wanna change this if you don't minkowski
// do you even minkowski bro
$corner_radius = 1;
$more_side_sculpting_factor = 0.4;
$side_sculpting = function(progress) (1 - progress) * 4.5;
$corner_sculpting = function(progress) pow(progress, 2);
// this is _incredibly_ intensive
/* $rounded_key = true; */
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
// 5th row is usually unsculpted or the same as the row below it
// making a super-sculpted top row (or bottom row!) would be real easy
// bottom row would just be 13 tilt and 14.89 total depth
// top row would be something new entirely - 18 tilt maybe?
if (n <= 1){
$total_depth = 10.5 + extra_height;
$top_tilt = -1;
children();
} else if (n == 2) {
$total_depth = 8.6 + extra_height;
$top_tilt = 3;
children();
} else if (n == 3) {
$total_depth = 7.9 + extra_height;
$top_tilt = 8;
children();
} else if (n == 4){
$total_depth = 9.1 + extra_height;
$top_tilt = 16;
children();
} else {
$total_depth = 7.9 + extra_height;
$top_tilt = 8;
children();
}
}

View File

@ -1,4 +1,7 @@
module g20_row(n=3) {
use <../functions.scad>
include <../settings.scad>
module g20_row(row=3, column = 0) {
$bottom_key_width = 18.16;
$bottom_key_height = 18.16;
$width_difference = 2;
@ -16,25 +19,26 @@ module g20_row(n=3) {
//also,
$rounded_key = true;
if (n == 5) {
$total_depth = 6 + abs((n-3) * 0.5);
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
$total_depth = 6 + abs((row-3) * 0.5) + extra_height;
if (row == 5 || row == 0) {
$top_tilt = -18.55;
children();
} else if (n == 1) {
$total_depth = 6 + abs((n-3) * 0.5);
$top_tilt = (n-3) * 7 + 2.5;
} else if (row == 1) {
$top_tilt = (row-3) * 7 + 2.5;
children();
} else if (n == 2) {
$total_depth = 6 + abs((n-3) * 0.5);
$top_tilt = (n-3) * 7 + 2.5;
} else if (row == 2) {
$top_tilt = (row-3) * 7 + 2.5;
children();
} else if (n == 3) {
$total_depth = 6 + abs((n-3) * 0.5);
$top_tilt = (n-3) * 7 + 2.5;
} else if (row == 3) {
$top_tilt = (row-3) * 7 + 2.5;
children();
} else if (n == 4) {
$total_depth = 6 + abs((n-3) * 0.5);
$top_tilt = (n-3) * 7 + 2.5;
} else if (row == 4) {
$top_tilt = (row-3) * 7 + 2.5;
children();
} else {
children();

View File

@ -0,0 +1,50 @@
use <../functions.scad>
include <../settings.scad>
module grid_row(row=3, column = 0) {
$bottom_key_width = 18.16;
$bottom_key_height = 18.16;
$width_difference = 1;
$height_difference = 1;
$top_tilt = 0;
$top_skew = 0;
$dish_type = "old spherical";
// something weird is going on with this and legends - can't put it below 1.2 or they won't show
$dish_depth = 1;
$dish_skew_x = 0;
$dish_skew_y = 0;
$hull_shape_type = "linear extrude";
$dish_overdraw_width = -6.5;
$dish_overdraw_height = -6.5;
$minkowski_radius = 0.5;
//also,
/* $rounded_key = true; */
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
$total_depth = 7 + abs((row-3) * 0.5) + extra_height;
if (row == 5 || row == 0) {
/* $top_tilt = -18.55; */
children();
} else if (row == 1) {
/* $top_tilt = (row-3) * 7 + 2.5; */
children();
} else if (row == 2) {
/* $top_tilt = (row-3) * 7 + 2.5; */
children();
} else if (row == 3) {
/* $top_tilt = (row-3) * 7 + 2.5; */
children();
} else if (row == 4) {
/* $top_tilt = (row-3) * 7 + 2.5; */
children();
} else {
children();
}
}

62
src/key_profiles/hex.scad Normal file
View File

@ -0,0 +1,62 @@
include <../constants.scad>
// Regular polygon shapes CIRCUMSCRIBE the sphere of diameter $bottom_key_width
// This is to make tiling them easier, like in the case of hexagonal keycaps etc
// this function doesn't set the key shape, so you can't use it directly without some fiddling
module hex_row(n=3, column=0) {
$bottom_key_width = $unit - 0.5;
$bottom_key_height = $unit - 0.5;
$width_difference = 0;
$height_difference = 0;
$dish_type = "spherical";
$key_shape_type = "hexagon";
$stem_inset = -2.5;
$stem_throw = 3;
// $dish_depth = 1;
$top_skew = 0;
$height_slices = 1;
$stem_support_type = "disable";
$dish_overdraw_width = -8.25;
$dish_overdraw_height = -8.25;
// $corner_radius = 1;
// this is _incredibly_ intensive
/* $rounded_key = true; */
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
base_depth = 4;
if (n <= 1){
$total_depth = base_depth + 2.5 + extra_height;
$top_tilt = -13;
children();
} else if (n == 2) {
$total_depth = base_depth + 0.5 + extra_height;
$top_tilt = -7;
children();
} else if (n == 3) {
$total_depth = base_depth + extra_height;
$top_tilt = 0;
children();
} else if (n == 4){
$total_depth = base_depth + 0.5 + extra_height;
$top_tilt = 7;
children();
} else {
$total_depth = base_depth + extra_height;
$top_tilt = 0;
children();
}
}

View File

@ -0,0 +1,48 @@
use <../functions.scad>
include <../settings.scad>
module hipro_row(row=3, column=0) {
$key_shape_type = "sculpted_square";
$bottom_key_width = 18.35;
$bottom_key_height = 18.17;
$width_difference = ($bottom_key_width - 12.3);
$height_difference = ($bottom_key_height - 12.65);
$dish_type = "squared scoop";
$dish_depth = 0.75;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 0;
$height_slices = 10;
$corner_radius = 1;
$more_side_sculpting_factor = 0.4;
$side_sculpting = function(progress) (1 - progress) * 4.5;
$corner_sculpting = function(progress) pow(progress, 2);
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
if (row <= 1){
$total_depth = 13.7 + extra_height;
// TODO I didn't change these yet
$top_tilt = -13;
children();
} else if (row == 2) {
$total_depth = 11.1 + extra_height;
$top_tilt = -7;
children();
} else if (row == 3) {
$total_depth = 11.1 + extra_height;
$top_tilt = 7;
children();
} else if (row == 4 || row == 5){
$total_depth = 12.25 + extra_height;
$top_tilt = 13;
children();
} else {
children();
}
}

58
src/key_profiles/mt3.scad Normal file
View File

@ -0,0 +1,58 @@
use <../functions.scad>
include <../settings.scad>
// This is an imperfect attempt to clone the MT3 profile
module mt3_row(row=3, column=0, deep_dish=false) {
$key_shape_type = "sculpted_square";
$bottom_key_width = 18.35;
$bottom_key_height = 18.6;
$width_difference = ($bottom_key_width - 13.0);
$height_difference = ($bottom_key_height - 13.0);
$dish_type = "squared spherical";
$dish_depth = deep_dish ? 1.6 : 1.2;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 0;
$height_slices = 10;
$corner_radius = 0.0125;
$more_side_sculpting_factor = 0.75;
$side_sculpting = function(progress) (1 - progress) * 4.5;
$corner_sculpting = function(progress) pow(progress, 2) * 2;
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
if (row == 0){
// TODO I didn't change these yet
$total_depth = 14.7 + extra_height;
$top_tilt = -12.5;
children();
} else if (row == 1) {
$total_depth = 13.1 + extra_height;
$top_tilt = -6;
children();
} else if (row == 2) {
$total_depth = 10.7 + extra_height;
$top_tilt = -6;
children();
} else if (row == 3) {
$total_depth = 10.7 + extra_height;
$top_tilt = 6;
children();
} else if (row == 4){
$total_depth = 11.6 + extra_height;
$top_tilt = 12;
children();
} else if (row >= 5) {
$total_depth = 11.6 + extra_height;
$top_tilt = 0;
children();
} else {
children();
}
}

View File

@ -1,4 +1,7 @@
module oem_row(n=3) {
use <../functions.scad>
include <../settings.scad>
module oem_row(row=3, column = 0) {
$bottom_key_width = 18.05;
$bottom_key_height = 18.05;
$width_difference = 5.8;
@ -10,24 +13,27 @@ module oem_row(n=3) {
$top_skew = 1.75;
$stem_inset = 1.2;
if (n == 5) {
$total_depth = 11.2;
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
if (row == 5 || row == 0) {
$total_depth = 11.2 + extra_height;
$top_tilt = -3;
children();
} else if (n == 1) {
$total_depth = 9.45;
} else if (row == 1) {
$total_depth = 9.45 + extra_height;
$top_tilt = 1;
children();
} else if (n == 2) {
$total_depth = 9;
} else if (row == 2) {
$total_depth = 9 + extra_height;
$top_tilt = 6;
children();
} else if (n == 3) {
$total_depth = 9.25;
} else if (row == 3) {
$total_depth = 9.25 + extra_height;
$top_tilt = 9;
children();
} else if (n == 4) {
$total_depth = 9.25;
} else if (row == 4) {
$total_depth = 9.25 + extra_height;
$top_tilt = 10;
children();
} else {

View File

@ -0,0 +1,68 @@
use <../functions.scad>
include <../settings.scad>
include <../constants.scad>
// Regular polygon shapes CIRCUMSCRIBE the sphere of diameter $bottom_key_width
// This is to make tiling them easier, like in the case of hexagonal keycaps etc
// this function doesn't set the key shape, so you can't use it directly without some fiddling
module regular_polygon_row(n=3, column=0) {
$bottom_key_width = $unit - 0.5;
$bottom_key_height = $unit - 0.5;
$width_difference = 0;
$height_difference = 0;
$dish_type = "spherical";
$dish_depth = 0.85;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 0;
$height_slices = 1;
$corner_radius = 1;
// this is _incredibly_ intensive
/* $rounded_key = true; */
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
base_depth = 7.5;
if (n <= 1){
$total_depth = base_depth + 2.5 + extra_height;
$top_tilt = -13;
children();
} else if (n == 2) {
$total_depth = base_depth + 0.5 + extra_height;
$top_tilt = -7;
children();
} else if (n == 3) {
$total_depth = base_depth + extra_height;
$top_tilt = 0;
children();
} else if (n == 4){
$total_depth = base_depth + 0.5 + extra_height;
$top_tilt = 7;
children();
} else {
$total_depth = base_depth + extra_height;
$top_tilt = 0;
children();
}
}
module hexagonal_row(n=3, column=0) {
$key_shape_type = "hexagon";
regular_polygon_row(n,column) {
children();
}
}
module octagonal_row(n=3, column=0) {
$key_shape_type = "octagon";
regular_polygon_row(n, column) {
children();
}
}

View File

@ -1,4 +1,7 @@
module sa_row(n=3) {
use <../functions.scad>
include <../settings.scad>
module sa_row(n=3, column=0) {
$key_shape_type = "sculpted_square";
$bottom_key_width = 18.4;
$bottom_key_height = 18.4;
@ -10,30 +13,42 @@ module sa_row(n=3) {
$dish_skew_y = 0;
$top_skew = 0;
$height_slices = 10;
// might wanna change this if you don't minkowski
// do you even minkowski bro
$corner_radius = 0.25;
$corner_radius = 1;
$more_side_sculpting_factor = 0.4;
$side_sculpting = function(progress) (1 - progress) * 4.5;
$corner_sculpting = function(progress) pow(progress, 2);
// this is _incredibly_ intensive
/* $rounded_key = true; */
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
// 5th row is usually unsculpted or the same as the row below it
// making a super-sculpted top row (or bottom row!) would be real easy
// bottom row would just be 13 tilt and 14.89 total depth
// top row would be something new entirely - 18 tilt maybe?
if (n == 1 || n == 5){
$total_depth = 14.89;
if (n <= 1){
$total_depth = 14.89 + extra_height;
$top_tilt = -13;
children();
} else if (n == 2) {
$total_depth = 12.925;
$total_depth = 12.925 + extra_height;
$top_tilt = -7;
children();
} else if (n == 3 || n == 5) {
$total_depth = 12.5;
} else if (n == 3) {
$total_depth = 12.5 + extra_height;
$top_tilt = 0;
children();
} else if (n == 4){
$total_depth = 12.925;
$total_depth = 12.925 + extra_height;
$top_tilt = 7;
children();
} else {
$total_depth = 12.5 + extra_height;
$top_tilt = 0;
children();
}
}

View File

@ -0,0 +1,59 @@
use <../functions.scad>
include <../settings.scad>
include <../constants.scad>
// Regular polygon shapes CIRCUMSCRIBE the sphere of diameter $bottom_key_width
// This is to make tiling them easier, like in the case of hexagonal keycaps etc
// this function doesn't set the key shape, so you can't use it directly without some fiddling
module typewriter_row(n=3, column=0) {
$bottom_key_width = $unit - 0.5;
$bottom_key_height = $unit - 0.5;
$width_difference = 0;
$height_difference = 0;
$dish_type = "spherical";
$key_shape_type = "circular";
$inverted_dish = true;
$stem_inset = -4.5;
$stem_throw = 5;
$dish_depth = 4;
$dish_skew_x = 0;
$dish_skew_y = 0;
$top_skew = 0;
$height_slices = 1;
$stem_support_type = "disable";
// $corner_radius = 1;
// this is _incredibly_ intensive
/* $rounded_key = true; */
$top_tilt_y = side_tilt(column);
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
base_depth = 3.5;
if (n <= 1){
$total_depth = base_depth + 2.5 + extra_height;
$top_tilt = -13;
children();
} else if (n == 2) {
$total_depth = base_depth + 0.5 + extra_height;
$top_tilt = -7;
children();
} else if (n == 3) {
$total_depth = base_depth + extra_height;
$top_tilt = 0;
children();
} else if (n == 4){
$total_depth = base_depth + 0.5 + extra_height;
$top_tilt = 7;
children();
} else {
$total_depth = base_depth + extra_height;
$top_tilt = 0;
children();
}
}

View File

@ -17,6 +17,10 @@ module 1_5u() {
u(1.5) children();
}
module 1_75u(){
u(1.75) children();
}
module 2u() {
u(2) children();
}
@ -25,6 +29,10 @@ module 2_25u() {
u(2.25) children();
}
module 2_50u() {
u(2.5) children();
}
module 2_75u() {
u(2.75) children();
}

View File

@ -1,10 +1,14 @@
// kind of a catch-all at this point for any directive that doesn't fit in the other files
//TODO duplicate def to not make this a special var. maybe not worth it
unit = 19.05;
include <constants.scad>
module translate_u(x=0, y=0, z=0){
translate([x * unit, y*unit, z*unit]) children();
translate([x * $unit, y*$unit, z*$unit]) children();
}
module no_stem_support() {
$stem_support_type = "disable";
children();
}
module brimmed_stem_support(height = 0.4) {
@ -39,9 +43,15 @@ module rotated() {
children();
}
module vertically_stabilized(mm=12, vertical=true, type=undef) {
stabilized(mm,vertical,type) {
children();
}
}
module stabilized(mm=12, vertical = false, type=undef) {
if (vertical) {
$stabilizer_type = type ? type : $stabilizer_type ? $stabilizer_type : "costar_stabilizer";
$stabilizer_type = (type ? type : ($stabilizer_type ? $stabilizer_type : "costar_stabilizer"));
$stabilizers = [
[0, mm],
[0, -mm]
@ -49,7 +59,8 @@ module stabilized(mm=12, vertical = false, type=undef) {
children();
} else {
$stabilizer_type = type ? type : $stabilizer_type ? $stabilizer_type : "costar_stabilizer";
$stabilizer_type = (type ? type : ($stabilizer_type ? $stabilizer_type : "costar_stabilizer"));
$stabilizers = [
[mm, 0],
@ -80,36 +91,58 @@ module blank() {
children();
}
module cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "cherry";
children();
}
module alps(slop) {
$stem_slop = slop ? slop : $stem_slop;
module alps(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "alps";
children();
}
module rounded_cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module rounded_cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "rounded_cherry";
children();
}
module box_cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module box_cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "box_cherry";
children();
}
module choc(slop) {
$stem_slop = slop ? slop : $stem_slop;
module choc(slop = 0.05) {
echo("WARN:\n\n * choc support is experimental.\n * $stem_slop is overridden.\n * it is also recommended to print them upside down if you can\n\n");
$stem_throw = 3;
$stem_slop = slop;
$bottom_key_width = 18;
$bottom_key_height = 17;
$stem_type = "choc";
children();
}
// a hacky way to make "low profile" keycaps
module low_profile() {
$width_difference = $width_difference / 1.5;
$height_difference = $height_difference / 1.5;
// helps tilted keycaps not have holes if worst comes to worst
$inner_shape_type = "dished";
$top_tilt = $top_tilt / 1.25;
$total_depth = ($total_depth / 2) < 7 ? 7 : $total_depth / 2;
// just to make sure
$stem_throw = 3;
children();
}
module flared_support() {
$support_type = "flared";
children();
@ -125,9 +158,17 @@ module flat_support() {
children();
}
module legend(text, position=[0,0], size=undef) {
module legend(text, position=[0,0], size=undef, font=undef) {
font_size = size == undef ? $font_size : size;
$legends = [for(L=[$legends, [[text, position, font_size]]], a=L) a];
font_face = font == undef ? $font : font;
$legends = [for(L=[$legends, [[text, position, font_size, font_face]]], a=L) a];
children();
}
module front_legend(text, position=[0,0], size=undef, font=undef) {
font_size = size == undef ? $font_size : size;
font_face = font == undef ? $font : font;
$front_legends = [for(L=[$front_legends, [[text, position, font_size, font_face]]], a=L) a];
children();
}
@ -137,10 +178,113 @@ module bump(depth=undef) {
children();
}
module low_profile() {
/* $total_depth = 5.35; */
/* extra ugly hack right now to make sure we don't generate keycaps with insufficient throw */
/* $total_depth = ($total_depth / 2) < 6 ? 6 : $total_depth / 2; */
$stem_throw = 3;
// kinda dirty, but it works
// might not work great with fully sculpted profiles yet
// NOTE: this needs to come after row declarations or it won't work
module upside_down() {
if ($stem_inner_slop != 0) {
echo("it is recommended you set inner stem slop to 0 when you use upside_down()");
}
$stem_support_type = "disable";
// $top_tilt*2 because top_placement rotates by top_tilt for us
// 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]) {
children();
}
}
module sideways() {
$stem_support_type = "disable";
$key_shape_type = "flat_sided_square";
$dish_overdraw_width = abs(extra_keytop_length_for_flat_sides());
extra_y_rotation = atan2($width_difference/2,$total_depth); // TODO assumes centered top
translate([0,0,cos(extra_y_rotation) * total_key_width()/2])
rotate([0,90 + extra_y_rotation ,0]) children();
}
/* this is hard to explain. we want the angle of the back of the keycap.
* first we draw a line at the back of the keycap perpendicular to the ground.
* then we extend the line created by the slope of the keytop to that line
* the angle of the latter line off the ground is $top_tilt, and
* you can create a right triangle with the adjacent edge being $bottom_key_height/2
* raised up $total_depth. this gets you x, the component of the extended
* keytop slope line, and y, a component of the first perpendicular line.
* by a very similar triangle you get r and s, where x is the hypotenuse of that
* right triangle and the right angle is again against the first perpendicular line
* s is the opposite line in the right triangle required to find q, the angle
* of the back. if you subtract r from $total_depth plus y you can now use these
* two values in atan to find the angle of interest.
*/
module backside() {
$stem_support_type = "disable";
// $key_shape_type = "flat_sided_square";
a = $bottom_key_height;
b = $total_depth;
c = top_total_key_height();
x = (a / 2 - $top_skew) / cos(-$top_tilt) - c / 2;
y = sin(-$top_tilt) * (x + c/2);
r = sin(-$top_tilt) * x;
s = cos(-$top_tilt) * x;
q = atan2(s, (y + b - r));
translate([0,0,cos(q) * total_key_height()/2])
rotate([-90 - q, 0,0]) children();
}
// this is just backside with a few signs switched
module frontside() {
$stem_support_type = "disable";
// $key_shape_type = "flat_sided_square";
a = $bottom_key_height;
b = $total_depth;
c = top_total_key_height();
x = (a / 2 + $top_skew) / cos($top_tilt) - c / 2;
y = sin($top_tilt) * (x + c/2);
r = sin($top_tilt) * x;
s = cos($top_tilt) * x;
q = atan2(s, (y + b - r));
translate([0,0,cos(q) * total_key_height()/2])
rotate([90 + q, 0,0]) children();
}
// emulating the % modifier.
// since we use custom colors, just using the % modifier doesn't work
module debug() {
$primary_color = [0.5,0.5,0.5,0.2];
$secondary_color = [0.5,0.5,0.5,0.2];
$tertiary_color = [0.5,0.5,0.5,0.2];
$quaternary_color = [0.5,0.5,0.5,0.2];
%children();
}
// auto-place children in a grid.
// For this to work all children have to be single keys, no for loops etc
module auto_place() {
num_children = $children;
row_size = round(pow(num_children, 0.5));
for (child_index = [0:num_children-1]) {
x = child_index % row_size;
y = floor(child_index / row_size);
translate_u(x,-y) children(child_index);
}
}
// suggested settings for resin prints
module resin() {
$stem_slop = 0;
$stem_inner_slop = 0;
$stem_support_type = "disable";
children();
}

View File

@ -1,6 +1,10 @@
include <functions.scad>
use <key_sizes.scad>
use <key_transformations.scad>
module spacebar() {
$inverted_dish = true;
$dish_type = "sideways cylindrical";
$inverted_dish = $dish_type != "disable";
$dish_type = $dish_type != "disable" ? "sideways cylindrical" : "disable";
6_25u() stabilized(mm=50) children();
}
@ -43,15 +47,19 @@ module iso_enter() {
$key_length = 1.5;
$key_height = 2;
$top_tilt = 0;
$dish_offset_x = -(unit_length(1.5) - unit_length(1.25))/2;
/* $top_tilt = 0; */
$stem_support_type = "disable";
$key_shape_type = "iso_enter";
$linear_extrude_shape = true;
$hull_shape_type = "skin";
$linear_extrude_height_adjustment = 19.05 * 0.5;
// this equals (unit_length(1.5) - unit_length(1.25)) / 2
$dish_overdraw_width = 2.38125;
/* $dish_overdraw_width = 2.38125; */
render() {
stabilized(vertical=true) {
children();
}
}
}

View File

@ -0,0 +1,21 @@
include <../layout.scad>
60_percent_default_layout = [
[1,1,1,1,1,1,1,1,1,1,1,1,1,2],
[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25],
[2.25,1,1,1,1,1,1,1,1,1,1,2.75],
[1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25]
];
60_percent_legends = [
["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫"],
["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\"],
["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter"],
["shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "shift"],
["ctl", "win", "alt", "", "mnu", "win", "alt", "ctl"],
];
module 60_percent_default(profile) {
layout(60_percent_default_layout, profile, 60_percent_legends, row_sculpting_offset=1) children();
}

View File

@ -0,0 +1,26 @@
include <../layout.scad>
dactyl_manuform_4x6_main = [
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[-1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1]
];
dactyl_manuform_4x6_thumbs_l = [
[1.25, 1.25],
[-0.25, 1, 1],
[-0.25, 1, 1]
];
dactyl_manuform_4x6_thumbs_r = [
[1.25, 1.25],
[-0.25, 1, 1],
[-0.25, 1, 1]
];
module dactyl_manuform_4x6(profile) {
layout(dactyl_manuform_4x6_main, profile) children();
translate_u(3,-5) rotate([0,0,25])layout(dactyl_manuform_4x6_thumbs_l, profile, row_override=3) children();
translate_u(7.75,-3.95) rotate([0,0,-25])layout(dactyl_manuform_4x6_thumbs_r, profile, row_override=3) children();
}

View File

@ -0,0 +1,64 @@
include <../layout.scad>
dactyl_manuform_4x6_main = [
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[-1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1]
];
dactyl_manuform_4x6_thumbs_l = [
[1.25, 1.25],
[-0.25, 1, 1],
[-0.25, 1, 1]
];
dactyl_manuform_4x6_thumbs_r = [
[1.25, 1.25],
[-0.25, 1, 1],
[-0.25, 1, 1]
];
dactyl_manuform_4x6_main_legends = [
["ESC", "Q", "W", "E", "R", "T", "", "Y", "U", "I", "O", "P", "{["],
["LS", "A", "S", "D", "F", "G", "", "H", "J", "K", "L", ";:", "'\""],
["TAB", "Z", "X", "C", "V", "B", "", "N", "M", ",<", ".>", "/?", "\\|"],
["", "", "CAPS", "T(1)", "", "", "", "", "", "T(2)", "]}", "", ""]
];
dactyl_manuform_4x6_main_front_legends = [
["F1", "F2", "F3", "F4", "F5", "F6", "", "F7", "F8", "F9", "F10", "F11", "F12"],
["", "", "", "", "", "PGUP", "", "", "UP", "", "", "", ""],
["", "", "", "", "", "PGDN", "", "LFT", "DWN", "RHT", "", "", ""],
["", "", "", "T(0)", "", "", "", "", "", "T(2)", "", "", ""]
];
dactyl_manuform_4x6_thumbs_l_legends = [
["~`", "LCTL"],
["", "RALT", "LCMD"],
["", "MEH", "T(2)"]
];
dactyl_manuform_4x6_thumbs_l_front_legends = [
["", ""],
["", "PSC", "LCMD"],
["", "", "TEMP"]
];
dactyl_manuform_4x6_thumbs_r_legends = [
["", "BKSP"],
["", "ENTR", "CP"],
["", "T(1)", "PST"]
];
dactyl_manuform_4x6_thumbs_r_front_legends = [
["", ""],
["", "", ""],
["", "TEMP", ""]
];
module dactyl_manuform_4x6_legends(profile, row_sculpting_offset=1, column_override=undef) {
layout(dactyl_manuform_4x6_main, profile, legends=dactyl_manuform_4x6_main_legends, front_legends=dactyl_manuform_4x6_main_front_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") children();
translate_u(3,-5) rotate([0,0,25]) layout(dactyl_manuform_4x6_thumbs_l, profile, legends=dactyl_manuform_4x6_thumbs_l_legends, front_legends=dactyl_manuform_4x6_thumbs_l_front_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") children();
translate_u(7.75,-3.95) rotate([0,0,-25]) layout(dactyl_manuform_4x6_thumbs_r, profile, legends=dactyl_manuform_4x6_thumbs_r_legends, front_legends=dactyl_manuform_4x6_thumbs_r_front_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") children();
}

View File

@ -0,0 +1,18 @@
include <../layout.scad>
// negative numbers are used for spacing
gherkin_default_layout = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
];
gherkin_default_legends = [
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
["a", "s", "d", "f", "g", "h", "j", "k", "l", ";"],
["z", "x", "c", "v", "b", "n", "m", ",", ".", "/"],
];
module gherkin_default(profile) {
layout(gherkin_default_layout, profile, legends=gherkin_default_legends, row_sculpting_offset=1, row_override=3) children();
}

View File

@ -0,0 +1,22 @@
include <../layout.scad>
// negative numbers are used for spacing
gherkin_bump_mapping = [
[1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1],
[-1, -1, -1, -1, 2, -1, -1, -1, -1],
];
gherkin_bump_legends = [
["q", "w", "e", "r", "t", "", "y", "u", "i", "o", "p"],
["a", "s", "d", "f", "g", "", "h", "j", "k", "l", ";"],
["z", "x", "c", "v", "b", "", "n", "m", ",", ".", "/"],
["", "", "", "", "", "", "", "", ""],
];
module gherkin_bump_layout(profile, row_sculpting_offset=1, column_override=undef) {
layout(gherkin_bump_mapping, profile, legends=gherkin_bump_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") {
children();
};
}

View File

@ -0,0 +1,21 @@
include <../layout.scad>
hhkb_layout = [
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25],
[2.25,1,1,1,1,1,1,1,1,1,1,1.75,1],
[-1.5,1,1.5,6,1.5,1]
];
hhkb_legends = [
["Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "\\", "`"],
["Tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "Delete"],
["Ctrl", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "Return"],
["Shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "Shift", "Fn"],
["", "Alt", "Cmd", "", "Cmd", "Alt"],
];
module hhkb_default(profile) {
layout(hhkb_layout, profile, hhkb_legends) children();
}

134
src/layouts/layout.scad Normal file
View File

@ -0,0 +1,134 @@
use <../key_transformations.scad>
use <../key_profiles.scad>
use <../key_sizes.scad>
use <../key_types.scad>
// sums all values, unless a value is negative, in which case it makes it positive
// dirty hack to allow for large gaps in keysets
function abs_sum(list, x=0) =
len(list) <= 1 ?
x + abs(list[0]) :
abs_sum([for (x = [1: len(list) - 1]) list[x]], x+abs(list[0]));
function 2hands(index, total) = ((index+0.5) % (total/2)) - (total/4);
function cresting_wave(index, total, mod=4) = (index < total/2) ? (((index + 0.5) / total)*mod) : -(mod - ((index + 0.5) / total * mod));
function 1hand(index, total) = (index % (total)) - (total/2);
// chooses between all the sculpting options
// checks if column is smack in middle of row - if so, no sculpting
// since we are zero indexed, the 7th row has an index of 6 and is the center of 13. 6*2+1 = 13
function double_sculpted_column(column, row_length, column_sculpt_profile) =
(column*2 + 1 == row_length) ?
0 : (column_sculpt_profile == "2hands") ?
2hands(column, row_length) : (column_sculpt_profile == "1hand") ?
1hand(column, row_length) : (column_sculpt_profile == "cresting_wave") ?
cresting_wave(column, row_length) : 0;
module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) {
for (row = [0:len(list)-1]){
/* echo("**ROW**:", row); */
row_length = len(list[row]);
for(column = column_override ? column_override : [0:len(list[row])-1]) {
row_sculpting = (row_override != undef ? row_override : row) + row_sculpting_offset;
key_length = list[row][column];
column_value = double_sculpted_column(column, row_length, column_sculpt_profile);
column_distance = abs_sum([for (x = [0 : column]) list[row][x]]);
/* echo("\t**COLUMN**", "column_value", column_value, "column_distance", column_distance); */
// supports negative values for nonexistent keys
if (key_length >= 1) {
translate_u(column_distance - (key_length/2), -row) {
key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") front_legend(front_legends ? front_legends[row][column] : "") cherry() { // (row+4) % 5 + 1
$row = row;
$column = column;
if (key_length == 6.25) {
spacebar() {
if ($children) {
children();
} else {
key();
}
}
} else if (key_length == 2.25) {
lshift() {
if ($children) {
children();
} else {
key();
}
}
} else if (key_length == 2) {
backspace() {
if ($children) {
children();
} else {
key();
}
}
} else if (key_length == 2.75) {
rshift() {
if ($children) {
children();
} else {
key();
}
}
} else {
{
if ($children) {
children();
} else {
key();
}
}
}
}
}
}
}
}
}
// much simpler, decoupled layout function
// requires more setup - it only does what is in the layout array, which is translate
// and key length. you have to do row / column profile yourself and always pass
// children()
// this is probably the way we'll go forward
module simple_layout(list) {
for (row = [0:len(list)-1]){
/* echo("**ROW**:", row); */
for(column = [0:len(list[row])-1]) {
key_length = list[row][column];
column_distance = abs_sum([for (x = [0 : column]) list[row][x]]);
/* echo("\t**COLUMN**", "column_value", column_value, "column_distance", column_distance); */
// supports negative values for nonexistent keys
if (key_length >= 1) {
translate_u(column_distance - (key_length/2), -row) {
u(key_length) { // (row+4) % 5 + 1
$row = row;
$column = column;
if (key_length == 6.25) {
spacebar() children();
} else if (key_length == 2.25) {
lshift() children();
} else if (key_length == 2) {
backspace() children();
} else if (key_length == 2.75) {
rshift() children();
} else {
children();
}
}
}
}
}
}
}

View File

@ -0,0 +1,13 @@
include <../layout.scad>
// negative numbers are used for spacing
lets_split_layout = [
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1]
];
module lets_split_default(profile) {
layout(lets_split_layout, profile, row_sculpting_offset=1) children();
}

View File

@ -0,0 +1,23 @@
include <../layout.scad>
// 0's are to make space for a middle row for just the spacebar so that it
// isn't sculpted with double sculpting. the 0's in the first three rows
// don't _need_ to be there but it's nice to keep track
planck_default_layout = [
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1]
];
planck_default_legends = [
[ "⇥", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "⌫"],
["Esc", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "⏎"],
[ "⇧", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "⇧"],
[ "Fn", "Ctl", "Alt", "Cmd", "Lwr", "", "", "RSE", "←", "↓", "↑", "→"],
];
module planck_default(profile, column_sculpt_profile="2hands") {
layout(planck_default_layout, profile, row_sculpting_offset=1, column_sculpt_profile=column_sculpt_profile) children();
}

View File

@ -0,0 +1,15 @@
include <../layout.scad>
// 0's are to make space for a middle row for just the spacebar so that it
// isn't sculpted with double sculpting. the 0's in the first three rows
// don't _need_ to be there but it's nice to keep track
planck_layout_mapping = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
module planck_mit(profile) {
layout(planck_layout_mapping, profile, row_sculpting_offset=1) children();
}

29
src/layouts/plate.scad Normal file
View File

@ -0,0 +1,29 @@
// No support for stabilizers yet - but should be easy enough
// Won't work well for split layouts. or, it'll work fine - but it'll only be
// one plate.
// each corner
module unit_corners(height = 3, radius=3, $fn=24) {
positions = [
[-$key_length/2, -$key_height/2],
[$key_length/2, -$key_height/2],
[$key_length/2, $key_height/2],
[-$key_length/2, $key_height/2],
];
for (position = positions) {
translate_u(position.x, position.y) cylinder(h=height, r=radius, $fn=$fn);
}
}
module switch_hole() {
cube(14, center=true);
}
module plate(layout_object) {
difference() {
hull() {
simple_layout(layout_object) unit_corners();
}
simple_layout(layout_object) switch_hole();
}
}

View File

@ -0,0 +1,21 @@
include <../layout.scad>
preonic_default_layout = [
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1]
];
preonic_default_legends = [
[ "`", "1", "2", "3", "4", "5", "", "6", "7", "8", "9", "0", "-"],
[ "⇥", "Q", "W", "E", "R", "T", "", "Y", "U", "I", "O", "P", "⌫"],
["Esc", "A", "S", "D", "F", "G", "", "H", "J", "K", "L", ";", "⏎"],
[ "⇧", "Z", "X", "C", "V", "B", "", "N", "M", ",", ".", "/", "⇧"],
[ "Fn", "Ctl", "Alt", "Cmd", "Lwr", "", "", "", "RSE", "←", "↓", "↑", "→"],
];
module preonic_default(profile, column_sculpt_profile="2hands") {
layout(preonic_default_layout, profile, column_sculpt_profile=column_sculpt_profile) children();
}

View File

@ -0,0 +1,21 @@
include <../layout.scad>
preonic_mit_layout = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
preonic_mit_legends = [
[ "`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-"],
[ "⇥", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "⌫"],
["Esc", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "⏎"],
[ "⇧", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "⇧"],
[ "Fn", "Ctl", "Alt", "Cmd", "Lwr", "", "", "RSE", "←", "↓", "↑", "→"],
];
module planck_mit(profile) {
layout(preonic_mit_layout, profile, legends=preonic_mit_legends, row_sculpting_offset=1) children();
}

View File

@ -0,0 +1,19 @@
include <../layout.scad>
project_zen_main = [
[1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
[1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
[1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
[1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
[1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5]
];
project_zen_thumbs = [
[2,2],
[2,2],
];
module project_zen_default(profile) {
layout(project_zen_main, profile) children();
translate_u(4.5,-5) layout(project_zen_thumbs, profile, row_override=3) children();
}

View File

@ -0,0 +1,79 @@
// thanks Paul https://github.com/openscad/list-comprehension-demos/
include <../functions.scad>
module 3d_surface(size=$3d_surface_size, step=$3d_surface_step, bottom=-SMALLEST_POSSIBLE){
function p(x, y) = [ x, y, max(0,$surface_function(x, y) * $corner_smoothing_surface_function(x,y)) ];
function p0(x, y) = [ x, y, bottom ];
function rev(b, v) = b ? v : [ v[3], v[2], v[1], v[0] ];
function face(x, y) = [ p(x, y + step), p(x + step, y + step), p(x + step, y), p(x + step, y), p(x, y), p(x, y + step) ];
function fan(a, i) =
a == 0 ? [ [ 0, 0, bottom ], [ i, -size, bottom ], [ i + step, -size, bottom ] ]
: a == 1 ? [ [ 0, 0, bottom ], [ i + step, size, bottom ], [ i, size, bottom ] ]
: a == 2 ? [ [ 0, 0, bottom ], [ -size, i + step, bottom ], [ -size, i, bottom ] ]
: [ [ 0, 0, bottom ], [ size, i, bottom ], [ size, i + step, bottom ] ];
function sidex(x, y) = [ p0(x, y), p(x, y), p(x + step, y), p0(x + step, y) ];
function sidey(x, y) = [ p0(x, y), p(x, y), p(x, y + step), p0(x, y + step) ];
points = flatten(concat(
// top surface
[ for (x = [ -size : step : size - step ], y = [ -size : step : size - step ]) face(x, y) ],
// bottom surface as triangle fan
[ for (a = [ 0 : 3 ], i = [ -size : step : size - step ]) fan(a, i) ],
// sides
[ for (x = [ -size : step : size - step ], y = [ -size, size ]) rev(y < 0, sidex(x, y)) ],
[ for (y = [ -size : step : size - step ], x = [ -size, size ]) rev(x > 0, sidey(x, y)) ]
));
tcount = 2 * pow(2 * size / step, 2) + 8 * size / step;
scount = 8 * size / step;
tfaces = [ for (a = [ 0 : 3 : 3 * (tcount - 1) ] ) [ a, a + 1, a + 2 ] ];
sfaces = [ for (a = [ 3 * tcount : 4 : 3 * tcount + 4 * scount ] ) [ a, a + 1, a + 2, a + 3 ] ];
faces = concat(tfaces, sfaces);
polyhedron(points, faces, convexity = 8);
}
module polar_3d_surface(size, step, bottom=-SMALLEST_POSSIBLE){
function to_polar(q, size) = q * (90 / size);
function p(x, y) = [
$surface_distribution_function(to_polar(x, size), size),
$surface_distribution_function(to_polar(y, size), size),
max(0,$surface_function($surface_distribution_function(to_polar(x, size), size), $surface_distribution_function(to_polar(y, size), size)) * $corner_smoothing_surface_function($surface_distribution_function(to_polar(x, size), size), $surface_distribution_function(to_polar(y, size), size)))
];
function p0(x, y) = [ x, y, bottom ];
function rev(b, v) = b ? v : [ v[3], v[2], v[1], v[0] ];
function face(x, y) = [ p(x, y + step), p(x + step, y + step), p(x + step, y), p(x + step, y), p(x, y), p(x, y + step) ];
function fan(a, i) =
a == 0 ? [ [ 0, 0, bottom ], [ i, -size, bottom ], [ i + step, -size, bottom ] ]
: a == 1 ? [ [ 0, 0, bottom ], [ i + step, size, bottom ], [ i, size, bottom ] ]
: a == 2 ? [ [ 0, 0, bottom ], [ -size, i + step, bottom ], [ -size, i, bottom ] ]
: [ [ 0, 0, bottom ], [ size, i, bottom ], [ size, i + step, bottom ] ];
function sidex(x, y) = [ p0(x, y), p(x, y), p(x + step, y), p0(x + step, y) ];
function sidey(x, y) = [ p0(x, y), p(x, y), p(x, y + step), p0(x, y + step) ];
points = flatten(concat(
// top surface
[ for (x = [ -size : step : size - step ], y = [ -size : step : size - step ]) face(x, y) ],
// bottom surface as triangle fan
[ for (a = [ 0 : 3 ], i = [ -size : step : size - step ]) fan(a, i) ],
// sides
[ for (x = [ -size : step : size - step ], y = [ -size, size ]) rev(y < 0, sidex(x, y)) ],
[ for (y = [ -size : step : size - step ], x = [ -size, size ]) rev(x > 0, sidey(x, y)) ]
));
tcount = 2 * pow(2 * size / step, 2) + 8 * size / step;
scount = 8 * size / step;
tfaces = [ for (a = [ 0 : 3 : 3 * (tcount - 1) ] ) [ a, a + 1, a + 2 ] ];
sfaces = [ for (a = [ 3 * tcount : 4 : 3 * tcount + 4 * scount ] ) [ a, a + 1, a + 2, a + 3 ] ];
faces = concat(tfaces, sfaces);
polyhedron(points, faces, convexity = 8);
}
// defaults, overridden in functions.scad
// $surface_distribution_function = function(dim, size) sin(dim) * size;
// $surface_function = function(x,y) (sin(acos(x/$3d_surface_size))) * sin(acos(y/$3d_surface_size));

View File

@ -0,0 +1,687 @@
// Library: round-anything
// Version: 1.0
// Author: IrevDev
// Contributors: TLC123
// Copyright: 2020
// License: MIT
function addZcoord(points,displacement)=[for(i=[0:len(points)-1])[points[i].x,points[i].y, displacement]];
function translate3Dcoords(points,tran=[0,0,0],mult=[1,1,1])=[for(i=[0:len(points)-1])[
(points[i].x*mult.x)+tran.x,
(points[i].y*mult.y)+tran.y,
(points[i].z*mult.z)+tran.z
]];
function offsetPolygonPoints(points, offset=0)=
// Work sthe same as the offset does, except for the fact that instead of a 2d shape
// It works directly on polygon points
// It returns the same number of points just offset into or, away from the original shape.
// points= a series of x,y points[[x1,y1],[x2,y2],...]
// offset= amount to offset by, negative numbers go inwards into the shape, positive numbers go out
// return= a series of x,y points[[x1,y1],[x2,y2],...]
let(
isCWorCCW=sign(offset)*CWorCCW(points)*-1,
lp=len(points)
)
[for(i=[0:lp-1]) parallelFollow([
points[listWrap(i-1,lp)],
points[i],
points[listWrap(i+1,lp)],
],thick=offset,mode=isCWorCCW)];
function makeCurvedPartOfPolyHedron(radiiPoints,r,fn,minR=0.01)=
// this is a private function that I'm not expecting library users to use directly
// radiiPoints= serise of x, y, r points
// r= radius of curve that will be put on the end of the extrusion
// fn= amount of subdivisions
// minR= if one of the points in radiiPoints is less than r, it's likely to converge and form a sharp edge,
// the min radius on these converged edges can be controled with minR, though because of legacy reasons it can't be 0, but can be a very small number.
// return= array of [polyhedronPoints, Polyhedronfaces, theLength of a singe layer in the curve]
let(
lp=len(radiiPoints),
radii=[for(i=[0:lp-1])radiiPoints[i].z],
isCWorCCWOverall=CWorCCW(radiiPoints),
dir=sign(r),
absR=abs(r),
fractionOffLp=1-1/fn,
allPoints=[for(fraction=[0:1/fn:1])
let(
iterationOffset=dir*sqrt(sq(absR)-sq(fraction*absR))-dir*absR,
theOffsetPoints=offsetPolygonPoints(radiiPoints,iterationOffset),
polyRoundOffsetPoints=[for(i=[0:lp-1])
let(
pointsAboutCurrent=[
theOffsetPoints[listWrap(i-1,lp)],
theOffsetPoints[i],
theOffsetPoints[listWrap(i+1,lp)]
],
isCWorCCWLocal=CWorCCW(pointsAboutCurrent),
isInternalRadius=(isCWorCCWLocal*isCWorCCWOverall)==-1,
// the radius names are only true for positive r,
// when are r is negative increasingRadius is actually decreasing and vice-vs
// increasingRadiusWithPositiveR is just to verbose of a variable name for my liking
increasingRadius=max(radii[i]-iterationOffset, minR),
decreasingRadius=max(radii[i]+iterationOffset, minR)
)
[theOffsetPoints[i].x, theOffsetPoints[i].y, isInternalRadius? increasingRadius: decreasingRadius]
],
pointsForThisLayer=polyRound(polyRoundOffsetPoints,fn)
)
addZcoord(pointsForThisLayer,fraction*absR)
],
polyhedronPoints=flatternArray(allPoints),
allLp=len(allPoints),
layerLength=len(allPoints[0]),
loopToSecondLastLayer=allLp-2,
sideFaces=[for(layerIndex=[0:loopToSecondLastLayer])let(
currentLayeroffset=layerIndex*layerLength,
nextLayeroffset=(layerIndex+1)*layerLength,
layerFaces=[for(subLayerIndex=[0:layerLength-1])
[
currentLayeroffset+subLayerIndex, currentLayeroffset + listWrap(subLayerIndex+1,layerLength), nextLayeroffset+listWrap(subLayerIndex+1,layerLength), nextLayeroffset+subLayerIndex]
]
)layerFaces],
polyhedronFaces=flatternArray(sideFaces)
)
[polyhedronPoints, polyhedronFaces, layerLength];
function flatternRecursion(array, init=[], currentIndex)=
// this is a private function, init and currentIndex are for the function's use
// only for when it's calling itself, which is why there is a simplified version flatternArray that just calls this one
// array= array to flattern by one level of nesting
// init= the array used to cancat with the next call, only for when the function calls itself
// currentIndex= so the function can keep track of how far it's progressed through the array, only for when it's calling itself
// returns= flatterned array, by one level of nesting
let(
shouldKickOffRecursion=currentIndex==undef?1:0,
isLastIndex=currentIndex+1==len(array)?1:0,
flatArray=shouldKickOffRecursion?flatternRecursion(array,[],0):
isLastIndex?concat(init,array[currentIndex]):
flatternRecursion(array,concat(init,array[currentIndex]),currentIndex+1)
)
flatArray;
function flatternArray(array)=
// public version of flatternRecursion, has simplified params to avoid confusion
// array= array to be flatterned
// return= array that been flatterend by one level of nesting
flatternRecursion(array);
function offsetAllFacesBy(array,offset)=[
// polyhedron faces are simply a list of indices to points, if your concat points together than you probably need to offset
// your faces array to points to the right place in the new list
// array= array of point indicies
// offset= number to offset all indecies by
// return= array of point indices (i.e. faces) with offset applied
for(faceIndex=[0:len(array)-1])[
for(pointIndex=[0:len(array[faceIndex])-1])array[faceIndex][pointIndex]+offset
]
];
function extrudePolygonWithRadius(radiiPoints,h=5,r1=1,r2=1,fn=4)=
// this basically calls makeCurvedPartOfPolyHedron twice to get the curved section of the final polyhedron
// and then goes about assmbling them, as the side faces and the top and bottom face caps are missing
// radiiPoints= series of [x,y,r] points,
// h= height of the extrude (total including radius sections)
// r1,r2= define the radius at the top and bottom of the extrud respectively, negative number flange out the extrude
// fn= number of subdivisions
// returns= [polyhedronPoints, polyhedronFaces]
let(
// top is the top curved part of the extrude
top=makeCurvedPartOfPolyHedron(radiiPoints,r1,fn),
topRadiusPoints=translate3Dcoords(top[0],[0,0,h-r1]),
singeLayerLength=top[2],
topRadiusFaces=top[1],
radiusPointsLength=len(topRadiusPoints), // is the same length as bottomRadiusPoints
// bottom is the bottom curved part of the extrude
bottom=makeCurvedPartOfPolyHedron(radiiPoints,r2,fn),
// Z axis needs to be multiplied by -1 to flip it so the radius is going in the right direction [1,1,-1]
bottomRadiusPoints=translate3Dcoords(bottom[0],[0,0,abs(r2)],[1,1,-1]),
// becaues the points will be all concatenated into the same array, and the bottom points come second, than
// the original indices the faces are points towards are wrong and need to have an offset applied to them
bottomRadiusFaces=offsetAllFacesBy(bottom[1],radiusPointsLength),
// all of the side panel of the extrusion, connecting points from the inner layers of each
// of the curved sections
sideFaces=[for(i=[0:singeLayerLength-1])[
i,
listWrap(i+1,singeLayerLength),
radiusPointsLength + listWrap(i+1,singeLayerLength),
radiusPointsLength + i
]],
// both of these caps are simple every point from the last layer of the radius points
topCapFace=[for(i=[0:singeLayerLength-1])radiusPointsLength-singeLayerLength+i],
bottomCapFace=[for(i=[0:singeLayerLength-1])radiusPointsLength*2-singeLayerLength+i],
finalPolyhedronPoints=concat(topRadiusPoints,bottomRadiusPoints),
finalPolyhedronFaces=concat(topRadiusFaces,bottomRadiusFaces, sideFaces, [topCapFace], [bottomCapFace])
)
[
finalPolyhedronPoints,
finalPolyhedronFaces
];
module polyRoundExtrude(radiiPoints,length=5,r1=1,r2=1,fn=10,convexity=10) {
polyhedronPointsNFaces=extrudePolygonWithRadius(radiiPoints,length,r1,r2,fn);
polyhedron(points=polyhedronPointsNFaces[0], faces=polyhedronPointsNFaces[1], convexity=convexity);
}
// testingInternals();
module testingInternals(){
//example of rounding random points, this has no current use but is a good demonstration
random=[for(i=[0:20])[rnd(0,50),rnd(0,50),/*rnd(0,30)*/1000]];
R =polyRound(random,7);
translate([-25,25,0]){
polyline(R);
}
//example of different modes of the CentreN2PointsArc() function 0=shortest arc, 1=longest arc, 2=CW, 3=CCW
p1=[0,5];p2=[10,5];centre=[5,0];
translate([60,0,0]){
color("green"){
polygon(CentreN2PointsArc(p1,p2,centre,0,20));//draws the shortest arc
}
color("cyan"){
polygon(CentreN2PointsArc(p1,p2,centre,1,20));//draws the longest arc
}
}
translate([75,0,0]){
color("purple"){
polygon(CentreN2PointsArc(p1,p2,centre,2,20));//draws the arc CW (which happens to be the short arc)
}
color("red"){
polygon(CentreN2PointsArc(p2,p1,centre,2,20));//draws the arc CW but p1 and p2 swapped order resulting in the long arc being drawn
}
}
radius=6;
radiipoints=[[0,0,0],[10,20,radius],[20,0,0]];
tangentsNcen=round3points(radiipoints);
translate([10,0,0]){
for(i=[0:2]){
color("red")translate(getpoints(radiipoints)[i])circle(1);//plots the 3 input points
color("cyan")translate(tangentsNcen[i])circle(1);//plots the two tangent poins and the circle centre
}
translate([tangentsNcen[2][0],tangentsNcen[2][1],-0.2])circle(r=radius,$fn=25);//draws the cirle
%polygon(getpoints(radiipoints));//draws a polygon
}
}
function polyRound(radiipoints,fn=5,mode=0)=
/*Takes a list of radii points of the format [x,y,radius] and rounds each point
with fn resolution
mode=0 - automatic radius limiting - DEFAULT
mode=1 - Debug, output radius reduction for automatic radius limiting
mode=2 - No radius limiting*/
let(
p=getpoints(radiipoints), //make list of coordinates without radii
Lp=len(p),
//remove the middle point of any three colinear points, otherwise adding a radius to the middle of a straigh line causes problems
radiiPointsWithoutTrippleColinear=[
for(i=[0:len(p)-1]) if(
// keep point if it isn't colinear or if the radius is 0
!isColinear(
p[listWrap(i-1,Lp)],
p[listWrap(i+0,Lp)],
p[listWrap(i+1,Lp)]
)||
p[listWrap(i+0,Lp)].z!=0
) radiipoints[listWrap(i+0,Lp)]
],
newrp2=processRadiiPoints(radiiPointsWithoutTrippleColinear),
plusMinusPointRange=mode==2?1:2,
temp=[
for(i=[0:len(newrp2)-1]) //for each point in the radii array
let(
thepoints=[for(j=[-plusMinusPointRange:plusMinusPointRange])newrp2[listWrap(i+j,len(newrp2))]],//collect 5 radii points
temp2=mode==2?round3points(thepoints,fn):round5points(thepoints,fn,mode)
)
mode==1?temp2:newrp2[i][2]==0?
[[newrp2[i][0],newrp2[i][1]]]: //return the original point if the radius is 0
CentreN2PointsArc(temp2[0],temp2[1],temp2[2],0,fn) //return the arc if everything is normal
]
)
[for (a = temp) for (b = a) b];//flattern and return the array
function round5points(rp,fn,debug=0)=
rp[2][2]==0&&debug==0?[[rp[2][0],rp[2][1]]]://return the middle point if the radius is 0
rp[2][2]==0&&debug==1?0://if debug is enabled and the radius is 0 return 0
let(
p=getpoints(rp), //get list of points
r=[for(i=[1:3]) abs(rp[i][2])],//get the centre 3 radii
//start by determining what the radius should be at point 3
//find angles at points 2 , 3 and 4
a2=cosineRuleAngle(p[0],p[1],p[2]),
a3=cosineRuleAngle(p[1],p[2],p[3]),
a4=cosineRuleAngle(p[2],p[3],p[4]),
//find the distance between points 2&3 and between points 3&4
d23=pointDist(p[1],p[2]),
d34=pointDist(p[2],p[3]),
//find the radius factors
F23=(d23*tan(a2/2)*tan(a3/2))/(r[0]*tan(a3/2)+r[1]*tan(a2/2)),
F34=(d34*tan(a3/2)*tan(a4/2))/(r[1]*tan(a4/2)+r[2]*tan(a3/2)),
newR=min(r[1],F23*r[1],F34*r[1]),//use the smallest radius
//now that the radius has been determined, find tangent points and circle centre
tangD=newR/tan(a3/2),//distance to the tangent point from p3
circD=newR/sin(a3/2),//distance to the circle centre from p3
//find the angle from the p3
an23=getAngle(p[1],p[2]),//angle from point 3 to 2
an34=getAngle(p[3],p[2]),//angle from point 3 to 4
//find tangent points
t23=[p[2][0]-cos(an23)*tangD,p[2][1]-sin(an23)*tangD],//tangent point between points 2&3
t34=[p[2][0]-cos(an34)*tangD,p[2][1]-sin(an34)*tangD],//tangent point between points 3&4
//find circle centre
tmid=getMidpoint(t23,t34),//midpoint between the two tangent points
anCen=getAngle(tmid,p[2]),//angle from point 3 to circle centre
cen=[p[2][0]-cos(anCen)*circD,p[2][1]-sin(anCen)*circD]
)
//circle center by offseting from point 3
//determine the direction of rotation
debug==1?//if debug in disabled return arc (default)
(newR-r[1]):
[t23,t34,cen];
function round3points(rp,fn)=
rp[1][2]==0?[[rp[1][0],rp[1][1]]]://return the middle point if the radius is 0
let(
p=getpoints(rp), //get list of points
r=rp[1][2],//get the centre 3 radii
ang=cosineRuleAngle(p[0],p[1],p[2]),//angle between the lines
//now that the radius has been determined, find tangent points and circle centre
tangD=r/tan(ang/2),//distance to the tangent point from p2
circD=r/sin(ang/2),//distance to the circle centre from p2
//find the angles from the p2 with respect to the postitive x axis
angleFromPoint1ToPoint2=getAngle(p[0],p[1]),
angleFromPoint2ToPoint3=getAngle(p[2],p[1]),
//find tangent points
t12=[p[1][0]-cos(angleFromPoint1ToPoint2)*tangD,p[1][1]-sin(angleFromPoint1ToPoint2)*tangD],//tangent point between points 1&2
t23=[p[1][0]-cos(angleFromPoint2ToPoint3)*tangD,p[1][1]-sin(angleFromPoint2ToPoint3)*tangD],//tangent point between points 2&3
//find circle centre
tmid=getMidpoint(t12,t23),//midpoint between the two tangent points
angCen=getAngle(tmid,p[1]),//angle from point 2 to circle centre
cen=[p[1][0]-cos(angCen)*circD,p[1][1]-sin(angCen)*circD] //circle center by offseting from point 2
)
[t12,t23,cen];
function parallelFollow(rp,thick=4,minR=1,mode=1)=
//rp[1][2]==0?[rp[1][0],rp[1][1],0]://return the middle point if the radius is 0
thick==0?[rp[1][0],rp[1][1],0]://return the middle point if the radius is 0
let(
p=getpoints(rp), //get list of points
r=thick,//get the centre 3 radii
ang=cosineRuleAngle(p[0],p[1],p[2]),//angle between the lines
//now that the radius has been determined, find tangent points and circle centre
tangD=r/tan(ang/2),//distance to the tangent point from p2
sgn=CWorCCW(rp),//rotation of the three points cw or ccw?let(sgn=mode==0?1:-1)
circD=mode*sgn*r/sin(ang/2),//distance to the circle centre from p2
//find the angles from the p2 with respect to the postitive x axis
angleFromPoint1ToPoint2=getAngle(p[0],p[1]),
angleFromPoint2ToPoint3=getAngle(p[2],p[1]),
//find tangent points
t12=[p[1][0]-cos(angleFromPoint1ToPoint2)*tangD,p[1][1]-sin(angleFromPoint1ToPoint2)*tangD],//tangent point between points 1&2
t23=[p[1][0]-cos(angleFromPoint2ToPoint3)*tangD,p[1][1]-sin(angleFromPoint2ToPoint3)*tangD],//tangent point between points 2&3
//find circle centre
tmid=getMidpoint(t12,t23),//midpoint between the two tangent points
angCen=getAngle(tmid,p[1]),//angle from point 2 to circle centre
cen=[p[1][0]-cos(angCen)*circD,p[1][1]-sin(angCen)*circD],//circle center by offseting from point 2
outR=max(minR,rp[1][2]-thick*sgn*mode) //ensures radii are never too small.
)
concat(cen,outR);
function findPoint(ang1,refpoint1,ang2,refpoint2,r=0)=
let(
m1=tan(ang1),
c1=refpoint1.y-m1*refpoint1.x,
m2=tan(ang2),
c2=refpoint2.y-m2*refpoint2.x,
outputX=(c2-c1)/(m1-m2),
outputY=m1*outputX+c1
)
[outputX,outputY,r];
function beamChain(radiiPoints,offset1=0,offset2,mode=0,minR=0,startAngle,endAngle)=
/*This function takes a series of radii points and plots points to run along side at a consistant distance, think of it as offset but for line instead of a polygon
radiiPoints=radii points,
offset1 & offset2= The two offsets that give the beam it's thickness. When using with mode=2 only offset1 is needed as there is no return path for the polygon
minR=min radius, if all of your radii are set properly within the radii points this value can be ignored
startAngle & endAngle= Angle at each end of the beam, different mode determine if this angle is relative to the ending legs of the beam or absolute.
mode=1 - include endpoints startAngle&2 are relative to the angle of the last two points and equal 90deg if not defined
mode=2 - Only the forward path is defined, useful for combining the beam with other radii points, see examples for a use-case.
mode=3 - include endpoints startAngle&2 are absolute from the x axis and are 0 if not defined
negative radiuses only allowed for the first and last radii points
As it stands this function could probably be tidied a lot, but it works, I'll tidy later*/
let(
offset2undef=offset2==undef?1:0,
offset2=offset2undef==1?0:offset2,
CWorCCW1=sign(offset1)*CWorCCW(radiiPoints),
CWorCCW2=sign(offset2)*CWorCCW(radiiPoints),
offset1=abs(offset1),
offset2b=abs(offset2),
Lrp3=len(radiiPoints)-3,
Lrp=len(radiiPoints),
startAngle=mode==0&&startAngle==undef?
getAngle(radiiPoints[0],radiiPoints[1])+90:
mode==2&&startAngle==undef?
0:
mode==0?
getAngle(radiiPoints[0],radiiPoints[1])+startAngle:
startAngle,
endAngle=mode==0&&endAngle==undef?
getAngle(radiiPoints[Lrp-1],radiiPoints[Lrp-2])+90:
mode==2&&endAngle==undef?
0:
mode==0?
getAngle(radiiPoints[Lrp-1],radiiPoints[Lrp-2])+endAngle:
endAngle,
OffLn1=[for(i=[0:Lrp3]) offset1==0?radiiPoints[i+1]:parallelFollow([radiiPoints[i],radiiPoints[i+1],radiiPoints[i+2]],offset1,minR,mode=CWorCCW1)],
OffLn2=[for(i=[0:Lrp3]) offset2==0?radiiPoints[i+1]:parallelFollow([radiiPoints[i],radiiPoints[i+1],radiiPoints[i+2]],offset2b,minR,mode=CWorCCW2)],
Rp1=abs(radiiPoints[0].z),
Rp2=abs(radiiPoints[Lrp-1].z),
endP1a=findPoint(getAngle(radiiPoints[0],radiiPoints[1]), OffLn1[0], startAngle,radiiPoints[0], Rp1),
endP1b=findPoint(getAngle(radiiPoints[Lrp-1],radiiPoints[Lrp-2]), OffLn1[len(OffLn1)-1], endAngle,radiiPoints[Lrp-1], Rp2),
endP2a=findPoint(getAngle(radiiPoints[0],radiiPoints[1]), OffLn2[0], startAngle,radiiPoints[0], Rp1),
endP2b=findPoint(getAngle(radiiPoints[Lrp-1],radiiPoints[Lrp-2]), OffLn2[len(OffLn1)-1], endAngle,radiiPoints[Lrp-1], Rp2),
absEnda=getAngle(endP1a,endP2a),
absEndb=getAngle(endP1b,endP2b),
negRP1a=[cos(absEnda)*radiiPoints[0].z*10+endP1a.x, sin(absEnda)*radiiPoints[0].z*10+endP1a.y, 0.0],
negRP2a=[cos(absEnda)*-radiiPoints[0].z*10+endP2a.x, sin(absEnda)*-radiiPoints[0].z*10+endP2a.y, 0.0],
negRP1b=[cos(absEndb)*radiiPoints[Lrp-1].z*10+endP1b.x, sin(absEndb)*radiiPoints[Lrp-1].z*10+endP1b.y, 0.0],
negRP2b=[cos(absEndb)*-radiiPoints[Lrp-1].z*10+endP2b.x, sin(absEndb)*-radiiPoints[Lrp-1].z*10+endP2b.y, 0.0],
OffLn1b=(mode==0||mode==2)&&radiiPoints[0].z<0&&radiiPoints[Lrp-1].z<0?
concat([negRP1a],[endP1a],OffLn1,[endP1b],[negRP1b])
:(mode==0||mode==2)&&radiiPoints[0].z<0?
concat([negRP1a],[endP1a],OffLn1,[endP1b])
:(mode==0||mode==2)&&radiiPoints[Lrp-1].z<0?
concat([endP1a],OffLn1,[endP1b],[negRP1b])
:mode==0||mode==2?
concat([endP1a],OffLn1,[endP1b])
:
OffLn1,
OffLn2b=(mode==0||mode==2)&&radiiPoints[0].z<0&&radiiPoints[Lrp-1].z<0?
concat([negRP2a],[endP2a],OffLn2,[endP2b],[negRP2b])
:(mode==0||mode==2)&&radiiPoints[0].z<0?
concat([negRP2a],[endP2a],OffLn2,[endP2b])
:(mode==0||mode==2)&&radiiPoints[Lrp-1].z<0?
concat([endP2a],OffLn2,[endP2b],[negRP2b])
:mode==0||mode==2?
concat([endP2a],OffLn2,[endP2b])
:
OffLn2
)//end of let()
offset2undef==1?OffLn1b:concat(OffLn2b,revList(OffLn1b));
function revList(list)=//reverse list
let(Llist=len(list)-1)
[for(i=[0:Llist]) list[Llist-i]];
function CWorCCW(p)=
let(
Lp=len(p),
e=[for(i=[0:Lp-1])
(p[listWrap(i+0,Lp)].x-p[listWrap(i+1,Lp)].x)*(p[listWrap(i+0,Lp)].y+p[listWrap(i+1,Lp)].y)
]
)
sign(sum(e));
function CentreN2PointsArc(p1,p2,cen,mode=0,fn)=
/* This function plots an arc from p1 to p2 with fn increments using the cen as the centre of the arc.
the mode determines how the arc is plotted
mode==0, shortest arc possible
mode==1, longest arc possible
mode==2, plotted clockwise
mode==3, plotted counter clockwise
*/
let(
isCWorCCW=CWorCCW([cen,p1,p2]),//determine the direction of rotation
//determine the arc angle depending on the mode
p1p2Angle=cosineRuleAngle(p2,cen,p1),
arcAngle=
mode==0?p1p2Angle:
mode==1?p1p2Angle-360:
mode==2&&isCWorCCW==-1?p1p2Angle:
mode==2&&isCWorCCW== 1?p1p2Angle-360:
mode==3&&isCWorCCW== 1?p1p2Angle:
mode==3&&isCWorCCW==-1?p1p2Angle-360:
cosineRuleAngle(p2,cen,p1),
r=pointDist(p1,cen),//determine the radius
p1Angle=getAngle(cen,p1) //angle of line 1
)
[for(i=[0:fn])
let(angleIncrement=(arcAngle/fn)*i*isCWorCCW)
[cos(p1Angle+angleIncrement)*r+cen.x,sin(p1Angle+angleIncrement)*r+cen.y]];
function translateRadiiPoints(radiiPoints,tran=[0,0],rot=0)=
[for(i=radiiPoints)
let(
a=getAngle([0,0],[i.x,i.y]),//get the angle of the this point
h=pointDist([0,0],[i.x,i.y]) //get the hypotenuse/radius
)
[h*cos(a+rot)+tran.x,h*sin(a+rot)+tran.y,i.z]//calculate the point's new position
];
module round2d(OR=3,IR=1){
offset(OR,$fn=100){
offset(-IR-OR,$fn=100){
offset(IR,$fn=100){
children();
}
}
}
}
module shell2d(offset1,offset2=0,minOR=0,minIR=0){
difference(){
round2d(minOR,minIR){
offset(max(offset1,offset2)){
children(0);//original 1st child forms the outside of the shell
}
}
round2d(minIR,minOR){
difference(){//round the inside cutout
offset(min(offset1,offset2)){
children(0);//shrink the 1st child to form the inside of the shell
}
if($children>1){
for(i=[1:$children-1]){
children(i);//second child and onwards is used to add material to inside of the shell
}
}
}
}
}
}
module internalSq(size,r,center=0){
tran=center==1?[0,0]:size/2;
translate(tran){
square(size,true);
offs=sin(45)*r;
for(i=[-1,1],j=[-1,1]){
translate([(size.x/2-offs)*i,(size.y/2-offs)*j])circle(r);
}
}
}
module extrudeWithRadius(length,r1=0,r2=0,fn=30){
n1=sign(r1);n2=sign(r2);
r1=abs(r1);r2=abs(r2);
translate([0,0,r1]){
linear_extrude(length-r1-r2){
children();
}
}
for(i=[0:fn-1]){
translate([0,0,i/fn*r1]){
linear_extrude(r1/fn+0.01){
offset(n1*sqrt(sq(r1)-sq(r1-i/fn*r1))-n1*r1){
children();
}
}
}
translate([0,0,length-r2+i/fn*r2]){
linear_extrude(r2/fn+0.01){
offset(n2*sqrt(sq(r2)-sq(i/fn*r2))-n2*r2){
children();
}
}
}
}
}
function mirrorPoints(radiiPoints,rot=0,endAttenuation=[0,0])= //mirrors a list of points about Y, ignoring the first and last points and returning them in reverse order for use with polygon or polyRound
let(
a=translateRadiiPoints(radiiPoints,[0,0],-rot),
temp3=[for(i=[0+endAttenuation[0]:len(a)-1-endAttenuation[1]])
[a[i][0],-a[i][1],a[i][2]]
],
temp=translateRadiiPoints(temp3,[0,0],rot),
temp2=revList(temp3)
)
concat(radiiPoints,temp2);
function processRadiiPoints(rp)=
[for(i=[0:len(rp)-1])
processRadiiPoints2(rp,i)
];
function processRadiiPoints2(list,end=0,idx=0,result=0)=
idx>=end+1?result:
processRadiiPoints2(list,end,idx+1,relationalRadiiPoints(result,list[idx]));
function cosineRuleBside(a,c,C)=c*cos(C)-sqrt(sq(a)+sq(c)+sq(cos(C))-sq(c));
function absArelR(po,pn)=
let(
th2=atan(po[1]/po[0]),
r2=sqrt(sq(po[0])+sq(po[1])),
r3=cosineRuleBside(r2,pn[1],th2-pn[0])
)
[cos(pn[0])*r3,sin(pn[0])*r3,pn[2]];
function relationalRadiiPoints(po,pi)=
let(
p0=pi[0],
p1=pi[1],
p2=pi[2],
pv0=pi[3][0],
pv1=pi[3][1],
pt0=pi[3][2],
pt1=pi[3][3],
pn=
(pv0=="y"&&pv1=="x")||(pv0=="r"&&pv1=="a")||(pv0=="y"&&pv1=="a")||(pv0=="x"&&pv1=="a")||(pv0=="y"&&pv1=="r")||(pv0=="x"&&pv1=="r")?
[p1,p0,p2,concat(pv1,pv0,pt1,pt0)]:
[p0,p1,p2,concat(pv0,pv1,pt0,pt1)],
n0=pn[0],
n1=pn[1],
n2=pn[2],
nv0=pn[3][0],
nv1=pn[3][1],
nt0=pn[3][2],
nt1=pn[3][3],
temp=
pn[0]=="l"?
[po[0],pn[1],pn[2]]
:pn[1]=="l"?
[pn[0],po[1],pn[2]]
:nv0==undef?
[pn[0],pn[1],pn[2]]//abs x, abs y as default when undefined
:nv0=="a"?
nv1=="r"?
nt0=="a"?
nt1=="a"||nt1==undef?
[cos(n0)*n1,sin(n0)*n1,n2]//abs angle, abs radius
:absArelR(po,pn)//abs angle rel radius
:nt1=="r"||nt1==undef?
[po[0]+cos(pn[0])*pn[1],po[1]+sin(pn[0])*pn[1],pn[2]]//rel angle, rel radius
:[pn[0],pn[1],pn[2]]//rel angle, abs radius
:nv1=="x"?
nt0=="a"?
nt1=="a"||nt1==undef?
[pn[1],pn[1]*tan(pn[0]),pn[2]]//abs angle, abs x
:[po[0]+pn[1],(po[0]+pn[1])*tan(pn[0]),pn[2]]//abs angle rel x
:nt1=="r"||nt1==undef?
[po[0]+pn[1],po[1]+pn[1]*tan(pn[0]),pn[2]]//rel angle, rel x
:[pn[1],po[1]+(pn[1]-po[0])*tan(pn[0]),pn[2]]//rel angle, abs x
:nt0=="a"?
nt1=="a"||nt1==undef?
[pn[1]/tan(pn[0]),pn[1],pn[2]]//abs angle, abs y
:[(po[1]+pn[1])/tan(pn[0]),po[1]+pn[1],pn[2]]//abs angle rel y
:nt1=="r"||nt1==undef?
[po[0]+(pn[1]-po[0])/tan(90-pn[0]),po[1]+pn[1],pn[2]]//rel angle, rel y
:[po[0]+(pn[1]-po[1])/tan(pn[0]),pn[1],pn[2]]//rel angle, abs y
:nv0=="r"?
nv1=="x"?
nt0=="a"?
nt1=="a"||nt1==undef?
[pn[1],sign(pn[0])*sqrt(sq(pn[0])-sq(pn[1])),pn[2]]//abs radius, abs x
:[po[0]+pn[1],sign(pn[0])*sqrt(sq(pn[0])-sq(po[0]+pn[1])),pn[2]]//abs radius rel x
:nt1=="r"||nt1==undef?
[po[0]+pn[1],po[1]+sign(pn[0])*sqrt(sq(pn[0])-sq(pn[1])),pn[2]]//rel radius, rel x
:[pn[1],po[1]+sign(pn[0])*sqrt(sq(pn[0])-sq(pn[1]-po[0])),pn[2]]//rel radius, abs x
:nt0=="a"?
nt1=="a"||nt1==undef?
[sign(pn[0])*sqrt(sq(pn[0])-sq(pn[1])),pn[1],pn[2]]//abs radius, abs y
:[sign(pn[0])*sqrt(sq(pn[0])-sq(po[1]+pn[1])),po[1]+pn[1],pn[2]]//abs radius rel y
:nt1=="r"||nt1==undef?
[po[0]+sign(pn[0])*sqrt(sq(pn[0])-sq(pn[1])),po[1]+pn[1],pn[2]]//rel radius, rel y
:[po[0]+sign(pn[0])*sqrt(sq(pn[0])-sq(pn[1]-po[1])),pn[1],pn[2]]//rel radius, abs y
:nt0=="a"?
nt1=="a"||nt1==undef?
[pn[0],pn[1],pn[2]]//abs x, abs y
:[pn[0],po[1]+pn[1],pn[2]]//abs x rel y
:nt1=="r"||nt1==undef?
[po[0]+pn[0],po[1]+pn[1],pn[2]]//rel x, rel y
:[po[0]+pn[0],pn[1],pn[2]]//rel x, abs y
)
temp;
function invtan(run,rise)=
let(a=abs(atan(rise/run)))
rise==0&&run>0?
0:rise>0&&run>0?
a:rise>0&&run==0?
90:rise>0&&run<0?
180-a:rise==0&&run<0?
180:rise<0&&run<0?
a+180:rise<0&&run==0?
270:rise<0&&run>0?
360-a:"error";
function cosineRuleAngle(p1,p2,p3)=
let(
p12=abs(pointDist(p1,p2)),
p13=abs(pointDist(p1,p3)),
p23=abs(pointDist(p2,p3))
)
acos((sq(p23)+sq(p12)-sq(p13))/(2*p23*p12));
function sum(list, idx = 0, result = 0) =
idx >= len(list) ? result : sum(list, idx + 1, result + list[idx]);
function sq(x)=x*x;
function getGradient(p1,p2)=(p2.y-p1.y)/(p2.x-p1.x);
function getAngle(p1,p2)=p1==p2?0:invtan(p2[0]-p1[0],p2[1]-p1[1]);
function getMidpoint(p1,p2)=[(p1[0]+p2[0])/2,(p1[1]+p2[1])/2]; //returns the midpoint of two points
function pointDist(p1,p2)=sqrt(abs(sq(p1[0]-p2[0])+sq(p1[1]-p2[1]))); //returns the distance between two points
function isColinear(p1,p2,p3)=getGradient(p1,p2)==getGradient(p2,p3)?1:0;//return 1 if 3 points are colinear
module polyline(p, width=0.3) {
for(i=[0:max(0,len(p)-1)]){
color([i*1/len(p),1-i*1/len(p),0,0.5])line(p[i],p[listWrap(i+1,len(p) )],width);
}
} // polyline plotter
module line(p1, p2 ,width=0.3) { // single line plotter
hull() {
translate(p1){
circle(width);
}
translate(p2){
circle(width);
}
}
}
function getpoints(p)=[for(i=[0:len(p)-1])[p[i].x,p[i].y]];// gets [x,y]list of[x,y,r]list
function listWrap(x,x_max=1,x_min=0) = (((x - x_min) % (x_max - x_min)) + (x_max - x_min)) % (x_max - x_min) + x_min; // wraps numbers inside boundaries
function rnd(a = 1, b = 0, s = []) =
s == [] ?
(rands(min(a, b), max( a, b), 1)[0]):(rands(min(a, b), max(a, b), 1, s)[0]); // nice rands wrapper

View File

@ -72,66 +72,3 @@ function profile_segment_length(profile,i) = norm(profile[(i+1)%len(profile)] -
// Generates an array with n copies of value (default 0)
function dup(value=0,n) = [for (i = [1:n]) value];
use <scad-utils/transformations.scad>
use <scad-utils/trajectory_path.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/shapes.scad>
module fakeISOEnter(thickness_difference = 0){
// 1u is the space taken upy by a 1u keycap.
// unit is the space taken up by a unit space for a keycap.
// formula is 1u + unit *(length - 1)
// t is all modifications to the polygon array
t = thickness_difference/2 - (19.02 - 18.16);
function unit(length) = 19.02 * length;
pointArray = [
[19.05 * (-.5) + t, 19.05 * (-1) + t],
[19.05 * (0.5) - t, 19.05 * (-1) + t],
[19.05 * (0.5) - t, 19.05 * (1) - t],
[19.05 * (-0.75) + t, 19.05 * (1) - t],
[19.05 * (-0.75) + t, 19.05 * (0) + t],
[19.05 * (-0.5) + t, 19.05 * (0) + t]
];
/*translate([unit(-.5), unit(-1) + 0.86]){*/
minkowski() {
circle($corner_radius, $fn=20);
offset(r=-$corner_radius * 2, $fn=20) polygon(points=pointArray);
}
/*}*/
}
function isoEnter() = [
[19.05 * (-.5) + (19.02 - 18.16), 19.05 * (-1) + (19.02 - 18.16)],
[19.05 * (0.5) - (19.02 - 18.16), 19.05 * (-1) + (19.02 - 18.16)],
[19.05 * (0.5) - (19.02 - 18.16), 19.05 * (1) - (19.02 - 18.16)],
[19.05 * (-0.75) + (19.02 - 18.16), 19.05 * (1) - (19.02 - 18.16)],
[19.05 * (-0.75) + (19.02 - 18.16), 19.05 * (0) + (19.02 - 18.16)],
[19.05 * (-0.5) + (19.02 - 18.16), 19.05 * (0) + (19.02 - 18.16)]
];
path_definition = [
trajectory(forward = 10, roll = 0),
];
// sweep
path = quantize_trajectories(path_definition, steps=100);
// skin
myLen = len(path)-1;
trans = [ for (i=[0:len(path)-1]) transform(path[i], isoEnter()) ];
translate([0,10,0])
skin(trans);

View File

@ -7,7 +7,10 @@ $key_length = 1.0; // Range not working in thingiverse customizer atm [1:0.25:16
$stem_type = "cherry"; // [cherry, alps, rounded_cherry, box_cherry, filled, disable]
// The stem is the hardest part to print, so this variable controls how much 'slop' there is in the stem
$stem_slop = 0.3; // Not working in thingiverse customizer atm [0:0.01:1]
// if your keycaps stick in the switch raise this value
$stem_slop = 0.35; // Not working in thingiverse customizer atm [0:0.01:1]
// broke this out. if your keycaps are falling off lower this value. only works for cherry stems rn
$stem_inner_slop = 0.2;
// Font size used for text
$font_size = 6;
@ -15,6 +18,10 @@ $font_size = 6;
// Set this to true if you're making a spacebar!
$inverted_dish = false;
// change aggressiveness of double sculpting
// this is the radius of the cylinder the keytops are placed on
$double_sculpt_radius = 200;
// Support type. default is "flared" for easy FDM printing; bars are more realistic, and flat could be for artisans
$support_type = "flared"; // [flared, bars, flat, disable]
@ -22,9 +29,11 @@ $support_type = "flared"; // [flared, bars, flat, disable]
// Supports for the stem, as it often comes off during printing. Reccommended for most machines
$stem_support_type = "tines"; // [tines, brim, disabled]
/* [Advanced] */
// make legends outset instead of inset.
// broken off from artisan support since who wants outset legends?
$outset_legends = false;
/* Key */
/* [Key] */
// Height in units of key. should remain 1 for most uses
$key_height = 1.0;
// Keytop thickness, aka how many millimeters between the inside and outside of the top surface of the key
@ -45,10 +54,17 @@ $height_difference = 4;
$total_depth = 11.5;
// The tilt of the dish in degrees. divided by key height
$top_tilt = -6;
// the y tilt of the dish in degrees. divided by key width.
// for double axis sculpted keycaps and probably not much else
$top_tilt_y = 0;
// How skewed towards the back the top is (0 for center)
$top_skew = 1.7;
/* Stem */
// how skewed towards the right the top is. unused, but implemented.
// for double axis sculpted keycaps and probably not much else
$top_skew_x = 0;
/* [Stem] */
// How far the throw distance of the switch is. determines how far the 'cross' in the cherry switch digs into the stem, and how long the keystem needs to be before supports can start. luckily, alps and cherries have a pretty similar throw. can modify to have stouter keycaps for low profile switches, etc
$stem_throw = 4;
@ -58,21 +74,24 @@ $rounded_cherry_stem_d = 5.5;
// How much higher the stem is than the bottom of the keycap.
// Inset stem requires support but is more accurate in some profiles
// can be negative to make outset stems!
$stem_inset = 0;
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
// How many degrees to rotate the stems. useful for sideways keycaps
$stem_rotation = 0;
// How many degrees to rotate the keycap, but _not_ inside features (the stem).
$keycap_rotation = 0;
/* Shape */
/* [Shape] */
// Key shape type, determines the shape of the key. default is 'rounded square'
$key_shape_type = "rounded_square";
// ISO enter needs to be linear extruded NOT from the center. this tells the program how far up 'not from the center' is
// ISO enter needs to be linear extruded NOT from the center when not using skin. this tells the program how far up 'not from the center' is
$linear_extrude_height_adjustment = 0;
// How many slices will be made, to approximate curves on corners. Leave at 1 if you are not curving corners
// If you're doing fancy bowed keycap sides, this controls how many slices you take
$height_slices = 1;
/* Dish */
/* [Dish] */
// What type of dish the key has. note that unlike stems and supports a dish ALWAYS gets rendered.
$dish_type = "cylindrical"; // [cylindrical, spherical, sideways cylindrical, old spherical, disable]
@ -82,12 +101,16 @@ $dish_depth = 1;
$dish_skew_x = 0;
// How skewed in the y direction (height) the dish is
$dish_skew_y = 0;
// If you need the dish to extend further, you can 'overdraw' the rectangle it will hit
$dish_offset_x = 0;
// If you need the dish to extend further, you can 'overdraw' the rectangle it will hit. this was mostly for iso enter and should be deprecated
$dish_overdraw_width = 0;
// Same as width but for height
$dish_overdraw_height = 0;
/* Misc */
/* [Misc] */
// There's a bevel on the cherry stems to aid insertion / guard against first layer squishing making a hard-to-fit stem.
$cherry_bevel = true;
@ -97,15 +120,17 @@ $stem_support_height = .8;
$font="DejaVu Sans Mono:style=Book";
// Whether or not to render fake keyswitches to check clearances
$clearance_check = false;
// Use linear_extrude instead of hull slices to make the shape of the key
// Should be faster, also required for concave shapes
$linear_extrude_shape = false;
//should the key be rounded? unnecessary for most printers, and very slow
// what kind of extrusion we use to create the keycap. "hull" is standard, "linear extrude" is legacy, "skin" is new and not well supported.
$hull_shape_type = "hull"; // ["hull", "linear extrude", "skin"]
// This doesn't work very well, but you can try
$rounded_key = false;
//minkowski radius. radius of sphere used in minkowski sum for minkowski_key function. 1.75 for G20
$minkowski_radius = .33;
/* Features */
/* [Features] */
//insert locating bump
$key_bump = false;
@ -116,12 +141,27 @@ $key_bump_edge = 0.4;
/* [Hidden] */
// set this to true if you are making double sculpted keycaps
$double_sculpted = false;
//list of legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$legends = [];
//list of front legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$front_legends = [];
// print legends on the front of the key instead of the top
$front_print_legends = false;
// how recessed inset legends / artisans are from the top of the key
$inset_legend_depth = 0.2;
// Dimensions of alps stem
$alps_stem = [4.45, 2.25];
@ -140,3 +180,72 @@ $stabilizers = $key_length >= 6 ? [[-50, 0], [50, 0]] : $key_length >= 2 ? [[-12
// Where the stems are in relation to the center of the keycap, in units. default is one in the center
// Shouldn't work in thingiverse customizer, though it has been...
$stem_positions = [[0,0]];
// colors
$primary_color = [.2667,.5882,1];
$secondary_color = [.4412, .7, .3784];
$tertiary_color = [1, .6941, .2];
$quaternary_color = [.4078, .3569, .749];
$warning_color = [1,0,0, 0.15];
// how many facets circles will have when used in these features
$minkowski_facets = 30;
$shape_facets =30;
// "flat" / "dished" / "disable"
$inner_shape_type = "flat";
// default side_sculpting function, linear
$side_sculpting = function(progress) 0;
$corner_sculpting = function(progress) 0;
// you probably shouldn't touch this, it's internal to sculpted_square
// modify side sculpting with the $side_sculpting function in the key profile files
$more_side_sculpting_factor = 0;
// 3d surface functions (still in beta)
// 3d surface settings
// unused for now
$3d_surface_size = 1;
// 3d surface point resolution. $3d_surface_size / $3d_surface_step = steps per x / y
$3d_surface_step = 1/20;
// monotonically increasing function that distributes the points of the surface mesh
// only for polar_3d_surface right now
// if it's linear it's a grid. sin(dim) * size concentrates detail around the edges
sinusoidal_surface_distribution = function(dim,size) sin(dim) * size;
linear_surface_distribution = function(dim,size) dim;
$surface_distribution_function = sinusoidal_surface_distribution;
// the function that actually determines what the surface is.
// feel free to override, the last one wins
// debug
// $surface_function = function(x,y) 1;
cylindrical_surface = function(x,y) (sin(acos(x/$3d_surface_size)));
spherical_surface = function(x,y) (1 - (x/$3d_surface_size)^2)^0.5 * (1 - (y/$3d_surface_size)^2)^0.5;
// looks a lot like mt3
quartic_surface = function(x,y) (1 - (x/$3d_surface_size)^4)^0.5 * (1 - (y/$3d_surface_size)^4)^0.5;
ripple_surface = function(x,y) cos((x^2+y^2)^0.5 * 50)/4 + 0.75;
rosenbrocks_banana_surface = function(x,y) (pow(1-(x/$3d_surface_size))^2 + 100 * pow((y/$3d_surface_size)-(x/$3d_surface_size)^2)^2)/200 + 0.1;
spike_surface = function(x,y) 1/(((x/$3d_surface_size)^2+(y/$3d_surface_size)^2)^0.5) + .01;
random_surface = function(x,y) sin(rands(0,90,1,x+y)[0]);
bumps_surface = function(x,y) sin(20*x)*cos(20*y)/3+1;
$surface_function = bumps_surface; // bumps_surface;
// can be used to smooth the corners of the 3d surface function, to make the dishes add / subtract less height. can really do anything it's just multiplying, but that's what I use it for
$corner_smoothing_surface_function = function(x,y) 1;
// $corner_smoothing_surface_function = function(x,y) (1 - pow(abs(x), 5)/$3d_surface_size) * (1 - pow(abs(y),5)/$3d_surface_size);
// ripples
/*
// Rosenbrock's banana
/* $
// y=x revolved around the y axis
/* $surface_function = */
/* $surface_function = */

View File

@ -1,12 +1,15 @@
$fs=.1;
unit = 19.05;
include <constants.scad>
include <shapes/ISO_enter.scad>
include <shapes/sculpted_square.scad>
include <shapes/rounded_square.scad>
include <shapes/square.scad>
include <shapes/oblong.scad>
include <shapes/regular_polygon.scad>
// size: at progress 0, the shape is supposed to be this size
// delta: at progress 1, the keycap is supposed to be size - delta
// progress: how far along the transition you are.
// it's not always linear - specifically sculpted_square
module key_shape(size, delta, progress = 0) {
if ($key_shape_type == "iso_enter") {
ISO_enter_shape(size, delta, progress);
@ -14,11 +17,31 @@ module key_shape(size, delta, progress = 0) {
sculpted_square_shape(size, delta, progress);
} else if ($key_shape_type == "rounded_square") {
rounded_square_shape(size, delta, progress);
} else if ($key_shape_type == "flat_sided_square") {
// rounded_square_shape handles this
rounded_square_shape(size, delta, progress);
} else if ($key_shape_type == "square") {
square_shape(size, delta, progress);
} else if ($key_shape_type == "oblong") {
oblong_shape(size, delta, progress);
} else if ($key_shape_type == "hexagon") {
regular_polygon_shape(size, delta, progress);
} else if ($key_shape_type == "octagon") {
regular_polygon_shape(size, delta, progress, sides=8);
} else if ($key_shape_type == "circular") {
regular_polygon_shape(size, delta, progress, sides=36);
} else {
echo("Warning: unsupported $key_shape_type");
}
}
function skin_key_shape(size, delta, progress = 0, thickness_difference) =
$key_shape_type == "rounded_square" ?
skin_rounded_square(size, delta, progress, thickness_difference) :
$key_shape_type == "sculpted_square" ?
skin_sculpted_square_shape(size, delta, progress, thickness_difference) :
$key_shape_type == "square" ?
skin_square_shape(size, delta, progress, thickness_difference) :
$key_shape_type == "iso_enter" ?
skin_iso_enter_shape(size, delta, progress, thickness_difference) :
echo("Warning: unsupported $key_shape_type for skin shape. disable skin_extrude_shape or pick a new shape");

View File

@ -1,9 +1,14 @@
// corollary is rounded_square
// NOT 3D
include <../functions.scad>
include <../libraries/round-anything/polyround.scad>
width_ratio = unit_length(1.25) / unit_length(1.5);
height_ratio = unit_length(1) / unit_length(2);
module ISO_enter_shape(size, delta, progress){
width = size[0];
height = size[1];
function unit_length(length) = unit * (length - 1) + 18.16;
// in order to make the ISO keycap shape generic, we are going to express the
@ -12,23 +17,53 @@ module ISO_enter_shape(size, delta, progress){
// and wants to pass just width and height, we make these ratios to know where
// to put the elbow joint
width_ratio = unit_length(1.25) / unit_length(1.5);
height_ratio = unit_length(1) / unit_length(2);
delta = delta / 2;
pointArray = [
[ 0, 0], // top right
[ 0, -height], // bottom right
[-width * width_ratio, -height], // bottom left
[-width * width_ratio,-height * height_ratio], // inner middle point
[ -width,-height * height_ratio], // outer middle point
[ -width, 0] // top left
[ 0-delta.x, 0-delta.y], // top right
[ 0-delta.x, -height+delta.y], // bottom right
[-width * width_ratio+delta.x, -height+delta.y], // bottom left
[-width * width_ratio + delta.x,-height * height_ratio+delta.y], // inner middle point
[ -width + delta.x,-height * height_ratio + delta.y], // outer middle point
[ -width + delta.x, 0-delta.y] // top left
];
minkowski(){
circle(r=corner_size);
circle(r=$corner_radius);
// gives us rounded inner corner
offset(r=-corner_size*2) {
offset(r=-$corner_radius*2) {
translate([(width * width_ratio)/2, height/2]) polygon(points=pointArray);
}
}
}
function iso_enter_vertices(size, delta, progress, thickness_difference) = [
[ 0-delta.x/2 * progress - thickness_difference/8, 0 - delta.y / 2 * progress - thickness_difference/8], // top right
[ 0-delta.x/2 * progress - thickness_difference/8, -size[1] + delta.y / 2 * progress + thickness_difference/8], // bottom right
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/8, -size[1] + delta.y / 2 * progress + thickness_difference/8], // bottom left
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/8,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // inner middle point
[ -size[0] + delta.x/2 * progress + thickness_difference/8,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // outer middle point
[ -size[0] + delta.x/2 * progress + thickness_difference/8, 0 - delta.y / 2 * progress - thickness_difference/8] // top left
] + [
[(size[0] * width_ratio)/2, size[1]/2 ],
[(size[0] * width_ratio)/2, size[1]/2 ],
[(size[0] * width_ratio)/2, size[1]/2 ],
[(size[0] * width_ratio)/2, size[1]/2 ],
[(size[0] * width_ratio)/2, size[1]/2 ],
[(size[0] * width_ratio)/2, size[1]/2 ]
];
// no rounding on the corners at all
function skin_iso_enter_shape(size, delta, progress, thickness_difference) =
polyRound(
add_rounding(
iso_enter_vertices(
size,
[delta.x - $side_sculpting(progress), delta.y - $side_sculpting(progress)],
progress,
thickness_difference
),
$corner_radius + $corner_sculpting(progress)
),
$shape_facets
);

View File

@ -0,0 +1,14 @@
// we do this weird key_shape_type check here because rounded_square uses
// square_shape, and we want flat sides to work for that too.
// could be refactored, idk
module regular_polygon_shape(size, delta, progress, sides=6){
// https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/undersized_circular_objects
fudge = 1/cos(180/sides);
diameter = (size.x - delta.x * progress - $corner_radius*2) * fudge;
offset(r=$corner_radius) rotate([0,0,360/sides/2]) circle(d = diameter, $fn=sides);
}
// TODO not implemented
function skin_regular_polygon_shape(size, delta, progress, thickness_difference, sides=6) = echo("skin regular polygon not implemented");

View File

@ -1,22 +1,12 @@
include <square.scad>
include <../libraries/round-anything/polyround.scad>
module rounded_square_shape(size, delta, progress, center = true) {
width = size[0];
height = size[1];
width_difference = delta[0];
height_difference = delta[1];
// computed values for this slice
extra_width_this_slice = (width_difference) * progress;
extra_height_this_slice = (height_difference) * progress;
extra_corner_radius_this_slice = ($corner_radius);
offset(r=extra_corner_radius_this_slice){
square(
[
width - extra_width_this_slice - extra_corner_radius_this_slice * 2,
height - extra_height_this_slice - extra_corner_radius_this_slice * 2
],
center=center
);
offset(r=$corner_radius, $fa=360/$shape_facets){
square_shape([size.x - $corner_radius*2, size.y - $corner_radius*2], delta, progress);
}
}
// for skin
function skin_rounded_square(size, delta, progress, thickness_difference) =
polyRound(add_rounding(rectangle_profile(size - (delta * progress)), $corner_radius), $shape_facets/4);

View File

@ -1,13 +1,5 @@
// rounded square shape with additional sculpting functions to better approximate
// When sculpting sides, how much in should the tops come
$side_sculpting_factor = 4.5;
// When sculpting corners, how much extra radius should be added
$corner_sculpting_factor = 1;
// When doing more side sculpting corners, how much extra radius should be added
$more_side_sculpting_factor = 0.4;
// side sculpting functions
// bows the sides out on stuff like SA and DSA keycaps
function side_sculpting(progress) = (1 - progress) * $side_sculpting_factor;
@ -21,9 +13,9 @@ module sculpted_square_shape(size, delta, progress) {
width_difference = delta[0];
height_difference = delta[1];
// makes the sides bow
extra_side_size = side_sculpting(progress);
extra_side_size = $side_sculpting(progress);
// makes the rounded corners of the keycap grow larger as they move upwards
extra_corner_size = corner_sculpting(progress);
extra_corner_size = $corner_sculpting(progress);
// computed values for this slice
extra_width_this_slice = (width_difference - extra_side_size) * progress;
@ -35,13 +27,66 @@ module sculpted_square_shape(size, delta, progress) {
height - extra_height_this_slice
];
offset(r = extra_corner_radius_this_slice) {
offset(r = extra_corner_radius_this_slice, $fa=360/$shape_facets) {
offset(r = -extra_corner_radius_this_slice) {
side_rounded_square(square_size, r = $more_side_sculpting_factor * progress);
}
}
}
function new_side_rounded_square(size, r, cornerRadius=0) =
let(
width = (size.x - r)/2,
height = (size.y - r)/2,
// fudge numbers! the radius conflict resolution in polyround smooths out
// the entire shape based on the ratios between conflicting radii. bumping
// these up makes the whole shape more fluid
widthRadius = r ? width*8 : 0,
heightRadius = r ? height*8 : 0,
bow = r/2,
// close enough :/
facets = 360 / $shape_facets/2,
points = [
[-width,-height,cornerRadius],
[0,-height-bow,widthRadius],
[width,-height,cornerRadius],
[width + bow,0,heightRadius],
[width,height,cornerRadius],
[0,height + bow,widthRadius],
[-width,height,cornerRadius],
[-width-bow,0,heightRadius]
]
) polyRound(points,facets);
function skin_sculpted_square_shape(size, delta, progress, thickness_difference) =
let(
width = size[0],
height = size[1],
width_difference = delta[0],
height_difference = delta[1],
// makes the sides bow
extra_side_size = $side_sculpting(progress),
// makes the rounded corners of the keycap grow larger as they move upwards
extra_corner_size = $corner_sculpting(progress),
// computed values for this slice
extra_width_this_slice = (width_difference - extra_side_size) * progress,
extra_height_this_slice = (height_difference - extra_side_size) * progress,
extra_corner_radius_this_slice = ($corner_radius + extra_corner_size),
square_size = [
width - extra_width_this_slice - thickness_difference,
height - extra_height_this_slice - thickness_difference
]
) new_side_rounded_square(square_size, $more_side_sculpting_factor * progress, extra_corner_radius_this_slice);
module side_rounded_square(size, r) {
iw = size.x - 2 * r;
ih = size.y - 2 * r;
@ -51,10 +96,10 @@ module side_rounded_square(size, r) {
sw = iw / resolution;
union() {
if (sr > 0) {
translate([-iw/2, 0]) scale([sr, sh]) circle(d = resolution);
translate([iw/2, 0]) scale([sr, sh]) circle(d = resolution);
translate([0, -ih/2]) scale([sw, sr]) circle(d = resolution);
translate([0, ih/2]) scale([sw, sr]) circle(d = resolution);
translate([-iw/2, 0]) scale([sr, sh]) circle(d = resolution, $fa=360/$shape_facets);
translate([iw/2, 0]) scale([sr, sh]) circle(d = resolution, $fa=360/$shape_facets);
translate([0, -ih/2]) scale([sw, sr]) circle(d = resolution, $fa=360/$shape_facets);
translate([0, ih/2]) scale([sw, sr]) circle(d = resolution, $fa=360/$shape_facets);
}
square([iw, ih], center=true);
}

View File

@ -1,3 +1,53 @@
use <../functions.scad>
// we do this weird key_shape_type check here because rounded_square uses
// square_shape, and we want flat sides to work for that too.
// could be refactored, idk
module square_shape(size, delta, progress){
if ($key_shape_type == "flat_sided_square") {
flat_sided_square_shape(size, delta,progress);
} else {
square(size - delta * progress, center = true);
}
}
/*
[-size.x /2,-size.y / 2],
[size.x / 2,-size.y / 2],
[size.x / 2, size.y / 2],
[-size.x / 2, size.y / 2] */
// for side-printed keycaps. Any amount of top tilt (on a keycap with a smaller
// top than bottom) makes the left and right side of the keycap convex. This
// shape makes the sides flat by making the top a trapezoid.
// This obviously doesn't work with rounded sides at all
module flat_sided_square_shape(size, delta, progress) {
polygon(skin_flat_sided_square_shape(size, delta, progress));
}
function skin_flat_sided_square_shape(size,delta,progress) = [
[(-size.x + (delta.x + extra_keytop_length_for_flat_sides()) * progress)/2, (-size.y + delta.y * progress)/2],
[(size.x - (delta.x + extra_keytop_length_for_flat_sides()) * progress)/2,(-size.y + delta.y * progress)/2],
[(size.x - (delta.x - extra_keytop_length_for_flat_sides()) * progress)/2, (size.y - delta.y * progress)/2],
[(-size.x + (delta.x - extra_keytop_length_for_flat_sides()) * progress)/2, (size.y - delta.y * progress)/2]
];
function rectangle_profile(size) = [
[-size.x/2, -size.y/2],
[size.x/2, -size.y/2],
[size.x/2, size.y/2],
[-size.x/2, size.y/2],
];
function skin_square_shape(size, delta, progress, thickness_difference) =
let(
width = size[0],
height = size[1],
width_difference = delta[0] * progress,
height_difference = delta[1] * progress,
square_size = [
width - width_difference - thickness_difference,
height - height_difference - thickness_difference
]
) $key_shape_type == "flat_sided_square" ? skin_flat_sided_square_shape(size, delta, progress) : rectangle_profile(square_size);

View File

@ -16,12 +16,12 @@ module brim_support(stem_type, stem_support_height, slop) {
}
}
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
} else if (stem_type == "rounded_cherry") {
difference() {
cylinder(d=$rounded_cherry_stem_d * 2, h=stem_support_height);
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
} else if (stem_type == "box_cherry") {
difference() {
@ -31,7 +31,7 @@ module brim_support(stem_type, stem_support_height, slop) {
}
}
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
} else if (stem_type == "cherry_stabilizer") {
difference() {
@ -41,7 +41,7 @@ module brim_support(stem_type, stem_support_height, slop) {
}
}
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
} else if(stem_type == "choc") {
translate([-5.7/2,0,0]) linear_extrude(height=stem_support_height) {

View File

@ -1,28 +1,64 @@
include <../functions.scad>
include <../stems/cherry.scad>
// $wall_thickness/4 to reduce coincident faces
/* NOTE: every reference to total_key_width and total_key_height
* is multiplied by two in order to account for offset stems
*/
module centered_tines(stem_support_height) {
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width($wall_thickness)+$wall_thickness/4, 1, $stem_support_height], center = true);
translate([0,0,$stem_support_height / 2]) cube([1, total_key_height($wall_thickness), $stem_support_height], center = true);
if ($key_length < 2) {
translate([0,0,$stem_support_height / 2]) {
cube([total_key_width()*2, 0.5, $stem_support_height], center = true);
}
}
translate([0,0,$stem_support_height / 2]) {
cube([
1,
total_key_height()*2,
$stem_support_height
],
center = true);
}
}
module tines_support(stem_type, stem_support_height, slop) {
if (stem_type == "cherry" || stem_type == "costar_stabilizer") {
difference () {
union() {
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width($wall_thickness)+$wall_thickness/4, 1, $stem_support_height], center = true);
translate([1.15,0,$stem_support_height / 2]) cube([.5, total_key_height($wall_thickness), $stem_support_height], center = true);
translate([-1.15,0,$stem_support_height / 2]) cube([.5, total_key_height($wall_thickness), $stem_support_height], center = true);
if ($key_length < 2) {
translate([0,0,$stem_support_height / 2]) {
cube([
total_key_width()*2,
0.5,
$stem_support_height
], center = true);
}
}
inside_cherry_cross(slop);
// 2 vertical tines holding either side of the cruciform
for (x = [2, -2]) {
translate([x,0,$stem_support_height / 2]) {
cube([
0.5,
total_key_height()*2, // this is to extend past
$stem_support_height
], center = true);
}
}
}
inside_cherry_cross($stem_inner_slop);
}
} else if (stem_type == "cherry_stabilizer") {
difference () {
union() {
translate([1.15,0,$stem_support_height / 2]) cube([1, total_key_height($wall_thickness), $stem_support_height], center = true);
translate([-1.15,0,$stem_support_height / 2]) cube([1, total_key_height($wall_thickness), $stem_support_height], center = true);
for (x = [1.15, -1.15]) {
translate([x,0,$stem_support_height / 2]) {
cube([
1,
total_key_height()*2,
$stem_support_height
], center = true);
}
}
inside_cherry_stabilizer_cross(slop);
@ -31,19 +67,19 @@ module tines_support(stem_type, stem_support_height, slop) {
difference () {
centered_tines(stem_support_height);
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
} else if (stem_type == "rounded_cherry") {
difference () {
centered_tines(stem_support_height);
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
} else if (stem_type == "alps"){
centered_tines(stem_support_height);
} else if (stem_type == "choc"){
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width($wall_thickness)+$wall_thickness/4, 0.42, $stem_support_height], center = true);
/* translate([-5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */
/* translate([5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width(), 0.42, $stem_support_height], center = true);
/* translate([-5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height(), $stem_support_height], center = true); */
/* translate([5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height(), $stem_support_height], center = true); */
}
}

View File

@ -8,21 +8,21 @@ include <stems/choc.scad>
//whole stem, alps or cherry, trimmed to fit
module stem(stem_type, depth, slop){
module stem(stem_type, depth, slop, throw){
if (stem_type == "alps") {
alps_stem(depth, slop);
alps_stem(depth, slop, throw);
} else if (stem_type == "cherry" || stem_type == "costar_stabilizer") {
cherry_stem(depth, slop);
cherry_stem(depth, slop, throw);
} else if (stem_type == "rounded_cherry") {
rounded_cherry_stem(depth, slop);
rounded_cherry_stem(depth, slop, throw);
} else if (stem_type == "box_cherry") {
box_cherry_stem(depth, slop);
box_cherry_stem(depth, slop, throw);
} else if (stem_type == "filled") {
filled_stem();
} else if (stem_type == "cherry_stabilizer") {
cherry_stabilizer_stem(depth, slop);
cherry_stabilizer_stem(depth, slop, throw);
} else if (stem_type == "choc") {
choc_stem(depth, slop);
choc_stem(depth, slop, throw);
} else if (stem_type == "disable") {
children();
} else {

View File

@ -1,4 +1,4 @@
module alps_stem(depth, has_brim, slop){
module alps_stem(depth, slop, throw){
linear_extrude(height=depth) {
square($alps_stem, center = true);
}

View File

@ -1,7 +1,7 @@
include <../functions.scad>
include <cherry.scad>
module box_cherry_stem(depth, slop) {
module box_cherry_stem(depth, slop, throw) {
difference(){
// outside shape
linear_extrude(height = depth) {
@ -11,6 +11,6 @@ module box_cherry_stem(depth, slop) {
}
// inside cross
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
}

View File

@ -2,7 +2,7 @@ include <../functions.scad>
// extra length to the vertical tine of the inside cherry cross
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
extra_vertical = 100;
module inside_cherry_cross(slop) {
// inside cross
@ -23,7 +23,7 @@ module inside_cherry_cross(slop) {
}
}
module cherry_stem(depth, slop) {
module cherry_stem(depth, slop, throw) {
difference(){
// outside shape
linear_extrude(height = depth) {
@ -32,6 +32,6 @@ module cherry_stem(depth, slop) {
}
}
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
}

View File

@ -4,18 +4,18 @@ include <../functions.scad>
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
module inside_cherry_stabilizer_cross(slop) {
module inside_cherry_stabilizer_cross(slop, throw) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-SMALLEST_POSSIBLE]) {
linear_extrude(height = $stem_throw) {
linear_extrude(height = throw) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
}
module cherry_stabilizer_stem(depth, slop) {
module cherry_stabilizer_stem(depth, slop, throw) {
difference(){
// outside shape
linear_extrude(height = depth) {
@ -24,6 +24,6 @@ module cherry_stabilizer_stem(depth, slop) {
}
}
inside_cherry_stabilizer_cross(slop);
inside_cherry_stabilizer_cross(slop, throw);
}
}

View File

@ -1,5 +1,17 @@
module choc_stem(depth, slop){
separation = 5.7;
translate([-5.7/2, 0, depth/2]) cube([1.2 - slop, 3 - slop / 2, depth], center=true);
translate([5.7/2, 0, depth/2]) cube([1.2 - slop, 3 - slop / 2, depth], center=true);
positions = [
[separation/2, 0],
[-separation/2, 0],
];
// TODO throw not used
module choc_stem(depth, slop, throw){
for (position=positions) {
translate([position.x,position.y, depth/2]) single_choc_stem(depth, slop);
}
}
module single_choc_stem(depth, slop) {
cube([$choc_stem.x - slop, $choc_stem.y - slop, depth], center=true);
}

View File

@ -1,4 +1,4 @@
module filled_stem() {
module filled_stem(_depth, _slop, _throw) {
// I broke the crap out of this stem type due to the changes I made around how stems are differenced
// now that we just take the dish out of stems in order to support stuff like
// bare stem keycaps (and buckling spring eventually) we can't just make a

View File

@ -1,12 +1,12 @@
include <../functions.scad>
include <cherry.scad>
module rounded_cherry_stem(depth, slop) {
module rounded_cherry_stem(depth, slop, throw) {
difference(){
cylinder(d=$rounded_cherry_stem_d, h=depth);
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
inside_cherry_cross(slop);
inside_cherry_cross($stem_inner_slop);
}
}

View File

@ -1,4 +1,7 @@
include <../functions.scad>
// TODO this define doesn't do anything besides tell me I used flat() in this file
// is it better than not having it at all?
include <./flat.scad>
// figures out the scale factor needed to make a 45 degree wall
function scale_for_45(height, starting_size) = (height * 2 + starting_size) / starting_size;
@ -6,6 +9,11 @@ function scale_for_45(height, starting_size) = (height * 2 + starting_size) / st
// complicated since we want the different stems to work well
// also kind of messy... oh well
module flared(stem_type, loft, height) {
// flat support. straight flat support has a tendency to shear off; flared support
// all the way to the top has a tendency to warp the outside of the keycap.
// hopefully the compromise is both
flat(stem_type, loft + height/4, height);
translate([0,0,loft]){
if (stem_type == "rounded_cherry") {
linear_extrude(height=height, scale = scale_for_45(height, $rounded_cherry_stem_d)){
@ -33,26 +41,6 @@ module flared(stem_type, loft, height) {
}
}
} else if (stem_type == "choc") {
choc_scale = [scale_for_45(height, $choc_stem[0]), scale_for_45(height, $choc_stem[1])];
// double support
/*
translate([-5.7/2,0,0]) linear_extrude(height=height, scale = choc_scale){
// TODO make a choc_stem() function so it can build in the slop
square($choc_stem - [$stem_slop, $stem_slop], center=true);
}
translate([5.7/2,0,0]) linear_extrude(height=height, scale = choc_scale){
square($choc_stem - [$stem_slop, $stem_slop], center=true);
} */
// single support, full width
/* translate([0,0,0]) linear_extrude(height=height, scale = choc_scale){
// TODO make a choc_stem() function so it can build in the slop
square([total_key_width($wall_thickness), $choc_stem[1] - $stem_slop], center=true);
} */
// single support, just the stem
new_choc_scale = [scale_for_45(height, $choc_stem[0] + 5.7 - $stem_slop), scale_for_45(height, $choc_stem[1])];
translate([0,0,0]) linear_extrude(height=height, scale = new_choc_scale){

2385
yarn.lock Normal file

File diff suppressed because it is too large Load Diff