swill / kad

Keyboard Automated Design (KAD) is a Golang library for designing mechanical keyboards
http://builder.swillkb.com
GNU Affero General Public License v3.0
232 stars 58 forks source link

More of a question than an issue regarding 4.5u stabilizer offset seemingly wider than it needs to be #38

Open Axeia opened 1 year ago

Axeia commented 1 year ago

Hi,

I'm making a Macro for FreeCAD and your tool is the closest that I could find to footprints/dimensions for stabilizers. So I've been borrowing some code from kb_builder. Before finding your excellent code however I did some of my own experiments and calculations and came to the conclusion that a stabilizer wires width is (keySize - 1) * 19.05 (for keySize >=3), and the stabilizer offset is half that size (keySize - 1) * 19.05 * 0.5 this matches the dimensions in your GetCherryStabOffset() method for all sizes almost perfectly. Figured I should post this question here as its the 'latest' and kb_builder is legacy code now, the relevant code: https://github.com/swill/kad/blob/1d51e0f167e1c043916f309b98e5a6c5e30bb918/key.go#L52-L69

The only key size that seems to be off by a substantial amount is 4.5u. Is there a particular reason for this or are the dimensions here simply a mix of measured and calculated and 4.5 was measured in not the most accurate of ways? Or is there a particular reason why 4.5 keys differ?

As an easy comparison (your method vs my calculation):

+-------+------------+-----------------------+--------+
| SizeU | kb_builder | formula  | difference |  aio3  |
+========+===========+==========+============+========+
| 3u:    | 19.05     | 19.05    | (eq)       | 19.05  |
| 4u:    | 28.575    | 28.575   | (eq)       | -      |
| 4.5u:  | 34.671    | 33.375   | (-1.296)   | -      |
| 5.5u:  | 42.8625   | 42.8625  | (eq)       | -      |
| 6u:    | 47.5      | 47.625   | (+0.125)   | 47.625 |
| 6.25u: | 50        | 50.00625 | (+0.00625) | 50.0   |
| 6.5u:  | 52.38     | 52.3875  | (+0.0075)  | -      |
| 7u:    | 57.15     | 57.15    | (eq)       | 57.15  |
| 8u:    | 66.675    | 66.675   | (eq)       | 66.675 |
+--------------------+-----------------------+--------+

If you think my formula is correct feel free to use it.

Axeia commented 1 year ago

I stumbled upon ozh's work https://github.com/ai03-2725/yet-another-keyboard-builder/blob/34726fed1d0b1001f11334e5a08e5aaf744c7520/src/cutouts/StabilizerMXSmall.js#L20-42

and the numbers match mine (0.00625 rounding difference for 6.25u). So I'm pretty confident the formula is correct. I edited the ASCII table in the previous comment to include his numbers in an additional row.

swill commented 1 year ago

I suspect that your calculation is right. I crowd sourced a number of the spacebar dimensions because back when I wrote this (2013), there were not a lot of references documented then. I worked with a couple builders at the time to get most of the common stabilizer widths for the available stabilizers. Have you confirmed the 4.5u calculation you have come up with is correct?

I am glad to see the code I developed is being used and appreciated. I have not had time recently to do much on the builder. It needs a once over to clean up some of the issues.

Thanks for taking the time to post your findings. I will try to find an evening or a weekend to integrate it.

Axeia commented 1 year ago

I haven't found anything in the way of official documentation or code, there's this post on deskthority that echos my findings . https://deskthority.net/viewtopic.php?p=501635#p501635

• 2.0u, 2.25u and 2.75u keys all use the same stabilisers. • 3u, 6u, 6.25, 7u and 8u use stabilisers placed 0.5u from the left and right edge. (Example: 6.25u spacebar ⇒ (6.25 - 1) × 19.05 = 100.2 mm between stems) • Space bars wider than 8u used stabilisers for 8u.

There's matt3o blog with a 4.5u spacebar .stl as well https://matt3o.com/mt3-row-5-spacebar-stls-all-of-them/ which seems to be a bit smaller than the numbers in your code. I'm however not quite sure how to measure the exact centers from a .stl but you might be able to yourself.