Custom cutouts not working
alextrob opened this issue · 7 comments
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())
}
}
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?
Unfortunately this is true in the web UI as well - custom cutouts aren't working.
Same here, realized the website wouldn't let me cut polygons off the plate.
Same here, tried to specify mounting holes using custom cuts but none show up on the SVG output.
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
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.