Last pre-routing adjustments

This commit is contained in:
Bán Dénes 2020-07-21 19:35:33 +02:00
parent a197041be1
commit 42a2502dda
14 changed files with 201 additions and 118 deletions

View file

@ -1,6 +1,7 @@
module.exports = {
nets: ['net'],
params: {
class: 'P',
width: 1,
height: 1,
front: true,
@ -15,18 +16,18 @@ module.exports = {
if (!toggle) return ''
let x = 0, y = 0
const mirror = side == 'B' ? '(justify mirror)' : ''
const plus = (p.param_text.length + 1) * 0.5
let align = p.param_align
if (p.param_mirrored === true) {
const plus = (p.param.text.length + 1) * 0.5
let align = p.param.align
if (p.param.mirrored === true) {
if (align == 'left') align = 'right'
else if (align == 'right') align = 'left'
}
if (align == 'left') x -= p.param_width / 2 + plus
if (align == 'right') x += p.param_width / 2 + plus
if (align == 'up') y += p.param_height / 2 + plus
if (align == 'down') y -= p.param_height / 2 + plus
const text = `(fp_text user ${p.param_text} (at ${x} ${y} ${p.rot}) (layer ${side}.SilkS) (effects (font (size 0.8 0.8) (thickness 0.15)) ${mirror}))`
return `(pad 1 smd rect (at 0 0 ${p.rot}) (size ${p.param_width} ${p.param_height}) (layers ${side}.Cu ${side}.Paste ${side}.Mask) ${p.net_net})\n${text}`
if (align == 'left') x -= p.param.width / 2 + plus
if (align == 'right') x += p.param.width / 2 + plus
if (align == 'up') y += p.param.height / 2 + plus
if (align == 'down') y -= p.param.height / 2 + plus
const text = `(fp_text user ${p.param.text} (at ${x} ${y} ${p.rot}) (layer ${side}.SilkS) (effects (font (size 0.8 0.8) (thickness 0.15)) ${mirror}))`
return `(pad 1 smd rect (at 0 0 ${p.rot}) (size ${p.param.width} ${p.param.height}) (layers ${side}.Cu ${side}.Paste ${side}.Mask) ${p.net.net})\n${text}`
}
return `
@ -34,10 +35,14 @@ module.exports = {
(module SMDPad (layer F.Cu) (tedit 5B24D78E)
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) (effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_text value "" (at 0 0) (layer F.SilkS) (effects (font (size 1.27 1.27) (thickness 0.15))))
${''/* SMD pads */}
${layout(p.param_front, 'F')}
${layout(p.param_back, 'B')}
${layout(p.param.front, 'F')}
${layout(p.param.back, 'B')}
)