Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom cutouts not working #19

Closed
alextrob opened this issue Jan 9, 2020 · 7 comments
Closed

Custom cutouts not working #19

alextrob opened this issue Jan 9, 2020 · 7 comments

Comments

@alextrob
Copy link

alextrob commented Jan 9, 2020

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())
    }
}
@wejrox
Copy link

wejrox commented Feb 11, 2020

Manual debugging reverting and applying the commit shows that if the code isn't moved, KeepPolys is nil when it reaches past the custom poly apply, whereas if it executes after the custom poly apply, the keep and cut polys are merged and placed in the KeepPolys variable of the layer. The cut poly remains the same however either way. Seems like something to do with KeepPolys no longer existing?

@sfcgeorge
Copy link

Unfortunately this is true in the web UI as well - custom cutouts aren't working.

@Jim-Bar
Copy link

Jim-Bar commented May 3, 2021

Same here, realized the website wouldn't let me cut polygons off the plate.

@russtoku
Copy link
Contributor

Same here, tried to specify mounting holes using custom cuts but none show up on the SVG output.

@mrjcohen
Copy link

mrjcohen commented Sep 1, 2021

I was about to open a new issue for this. I am also trying to do custom cut polygons but am not able to get it working either. Specifically I tried doing a Rounded Rectangle Cut out and it doesnt show up in the CAD. If I do 'Add Polygon' it shows up but if I do 'Cut Polygon' it doesnt work. Does anyone know if this is going to be fixed anytime soon? I just found this site and am really excited to design a custom keyboard

@swill
Copy link
Owner

swill commented Apr 22, 2022

I reverted the change that I had made in an attempt to support another person's request, which resulted in me breaking the custom polygons. The functionality should be back to what it was originally and should be functioning as expected.

If you still have problems, please let me know.

@swill swill closed this as completed Apr 22, 2022
@swill
Copy link
Owner

swill commented Apr 22, 2022

@alextrob I have confirmed that your example now works with the latest code. Let me know if you still have issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants