Make diode optionally SMD and one sided only

This commit is contained in:
Tilman Baumann 2023-05-05 10:53:51 +01:00
parent 9d93302eae
commit 8aa51cd567
2 changed files with 51 additions and 20 deletions

View File

@ -233,7 +233,6 @@ points:
f:
row_net: R0
#
# Controller
#
controller:
@ -245,8 +244,6 @@ points:
width: mcu_x
height: mcu_y
mirror: &mirror
ref: bigenters_one_f
distance: 100
@ -384,6 +381,8 @@ pcbs:
params:
from: "{{colrow}}"
to: "{{row_net}}"
tht: false # No true hole
side: B # Bottom only
adjust:
shift: [-8, 0]
rotate: 270
@ -462,7 +461,7 @@ pcbs:
choc:
what: chocmini
where:
- [/^mirror.*/, key, -enter]
- [/^mirror.*/, key, -enter ]
- /rightcluster_.*/
params:
keycaps: true
@ -483,7 +482,7 @@ pcbs:
diode:
what: diode
where:
- [/^mirror.*/, key ]
- [/^mirror.*/, key]
- /rightcluster_.*/
params:
from: "{{colrow}}"

View File

@ -1,26 +1,26 @@
module.exports = {
params: {
designator: 'D',
include_tht: true,
from: undefined,
to: undefined
to: undefined,
smd: true,
tht: true,
side: 'both'
},
body: p => {
const tht = `
(pad 1 thru_hole rect (at -3.81 0 ${p.rot}) (size 1.778 1.778) (drill 0.9906) (layers *.Cu *.Mask) ${p.to.str})
(pad 2 thru_hole circle (at 3.81 0 ${p.rot}) (size 1.905 1.905) (drill 0.9906) (layers *.Cu *.Mask) ${p.from.str})
`;
const footprint = `
const header = `
(module ComboDiode (layer F.Cu) (tedit 5B24D78E)
${p.at /* parametric position */}
(attr virtual)
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
`
const symbol_f = `
${''/* diode symbols */}
(fp_line (start 0.25 0) (end 0.75 0) (layer F.SilkS) (width 0.1))
(fp_line (start 0.25 0.4) (end -0.35 0) (layer F.SilkS) (width 0.1))
@ -29,6 +29,8 @@ module.exports = {
(fp_line (start -0.35 0) (end -0.35 0.55) (layer F.SilkS) (width 0.1))
(fp_line (start -0.35 0) (end -0.35 -0.55) (layer F.SilkS) (width 0.1))
(fp_line (start -0.75 0) (end -0.35 0) (layer F.SilkS) (width 0.1))
`
const symbol_b = `
(fp_line (start 0.25 0) (end 0.75 0) (layer B.SilkS) (width 0.1))
(fp_line (start 0.25 0.4) (end -0.35 0) (layer B.SilkS) (width 0.1))
(fp_line (start 0.25 -0.4) (end 0.25 0.4) (layer B.SilkS) (width 0.1))
@ -36,18 +38,48 @@ module.exports = {
(fp_line (start -0.35 0) (end -0.35 0.55) (layer B.SilkS) (width 0.1))
(fp_line (start -0.35 0) (end -0.35 -0.55) (layer B.SilkS) (width 0.1))
(fp_line (start -0.75 0) (end -0.35 0) (layer B.SilkS) (width 0.1))
`
const smd_f = `
${''/* SMD pads on both sides */}
(pad 1 smd rect (at -1.65 0 ${p.rot}) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${p.to.str})
(pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${p.from.str})
`
const smd_b = `
(pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${p.from.str})
(pad 1 smd rect (at -1.65 0 ${p.rot}) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${p.to.str})
(pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${p.from.str})
`
const tht = `
${''/* THT terminals */}
${ p.include_tht ? tht : '' }
(pad 1 thru_hole rect (at -3.81 0 ${p.rot}) (size 1.778 1.778) (drill 0.9906) (layers *.Cu *.Mask) ${p.to.str})
(pad 2 thru_hole circle (at 3.81 0 ${p.rot}) (size 1.905 1.905) (drill 0.9906) (layers *.Cu *.Mask) ${p.from.str})
`
const end = `
)
`
let final = header;
if (p.side == 'both' || p.side == 'F') {
final += symbol_f;
}
if (p.side == 'both' || p.side == 'B') {
final += symbol_b;
}
if (p.smd) {
if (p.side == 'both') {
final += smd_f;
final += smd_b;
} else if (p.side == 'F') {
final += smd_f;
} else if (p.side == 'B') {
final += smd_b;
}
}
if (p.tht) {
final += tht;
}
final += end;
return final;
return footprint;
}
}
}