dev: add screw points and mounting points

This commit is contained in:
phiwan-dev 2025-06-08 01:53:00 +02:00
parent 3c9ec7457f
commit dc07ea0149
2 changed files with 104 additions and 2 deletions

View file

@ -20,8 +20,11 @@ units:
points:
zones:
# main key matrix
matrix:
anchor.shift: [170, -170]
key:
tags: [key]
padding: ky
spread: kx
columns:
@ -53,8 +56,10 @@ points:
bottom.row_net: rbottom
home.row_net: rhome
top.row_net: rtop
# thumb clusters
thumbs:
key:
tags: [key]
spread: 22
anchor:
ref: matrix_inner_bottom
@ -74,6 +79,19 @@ points:
rows:
cluster.row_net: rthumbs
# screw points
screws:
key.tags: [screw]
key.spread: 0
anchor:
ref: matrix_outer_top
columns:
left_top.key.shift: [khx+0.3, -3.5]
left_bottom.key.shift: [khx+0.3, -ky-3.5]
middle_top.key.shift: [2kx+khx+0.3, ky-3.5]
middle_bottom.key.shift: [3kx+6, -ky-7]
right_top.key.shift: [4kx+khx, +6.5]
right_bottom.key.shift: [5kx+khx+2, -2ky+2]
outlines:
@ -138,7 +156,7 @@ pcbs:
# hotswap choc
switches:
what: choc
where: true
where: [key]
params:
keycaps: true
#keycaps: false # outline on the pcb
@ -150,7 +168,7 @@ pcbs:
# smd diodes
diodes:
what: combo_diode
where: true
where: [key]
params:
include_smd: true
include_tht: false
@ -193,4 +211,10 @@ pcbs:
ref: matrix_inner_home
shift: [kx+2, 0]
screws:
what: mounting_hole
params:
drill: 3.6
where: [screw]

View file

@ -0,0 +1,78 @@
// Author: @infused-kim
//
// Description:
// Simple mounting hole with gold rim.
//
// Parameters:
// - outline: The width of the gold rim around the hole (Default: 0.8mm)
// - drill: The actual size for the hole (Default 2.2mm - for m2 screws)
// - drill_y: The height if you want an oval hole (Default: off)
module.exports = {
params: {
designator: "H",
outline: 0.8,
drill: 2.2,
drill_y: 0,
},
body: (p) => {
if (p.drill_y == 0) {
p.drill_y = p.drill;
}
const size_x = p.drill + p.outline * 2;
const size_y = p.drill_y + p.outline * 2;
const courtyard_offset = 0.25;
const courtyard_x = size_x / 2 + courtyard_offset;
const courtyard_y = size_y / 2 + courtyard_offset;
const top = `
(module mounting_hole (layer F.Cu) (tedit 64B5A986)
${p.at /* parametric position */}
(fp_text reference "${p.ref}" (at 0 3) (layer F.SilkS) ${
p.ref_hide
}
(effects (font (size 1 1) (thickness 0.15)))
)
`;
const pad_circle = `
(pad "" thru_hole circle (at 0 0 180) (size ${size_x} ${size_y}) (drill ${p.drill}) (layers *.Cu *.Mask))
`;
const courtyard_circle = `
(fp_circle (center 0 0) (end -${courtyard_x} 0) (layer F.CrtYd) (width 0.05))
(fp_circle (center 0 0) (end -${courtyard_x} 0) (layer B.CrtYd) (width 0.05))
`;
const pad_oval = `
(pad "" thru_hole oval (at 0 0 180) (size ${size_x} ${size_y}) (drill oval ${p.drill} ${p.drill_y}) (layers *.Cu *.Mask))
`;
const courtyard_oval = `
(fp_line (start ${courtyard_x} -${courtyard_y}) (end ${courtyard_x} ${courtyard_y}) (layer F.CrtYd) (width 0.05))
(fp_line (start -${courtyard_x} -${courtyard_y}) (end -${courtyard_x} ${courtyard_y}) (layer F.CrtYd) (width 0.05))
(fp_line (start -${courtyard_x} ${courtyard_y}) (end ${courtyard_x} ${courtyard_y}) (layer F.CrtYd) (width 0.05))
(fp_line (start -${courtyard_x} -${courtyard_y}) (end ${courtyard_x} -${courtyard_y}) (layer F.CrtYd) (width 0.05))
(fp_line (start -${courtyard_x} ${courtyard_y}) (end ${courtyard_x} ${courtyard_y}) (layer B.CrtYd) (width 0.05))
(fp_line (start -${courtyard_x} ${courtyard_y}) (end -${courtyard_x} -${courtyard_y}) (layer B.CrtYd) (width 0.05))
(fp_line (start -${courtyard_x} -${courtyard_y}) (end ${courtyard_x} -${courtyard_y}) (layer B.CrtYd) (width 0.05))
(fp_line (start ${courtyard_x} ${courtyard_y}) (end ${courtyard_x} -${courtyard_y}) (layer B.CrtYd) (width 0.05))
`;
const bottom = `
)
`;
let final = top;
if (size_x == size_y) {
final += pad_circle;
final += courtyard_circle;
} else {
final += pad_oval;
final += courtyard_oval;
}
final += bottom;
return final;
},
};