GithubHelp home page GithubHelp logo

swill / kad Goto Github PK

View Code? Open in Web Editor NEW
229.0 229.0 59.0 88 KB

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

Go 100.00%

kad's People

Contributors

cloudops-wstevens avatar fcoury avatar russtoku avatar swill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kad's Issues

Choco Switch Support

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

  1. 17.5mm x 18.5mm - https://oddrocketkeyboards.blogspot.com/2018/05/koda-keyboard-4x12-grid-using-kailh-lp.html
  2. 17.5mm x 16.5mm - https://www.reddit.com/r/MechanicalKeyboards/comments/7hjks9/help_dimensions_of_low_profile_keycaps/
    https://www.reddit.com/r/MechanicalKeyboards/comments/7h79qg/comment/dqp63tw

Add Agile switch

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!

Holes on rounded corners

Currently when you have holes in rounded corners they can get cut off even if there is enough material.

example

Is there a way to position the hole better?

Builder.swillkb is down

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?

On CodeMirror, input fields, web standards and accessibility

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

Short Cherry stabilizer doesn't follow the Cherry Spec

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)

Feature requests for builder

Hi Will

Can't find easier way to contact you... so using this.

Feature requests for your builder tool:

  1. kerf per layer
  2. a "test" panel with standard switch hole cut out, in a range of different kerfs.

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

Need documentation for usage

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?

Can't figure out how to install and use

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.

Can't seem to build

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]

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

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:

kad/key.go

Lines 52 to 69 in 1d51e0f

case 3: // 3u
return 19.05, nil
case 4: // 4u
return 28.575, nil
case 4.5: // 4.5u
return 34.671, nil
case 5.5: // 5.5u
return 42.8625, nil
case 6: // 6u
return 47.5, nil
case 6.25: // 6.25u
return 50, nil
case 6.5: // 6.5u
return 52.38, nil
case 7: // 7u
return 57.15, nil
case 8: // 8u
return 66.675, nil

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.

Custom cutouts not working

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())
    }
}

EPS files not created

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"}...)

CAD not being built correctly with "offset" switch

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.

example:
image

[{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:
image

PCB Mounted Stabs Option

Would be cool if you could specify PCB mounted stabilizers as an option to have a simpler cut out.

Feature request : List of center point of each polygon

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

Creating a custom switch geometry

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 Points which is just 2 float64s. And since CirclePolygon returns a Path, which can be appended easily... This should be "easy".

But, what I'm unsure about is:

  • Can I put multiple desparate holes in a path?
  • Would I do that?
    • I figured that your stabs are multiple paths, but I could not make sense of it by eyeballing the code.

Please advise.

(add option to) Ignore Decals from KLE

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.

failed

It seems to crash and doesn't work anymore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.