swill / kad Goto Github PK
View Code? Open in Web Editor NEWKeyboard Automated Design (KAD) is a Golang library for designing mechanical keyboards
Home Page: http://builder.swillkb.com
License: GNU Affero General Public License v3.0
Keyboard Automated Design (KAD) is a Golang library for designing mechanical keyboards
Home Page: http://builder.swillkb.com
License: GNU Affero General Public License v3.0
Hey there ๐
First things first, thanks for the tool. This really looks awesome, even though I wasn't able to fully capitalize on it.
/rant
TL;DR: Please don't use a div
-tag (and by extension CodeMirror) as an input field.
The long story: This is not how the Internet works. Doing something like this is bound to break in certain situations. It is not good enough if it works on the two web browsers that somebody tested it on. Usually things break on less common system/browser combinations e.g. with Tridactyl on Firefox/Linux. However, in this particular case it breaks on iPads and possibly other iOS devices. Specifically copy & paste does not work. From what I understand, this basically renders the site unusable as you are supposed to copy & paste your layout from KLE.
Having a file upload feature, while still leaving the "input field" broken, would allow me to work around this issue.
/end rant
Based on komar007's documentation https://github.com/komar007/gh60 or his plans http://blog.komar.be/wp-content/uploads/2016/05/gh60_revC_plain.zip the correct coordinates for the center hole would be {-14.3,-0.3)
I leave you some links in case you want to add the Agile switch.
Basically, it's a little smaller compared to Cherry MX compatible switches.
Bye!
Would be cool if you could specify PCB mounted stabilizers as an option to have a simpler cut out.
My friend, your website has crashed
website inaccessible since nov 1.
Hi there! The website appears to be down since at least yesterday! Thought I should let you know :)
any chance of it coming back?
I don't know about the long stabilizer but the short stabilizer that gets generated when you choose Cherry Stabs Only doesn't follow/differs from Cherry's specification.
P.S. I am falling to understand the numbers of the Cherry Stabilizer draw function well, but if you wouldn't mind explaining them, I can clone the repo, fix the issue and create a pull request or I can send you all the dimensions in millimeters of a stabilizer matching perfectly the spec, so you won't have to decipher it (although, maybe it's just me finding it tedious to decipher their size specs)
If I add a switch to the right side of a numpad, and move it so that it's 1/4u or 1/2u above the rest of the row, the cad generated completely ignores that switch.
[{y:0.25,x:4,a:7},""], [{y:-0.75,a:4},"Num Lock","/","*","-"], ["7\nHome","8\nโ","9\nPgUp",{h:2},"+"], ["4\nโ","5","6\nโ"], ["1\nEnd","2\nโ","3\nPgDn",{h:2},"Enter"], [{w:2},"0\nIns",".\nDel"]
When pasted into http://builder.swillkb.com/ the following cad is generated:
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:
Lines 52 to 69 in 1d51e0f
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.
I would love to add a CNC millable mx path, but I'm not really sure how to go about adding a custom path.
Hi, I can't seem to get the website to load any more? Started having this issue yesterday...
Is there something wrong with the site or host?
Looks like the website is down again for the past few days that I have tried to get access.
I'd like to add a custom geometry to https://github.com/swill/kad/blob/master/key.go#L10-L20 that I'd assign const SWITCHSOCKET = 5
It would consist of the 5 holes for PCB mounting an MX switch, but the 2 for the contacts would be enlarged to fit Kailh sockets. It looks like a switch is just a Path
which is just an array of Point
s which is just 2 float64
s. And since CirclePolygon
returns a Path
, which can be appended easily... This should be "easy".
But, what I'm unsure about is:
Please advise.
It's been down all day.
Dear Sir.
Could you please add another 'output' that list XY coordinat of the center of each key?
I'm pretty sure it will verry usefull for non kicad player.
I Use eagle, but dificut to place the keys to match switch layout generated using your generator.
I really apprecite.
Sincerely
There are significant rounding errors in the result due to the use of floating point maths. Please use the Decimal class for all numbers to correct this problem.
I am trying to add Choco Switch support to 'kad'. The plate cutouts should be the same as normal switches, but they have different keycap dimensions. The low-profile, standard keycaps used by the Choco Switches appear to not be perfectly square. At a minimum this means I need to replace U1 with U1.Width and U1.Height and corresponding math to allow a non-square U1.
Before I dive in, can you think of any other logic that might get thrown off by this change?
Naturally I'll submit anything that works as a PR and leave it up to you to add it.
Low Profile 1u difference
While trying to generate the CAD files for the raw data for http://www.keyboard-layout-editor.com/#/gists/0cdad2a4bb53598240bb1b9e94ff0eb8 , I got the following error:
The build process has encountered the following error.
json: cannot unmarshal string into Go struct field Key.h of type float64
Just trying to install it, I get:
$ go get github.com/swill/kad
# github.com/swill/kad
/home/bruno/go/src/github.com/swill/kad/kad.go:435:9: canvas.FloatDecimals undefined (type *svg.SVG has no field or method FloatDecimals)/home/bruno/go/src/github.com/swill/kad/kad.go:436:9: canvas.StartviewUnitF undefined (type *svg.SVG has no field or method StartviewUnitF)
/home/bruno/go/src/github.com/swill/kad/kad.go:444:12: canvas.PolygonF undefined (type *svg.SVG has no field or method PolygonF)
I have extremely limited golang experience.
It seems to crash and doesn't work anymore
When I add EPS file creation to the example usage program on the README.md page, I get errors like this:
ERROR: could not create EPS file for: usage_example, switch | exit status 1
I added this line to the example usage program before the cad.Draw()
line:
cad.Result.Formats = append(cad.Result.Formats, []string{"eps"}...)
can i make 2 usb c hole ?
Custom cutouts don't seem to be working as of f55f630.
Using the below go code from JSON as an example, I expect there to be a circle cut out of the centre of the bottom layer. If I revert to 5b444fe it does show the circle cut out.
package main
import (
"encoding/json"
"log"
"github.com/swill/kad"
)
func main() {
json_bytes := []byte(`{
"switch-type":1,
"stab-type":1,
"layout":[
["Num Lock","/","*","-"],
[{"f":3},"7\nHome","8\nโ","9\nPgUp",{"h":2}," "],
["4\nโ","5","6\nโ"],["1\nEnd","2\nโ","3\nPgDn",{"h":2},"Enter"],
[{"w":2},"0\nIns",".\nDel"]
],
"case": {
"case-type":"sandwich",
"usb-location":100,
"usb-width":12,
"mount-holes-num":4,
"mount-holes-size":3,
"mount-holes-edge":6
},
"top-padding":9,
"left-padding":9,
"right-padding":9,
"bottom-padding":9,
"fillet":3,
"custom": [
{
"layers": [
"bottom"
],
"op": "cut",
"polygon": "custom-circle",
"diameter": 40,
"rel_to": "[0,0]",
"points": "[0,0]"
}
]
}`)
// create a new KAD instance
cad := kad.New()
// populate the 'cad' instance with the JSON contents
err := json.Unmarshal(json_bytes, cad)
if err != nil {
log.Fatalf("Failed to parse json data into the KAD file\nError: %s", err.Error())
}
// and you can define settings via the KAD instance
cad.Hash = "custom_polygon_test" // the name of the design
cad.FileStore = kad.STORE_LOCAL // store the files locally
cad.FileDirectory = "./" // the path location where the files will be saved
cad.FileServePath = "/" // the url path for the 'results' (don't worry about this)
// lets draw the SVG files now
err = cad.Draw()
if err != nil {
log.Fatal("Failed to Draw the KAD file\nError: %s", err.Error())
}
}
Not comfortable with go at all but on linux I see:
~/.../kad/test on master$ go test
# github.com/swill/kad
../kad.go:435:9: canvas.FloatDecimals undefined (type *svg.SVG has no field or method FloatDecimals)
../kad.go:436:9: canvas.StartviewUnitF undefined (type *svg.SVG has no field or method StartviewUnitF)
../kad.go:444:12: canvas.PolygonF undefined (type *svg.SVG has no field or method PolygonF)
FAIL github.com/swill/kad/test [build failed]
Hi Will
Can't find easier way to contact you... so using this.
Feature requests for your builder tool:
Reasons:
I used your tool to generate layers for standard sandwich keyboard. However I had the the aluminium plates cut at one factory using big industrial machines, and the perspex cut at another place using smaller desktop-size machines.
End result is that the overall dimensions were slightly different, and the switches did not fit in the holes in the plate. So I had to file the holes to make them bigger.
I did try to find out the kerfs from the different factories but to my surprise they did not know what I meant. (still trying to come to grips with that...)
Anyway I think the bottom line is that they have different kerfs on their machines, and now I need to find the correct setting for each factory. Hence the desire for a plate with standard switch hole, but with different kerf settings, so I can see which works best. I did try to create one in a CAD program but my CAD skills are limited (and/or those programs don't work like I expect them to)... but anyway possibly there are other people around the world with the same problems so the requested additions may be useful to them too ...
Thanks, Ian
In KLE you have the option to set a key as a "Decal" which per the KLE hovertext are "Purely Decorative." They even have a button specifically for creating a set of 3 decals for status lights (num, caps, and scroll locks). However when I copy my JSON into the web interface they are mistreated and standard switch holes are cut instead.
The JSON for decals contains the property d:true
so a toggle to ignore keys with that attribute would be helpful.
Alternatively, it could be a 3 way toggle since the most common use for decals (that I have seen across several designs) is for the status LEDs. If set to (hypothetical) Treat Decals as LEDs
allow a user to define the offset (from the center of the "key") and diameter of the hole.
Hi,
I would like to customize the plate corner like what's in " builder.swillkb.com" site but could not find any info about it. Is there any documentation for the usage of this repo?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.