kad
kad copied to clipboard
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 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:
- 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.
Doh! I just realized that the Cherry Stabilizer that I was looking at is one piece! By looking at the Alps Stabilizer, I notice that multiple Path
s are created and appended to the CutPoly
for that layer, which is just an array of Path
s.
I would have picked up on that if had finished reading the Draw
function down to the part where it also appended to the CutPolys
rather than stopping when I got to the case
where the switch_path
is defined.
I'd still appreciate any suggestions/hint you have. I'm quite new to golang. (I had to Google: Function declaration syntax: things in parenthesis before function name. 🤦 )
Sorry for the delay getting back to you. I am having a bit of a hard time trying to follow what you are trying to do, so maybe we can review together what you are trying to do.
One thing to note is that you are able to create a cutout (or set of cutouts) and apply them at each switch location, so this should give you a way to adapt the switch cutout if you need to.
Check the following documentation if you haven't already:
- Custom Polygons: http://builder-docs.swillkb.com/features/#custom-polygons
- Custom Polygon placement at key locations: http://builder-docs.swillkb.com/features/#plate-layout
Let me know if you need additional information or if you are still struggling with this.