diff --git a/src/footprints/alps.js b/src/footprints/alps.js index 942c57c..9ab6218 100644 --- a/src/footprints/alps.js +++ b/src/footprints/alps.js @@ -1,11 +1,9 @@ module.exports = { - nets: { + params: { + designator: 'S', from: undefined, to: undefined }, - params: { - class: 'S' - }, body: p => ` (module ALPS (layer F.Cu) (tedit 5CF31DEF) @@ -27,8 +25,8 @@ module.exports = { (fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15)) ${''/* pins */} - (pad 1 thru_hole circle (at 2.5 -4.5) (size 2.25 2.25) (drill 1.47) (layers *.Cu *.Mask) ${p.net.from.str}) - (pad 2 thru_hole circle (at -2.5 -4) (size 2.25 2.25) (drill 1.47) (layers *.Cu *.Mask) ${p.net.to.str}) + (pad 1 thru_hole circle (at 2.5 -4.5) (size 2.25 2.25) (drill 1.47) (layers *.Cu *.Mask) ${p.from.str}) + (pad 2 thru_hole circle (at -2.5 -4) (size 2.25 2.25) (drill 1.47) (layers *.Cu *.Mask) ${p.to.str}) ) ` diff --git a/src/footprints/button.js b/src/footprints/button.js index 5ab03b6..bbf7786 100644 --- a/src/footprints/button.js +++ b/src/footprints/button.js @@ -1,12 +1,10 @@ module.exports = { - nets: { + params: { + designator: 'B', // for Button + side: 'F', from: undefined, to: undefined }, - params: { - class: 'B', // for Button - side: 'F' - }, body: p => ` (module E73:SW_TACT_ALPS_SKQGABE010 (layer F.Cu) (tstamp 5BF2CC94) @@ -20,20 +18,20 @@ module.exports = { (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) ${'' /* outline */} - (fp_line (start 2.75 1.25) (end 1.25 2.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.75 -1.25) (end 1.25 -2.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.75 -1.25) (end 2.75 1.25) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -1.25 2.75) (end 1.25 2.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -1.25 -2.75) (end 1.25 -2.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -2.75 1.25) (end -1.25 2.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -2.75 -1.25) (end -1.25 -2.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -2.75 -1.25) (end -2.75 1.25) (layer ${p.param.side}.SilkS) (width 0.15)) + (fp_line (start 2.75 1.25) (end 1.25 2.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.75 -1.25) (end 1.25 -2.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.75 -1.25) (end 2.75 1.25) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -1.25 2.75) (end 1.25 2.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -1.25 -2.75) (end 1.25 -2.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -2.75 1.25) (end -1.25 2.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -2.75 -1.25) (end -1.25 -2.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -2.75 -1.25) (end -2.75 1.25) (layer ${p.side}.SilkS) (width 0.15)) ${'' /* pins */} - (pad 1 smd rect (at -3.1 -1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.from.str}) - (pad 1 smd rect (at 3.1 -1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.from.str}) - (pad 2 smd rect (at -3.1 1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.to.str}) - (pad 2 smd rect (at 3.1 1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.to.str}) + (pad 1 smd rect (at -3.1 -1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.from.str}) + (pad 1 smd rect (at 3.1 -1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.from.str}) + (pad 2 smd rect (at -3.1 1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.to.str}) + (pad 2 smd rect (at 3.1 1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.to.str}) ) ` diff --git a/src/footprints/choc.js b/src/footprints/choc.js index c14c2e5..792b1c8 100644 --- a/src/footprints/choc.js +++ b/src/footprints/choc.js @@ -13,15 +13,13 @@ // note: hotswap and reverse can be used simultaneously module.exports = { - nets: { - from: undefined, - to: undefined - }, params: { - class: 'S', + designator: 'S', hotswap: false, reverse: false, - keycaps: false + keycaps: false, + from: undefined, + to: undefined }, body: p => { const standard = ` @@ -57,35 +55,35 @@ module.exports = { (fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15)) ` function pins(def_neg, def_pos, def_side) { - if(p.param.hotswap) { + if(p.hotswap) { return ` ${'' /* holes */} (pad "" np_thru_hole circle (at ${def_pos}5 -3.75) (size 3 3) (drill 3) (layers *.Cu *.Mask)) (pad "" np_thru_hole circle (at 0 -5.95) (size 3 3) (drill 3) (layers *.Cu *.Mask)) ${'' /* net pads */} - (pad 1 smd rect (at ${def_neg}3.275 -5.95 ${p.rot}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.net.from.str}) - (pad 2 smd rect (at ${def_pos}8.275 -3.75 ${p.rot}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.net.to.str}) + (pad 1 smd rect (at ${def_neg}3.275 -5.95 ${p.rot}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.from.str}) + (pad 2 smd rect (at ${def_pos}8.275 -3.75 ${p.rot}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.to.str}) ` } else { return ` ${''/* pins */} - (pad 1 thru_hole circle (at ${def_pos}5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net.from.str}) - (pad 2 thru_hole circle (at ${def_pos}0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net.to.str}) + (pad 1 thru_hole circle (at ${def_pos}5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.from.str}) + (pad 2 thru_hole circle (at ${def_pos}0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.to.str}) ` } } - if(p.param.reverse) { + if(p.reverse) { return ` ${standard} - ${p.param.keycaps ? keycap : ''} + ${p.keycaps ? keycap : ''} ${pins('-', '', 'B')} ${pins('', '-', 'F')}) ` } else { return ` ${standard} - ${p.param.keycaps ? keycap : ''} + ${p.keycaps ? keycap : ''} ${pins('-', '', 'B')}) ` } diff --git a/src/footprints/chocmini.js b/src/footprints/chocmini.js index e31258e..b09b865 100644 --- a/src/footprints/chocmini.js +++ b/src/footprints/chocmini.js @@ -9,15 +9,13 @@ // if true, will add choc sized keycap box around the footprint module.exports = { - nets: { - from: undefined, - to: undefined - }, params: { - class: 'S', + designator: 'S', side: 'F', reverse: false, - keycaps: false + keycaps: false, + from: undefined, + to: undefined }, body: p => { const standard = ` @@ -71,14 +69,14 @@ module.exports = { function pins(def_neg, def_pos) { return ` ${''/* pins */} - (pad 1 thru_hole circle (at ${def_neg}4.58 5.1) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.net.from.str} (clearance 0.2)) - (pad 2 thru_hole circle (at ${def_pos}2 5.4) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.net.to.str} (clearance 0.2)) + (pad 1 thru_hole circle (at ${def_neg}4.58 5.1) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.from.str} (clearance 0.2)) + (pad 2 thru_hole circle (at ${def_pos}2 5.4) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.to.str} (clearance 0.2)) ` } - if(p.param.reverse){ + if(p.reverse){ return ` ${standard} - ${p.param.keycaps ? keycap : ''} + ${p.keycaps ? keycap : ''} ${pins('-', '')} ${pins('', '-')}) @@ -86,7 +84,7 @@ module.exports = { } else { return ` ${standard} - ${p.param.keycaps ? keycap : ''} + ${p.keycaps ? keycap : ''} ${pins('-', '')}) ` } diff --git a/src/footprints/diode.js b/src/footprints/diode.js index 63f6e84..741b747 100644 --- a/src/footprints/diode.js +++ b/src/footprints/diode.js @@ -1,11 +1,9 @@ module.exports = { - nets: { + params: { + designator: 'D', from: undefined, to: undefined }, - params: { - class: 'D' - }, body: p => ` (module ComboDiode (layer F.Cu) (tedit 5B24D78E) @@ -34,14 +32,14 @@ module.exports = { (fp_line (start -0.75 0) (end -0.35 0) (layer B.SilkS) (width 0.1)) ${''/* 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.net.to.str}) - (pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${p.net.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.net.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.net.from.str}) + (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 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}) ${''/* THT terminals */} - (pad 1 thru_hole rect (at -3.81 0 ${p.rot}) (size 1.778 1.778) (drill 0.9906) (layers *.Cu *.Mask) ${p.net.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.net.from.str}) + (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}) ) ` diff --git a/src/footprints/jstph.js b/src/footprints/jstph.js index 7aa5f86..c93bb6a 100644 --- a/src/footprints/jstph.js +++ b/src/footprints/jstph.js @@ -1,12 +1,10 @@ module.exports = { - nets: { + params: { + designator: 'JST', + side: 'F', pos: undefined, neg: undefined }, - params: { - class: 'JST', - side: 'F' - }, body: p => ` (module JST_PH_S2B-PH-K_02x2.00mm_Angled (layer F.Cu) (tedit 58D3FE32) @@ -20,20 +18,20 @@ module.exports = { (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)))) - (fp_line (start -2.25 0.25) (end -2.25 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -2.25 -1.35) (end -2.95 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -2.95 -1.35) (end -2.95 6.25) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -2.95 6.25) (end 2.95 6.25) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.95 6.25) (end 2.95 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.95 -1.35) (end 2.25 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.25 -1.35) (end 2.25 0.25) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.25 0.25) (end -2.25 0.25) (layer ${p.param.side}.SilkS) (width 0.15)) + (fp_line (start -2.25 0.25) (end -2.25 -1.35) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -2.25 -1.35) (end -2.95 -1.35) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -2.95 -1.35) (end -2.95 6.25) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -2.95 6.25) (end 2.95 6.25) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.95 6.25) (end 2.95 -1.35) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.95 -1.35) (end 2.25 -1.35) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.25 -1.35) (end 2.25 0.25) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.25 0.25) (end -2.25 0.25) (layer ${p.side}.SilkS) (width 0.15)) - (fp_line (start -1 1.5) (end -1 2.0) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -1.25 1.75) (end -0.75 1.75) (layer ${p.param.side}.SilkS) (width 0.15)) + (fp_line (start -1 1.5) (end -1 2.0) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -1.25 1.75) (end -0.75 1.75) (layer ${p.side}.SilkS) (width 0.15)) - (pad 1 thru_hole rect (at -1 0 ${p.rot}) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) ${p.net.pos.str}) - (pad 2 thru_hole oval (at 1 0 ${p.rot}) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) ${p.net.neg.str}) + (pad 1 thru_hole rect (at -1 0 ${p.rot}) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) ${p.pos.str}) + (pad 2 thru_hole oval (at 1 0 ${p.rot}) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) ${p.neg.str}) ) diff --git a/src/footprints/jumper.js b/src/footprints/jumper.js index 7f4d025..22b7d40 100644 --- a/src/footprints/jumper.js +++ b/src/footprints/jumper.js @@ -1,12 +1,10 @@ module.exports = { - nets: { + params: { + designator: 'J', + side: 'F', from: undefined, to: undefined }, - params: { - class: 'J', - side: 'F' - }, body: p => ` (module lib:Jumper (layer F.Cu) (tedit 5E1ADAC2) ${p.at /* parametric position */} @@ -16,9 +14,9 @@ module.exports = { (fp_text value Jumper (at 0 -7.3) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15)))) ${'' /* pins */} - (pad 1 smd rect (at -0.50038 0 ${p.rot}) (size 0.635 1.143) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) - (clearance 0.1905) ${p.net.from.str}) - (pad 2 smd rect (at 0.50038 0 ${p.rot}) (size 0.635 1.143) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) - (clearance 0.1905) ${p.net.to.str})) + (pad 1 smd rect (at -0.50038 0 ${p.rot}) (size 0.635 1.143) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) + (clearance 0.1905) ${p.from.str}) + (pad 2 smd rect (at 0.50038 0 ${p.rot}) (size 0.635 1.143) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) + (clearance 0.1905) ${p.to.str})) ` } \ No newline at end of file diff --git a/src/footprints/mx.js b/src/footprints/mx.js index 5866661..11d8de8 100644 --- a/src/footprints/mx.js +++ b/src/footprints/mx.js @@ -13,16 +13,14 @@ // note: hotswap and reverse can be used simultaneously module.exports = { - nets: { + params: { + designator: 'S', + hotswap: false, + reverse: false, + keycaps: false, from: undefined, to: undefined }, - params: { - class: 'S', - hotswap: false, - reverse: false, - keycaps: false - }, body: p => { const standard = ` (module MX (layer F.Cu) (tedit 5DD4F656) @@ -57,35 +55,35 @@ module.exports = { (fp_line (start -9.5 9.5) (end -9.5 -9.5) (layer Dwgs.User) (width 0.15)) ` function pins(def_neg, def_pos, def_side) { - if(p.param.hotswap) { + if(p.hotswap) { return ` ${'' /* holes */} (pad "" np_thru_hole circle (at ${def_pos}2.54 -5.08) (size 3 3) (drill 3) (layers *.Cu *.Mask)) (pad "" np_thru_hole circle (at ${def_neg}3.81 -2.54) (size 3 3) (drill 3) (layers *.Cu *.Mask)) ${'' /* net pads */} - (pad 1 smd rect (at ${def_neg}7.085 -2.54 ${p.rot}) (size 2.55 2.5) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.net.from.str}) - (pad 2 smd rect (at ${def_pos}5.842 -5.08 ${p.rot}) (size 2.55 2.5) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.net.to.str}) + (pad 1 smd rect (at ${def_neg}7.085 -2.54 ${p.rot}) (size 2.55 2.5) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.from.str}) + (pad 2 smd rect (at ${def_pos}5.842 -5.08 ${p.rot}) (size 2.55 2.5) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.to.str}) ` } else { return ` ${''/* pins */} - (pad 1 thru_hole circle (at ${def_pos}2.54 -5.08) (size 2.286 2.286) (drill 1.4986) (layers *.Cu *.Mask) ${p.net.from.str}) - (pad 2 thru_hole circle (at ${def_neg}3.81 -2.54) (size 2.286 2.286) (drill 1.4986) (layers *.Cu *.Mask) ${p.net.to.str}) + (pad 1 thru_hole circle (at ${def_pos}2.54 -5.08) (size 2.286 2.286) (drill 1.4986) (layers *.Cu *.Mask) ${p.from.str}) + (pad 2 thru_hole circle (at ${def_neg}3.81 -2.54) (size 2.286 2.286) (drill 1.4986) (layers *.Cu *.Mask) ${p.to.str}) ` } } - if(p.param.reverse){ + if(p.reverse){ return ` ${standard} - ${p.param.keycaps ? keycap : ''} + ${p.keycaps ? keycap : ''} ${pins('-', '', 'B')} ${pins('', '-', 'F')}) ` } else { return ` ${standard} - ${p.param.keycaps ? keycap : ''} + ${p.keycaps ? keycap : ''} ${pins('-', '', 'B')}) ` } diff --git a/src/footprints/oled.js b/src/footprints/oled.js index a1a7cc4..5a8a536 100644 --- a/src/footprints/oled.js +++ b/src/footprints/oled.js @@ -1,13 +1,11 @@ module.exports = { - nets: { - SDA: undefined, - SCL: undefined, - VCC: 'VCC', - GND: 'GND' - }, params: { - class: 'OLED', - side: 'F' + designator: 'OLED', + side: 'F', + VCC: {type: 'net', value: 'VCC'}, + GND: {type: 'net', value: 'GND'}, + SDA: undefined, + SCL: undefined }, body: p => ` (module lib:OLED_headers (layer F.Cu) (tedit 5E1ADAC2) @@ -19,13 +17,13 @@ module.exports = { ${'' /* pins */} (pad 4 thru_hole oval (at 1.6 2.18 ${p.rot+270}) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) - ${p.net.SDA.str}) + ${p.SDA.str}) (pad 3 thru_hole oval (at 1.6 4.72 ${p.rot+270}) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) - ${p.net.SCL.str}) + ${p.SCL.str}) (pad 2 thru_hole oval (at 1.6 7.26 ${p.rot+270}) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) - ${p.net.VCC.str}) + ${p.VCC.str}) (pad 1 thru_hole rect (at 1.6 9.8 ${p.rot+270}) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) - ${p.net.GND.str}) + ${p.GND.str}) ) ` } \ No newline at end of file diff --git a/src/footprints/omron.js b/src/footprints/omron.js index e59a237..7669c6c 100644 --- a/src/footprints/omron.js +++ b/src/footprints/omron.js @@ -1,11 +1,9 @@ module.exports = { - nets: { + params: { + designator: 'S', from: undefined, to: undefined }, - params: { - class: 'S' - }, body: p => ` (module OMRON_B3F-4055 (layer F.Cu) (tstamp 5BF2CC94) @@ -26,10 +24,10 @@ module.exports = { (fp_line (start -6 6) (end -6 -6) (layer Dwgs.User) (width 0.15)) ${'' /* pins */} - (pad 1 np_thru_hole circle (at 6.25 -2.5) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.net.from.str}) - (pad 2 np_thru_hole circle (at -6.25 -2.5) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.net.from.str}) - (pad 3 np_thru_hole circle (at 6.25 2.5) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.net.to.str}) - (pad 4 np_thru_hole circle (at -6.25 2.5 ) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.net.to.str}) + (pad 1 np_thru_hole circle (at 6.25 -2.5) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.from.str}) + (pad 2 np_thru_hole circle (at -6.25 -2.5) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.from.str}) + (pad 3 np_thru_hole circle (at 6.25 2.5) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.to.str}) + (pad 4 np_thru_hole circle (at -6.25 2.5 ) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask) ${p.to.str}) ) ` diff --git a/src/footprints/pad.js b/src/footprints/pad.js index 7238435..debfe8b 100644 --- a/src/footprints/pad.js +++ b/src/footprints/pad.js @@ -1,16 +1,14 @@ module.exports = { - nets: { - net: undefined - }, params: { - class: 'PAD', + designator: 'PAD', width: 1, height: 1, front: true, back: true, text: '', align: 'left', - mirrored: '=mirrored' + mirrored: {type: 'boolean', value: '{{mirrored}}'}, + net: undefined }, body: p => { @@ -18,21 +16,21 @@ 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.text.length + 1) * 0.5 + let align = p.align + if (p.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 + if (align == 'left') x -= p.width / 2 + plus + if (align == 'right') x += p.width / 2 + plus + if (align == 'up') y += p.height / 2 + plus + if (align == 'down') y -= p.height / 2 + plus let text = '' - if (p.param.text.length) { - 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}))` + if (p.text.length) { + text = `(fp_text user ${p.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.str})\n${text}` + return `(pad 1 smd rect (at 0 0 ${p.rot}) (size ${p.width} ${p.height}) (layers ${side}.Cu ${side}.Paste ${side}.Mask) ${p.net.str})\n${text}` } return ` @@ -46,8 +44,8 @@ module.exports = { (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) ${''/* SMD pads */} - ${layout(p.param.front, 'F')} - ${layout(p.param.back, 'B')} + ${layout(p.front, 'F')} + ${layout(p.back, 'B')} ) diff --git a/src/footprints/promicro.js b/src/footprints/promicro.js index a7db132..6d55c0c 100644 --- a/src/footprints/promicro.js +++ b/src/footprints/promicro.js @@ -5,33 +5,31 @@ // if up, power led will face away from pcb module.exports = { - nets: { - RAW: 'RAW', - GND: 'GND', - RST: 'RST', - VCC: 'VCC', - P21: 'P21', - P20: 'P20', - P19: 'P19', - P18: 'P18', - P15: 'P15', - P14: 'P14', - P16: 'P16', - P10: 'P10', - P1: 'P1', - P0: 'P0', - P2: 'P2', - P3: 'P3', - P4: 'P4', - P5: 'P5', - P6: 'P6', - P7: 'P7', - P8: 'P8', - P9: 'P9', - }, params: { - class: 'MCU', - orientation: 'down' + designator: 'MCU', + orientation: 'down', + RAW: {type: 'net', value: 'RAW'}, + GND: {type: 'net', value: 'GND'}, + RST: {type: 'net', value: 'RST'}, + VCC: {type: 'net', value: 'VCC'}, + P21: {type: 'net', value: 'P21'}, + P20: {type: 'net', value: 'P20'}, + P19: {type: 'net', value: 'P19'}, + P18: {type: 'net', value: 'P18'}, + P15: {type: 'net', value: 'P15'}, + P14: {type: 'net', value: 'P14'}, + P16: {type: 'net', value: 'P16'}, + P10: {type: 'net', value: 'P10'}, + P1: {type: 'net', value: 'P1'}, + P0: {type: 'net', value: 'P0'}, + P2: {type: 'net', value: 'P2'}, + P3: {type: 'net', value: 'P3'}, + P4: {type: 'net', value: 'P4'}, + P5: {type: 'net', value: 'P5'}, + P6: {type: 'net', value: 'P6'}, + P7: {type: 'net', value: 'P7'}, + P8: {type: 'net', value: 'P8'}, + P9: {type: 'net', value: 'P9'} }, body: p => { const standard = ` @@ -89,34 +87,34 @@ module.exports = { (fp_text user P09 (at 13.97 ${def_neg}4.8 ${p.rot + 90}) (layer F.SilkS) (effects (font (size 0.8 0.8) (thickness 0.15)))) ${''/* and now the actual pins */} - (pad 1 thru_hole rect (at -13.97 ${def_pos}7.62 ${p.rot}) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.RAW.str}) - (pad 2 thru_hole circle (at -11.43 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.GND.str}) - (pad 3 thru_hole circle (at -8.89 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.RST.str}) - (pad 4 thru_hole circle (at -6.35 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.VCC.str}) - (pad 5 thru_hole circle (at -3.81 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P21.str}) - (pad 6 thru_hole circle (at -1.27 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P20.str}) - (pad 7 thru_hole circle (at 1.27 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P19.str}) - (pad 8 thru_hole circle (at 3.81 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P18.str}) - (pad 9 thru_hole circle (at 6.35 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P15.str}) - (pad 10 thru_hole circle (at 8.89 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P14.str}) - (pad 11 thru_hole circle (at 11.43 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P16.str}) - (pad 12 thru_hole circle (at 13.97 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P10.str}) + (pad 1 thru_hole rect (at -13.97 ${def_pos}7.62 ${p.rot}) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.RAW.str}) + (pad 2 thru_hole circle (at -11.43 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.GND.str}) + (pad 3 thru_hole circle (at -8.89 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.RST.str}) + (pad 4 thru_hole circle (at -6.35 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.VCC.str}) + (pad 5 thru_hole circle (at -3.81 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P21.str}) + (pad 6 thru_hole circle (at -1.27 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P20.str}) + (pad 7 thru_hole circle (at 1.27 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P19.str}) + (pad 8 thru_hole circle (at 3.81 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P18.str}) + (pad 9 thru_hole circle (at 6.35 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P15.str}) + (pad 10 thru_hole circle (at 8.89 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P14.str}) + (pad 11 thru_hole circle (at 11.43 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P16.str}) + (pad 12 thru_hole circle (at 13.97 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P10.str}) - (pad 13 thru_hole circle (at -13.97 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P1.str}) - (pad 14 thru_hole circle (at -11.43 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P0.str}) - (pad 15 thru_hole circle (at -8.89 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.GND.str}) - (pad 16 thru_hole circle (at -6.35 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.GND.str}) - (pad 17 thru_hole circle (at -3.81 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P2.str}) - (pad 18 thru_hole circle (at -1.27 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P3.str}) - (pad 19 thru_hole circle (at 1.27 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P4.str}) - (pad 20 thru_hole circle (at 3.81 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P5.str}) - (pad 21 thru_hole circle (at 6.35 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P6.str}) - (pad 22 thru_hole circle (at 8.89 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P7.str}) - (pad 23 thru_hole circle (at 11.43 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P8.str}) - (pad 24 thru_hole circle (at 13.97 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.net.P9.str}) + (pad 13 thru_hole circle (at -13.97 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P1.str}) + (pad 14 thru_hole circle (at -11.43 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P0.str}) + (pad 15 thru_hole circle (at -8.89 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.GND.str}) + (pad 16 thru_hole circle (at -6.35 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.GND.str}) + (pad 17 thru_hole circle (at -3.81 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P2.str}) + (pad 18 thru_hole circle (at -1.27 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P3.str}) + (pad 19 thru_hole circle (at 1.27 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P4.str}) + (pad 20 thru_hole circle (at 3.81 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P5.str}) + (pad 21 thru_hole circle (at 6.35 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P6.str}) + (pad 22 thru_hole circle (at 8.89 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P7.str}) + (pad 23 thru_hole circle (at 11.43 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P8.str}) + (pad 24 thru_hole circle (at 13.97 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P9.str}) ` } - if(p.param.orientation == 'down') { + if(p.orientation == 'down') { return ` ${standard} ${pins('-', '')}) diff --git a/src/footprints/rgb.js b/src/footprints/rgb.js index 904bd17..45be1b0 100644 --- a/src/footprints/rgb.js +++ b/src/footprints/rgb.js @@ -1,13 +1,11 @@ module.exports = { - nets: { + params: { + designator: 'LED', + side: 'F', din: undefined, dout: undefined, - VCC: 'VCC', - GND: 'GND' - }, - params: { - class: 'LED', - side: 'F' + VCC: {type: 'net', value: 'VCC'}, + GND: {type: 'net', value: 'GND'} }, body: p => ` @@ -19,27 +17,27 @@ module.exports = { (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)))) - (fp_line (start -1.75 -1.75) (end -1.75 1.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -1.75 1.75) (end 1.75 1.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 1.75 1.75) (end 1.75 -1.75) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 1.75 -1.75) (end -1.75 -1.75) (layer ${p.param.side}.SilkS) (width 0.15)) + (fp_line (start -1.75 -1.75) (end -1.75 1.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -1.75 1.75) (end 1.75 1.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 1.75 1.75) (end 1.75 -1.75) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 1.75 -1.75) (end -1.75 -1.75) (layer ${p.side}.SilkS) (width 0.15)) - (fp_line (start -2.5 -2.5) (end -2.5 2.5) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -2.5 2.5) (end 2.5 2.5) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.5 2.5) (end 2.5 -2.5) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 2.5 -2.5) (end -2.5 -2.5) (layer ${p.param.side}.SilkS) (width 0.15)) + (fp_line (start -2.5 -2.5) (end -2.5 2.5) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -2.5 2.5) (end 2.5 2.5) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.5 2.5) (end 2.5 -2.5) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 2.5 -2.5) (end -2.5 -2.5) (layer ${p.side}.SilkS) (width 0.15)) - (fp_poly (pts (xy 4 2.2) (xy 4 0.375) (xy 5 1.2875)) (layer ${p.param.side}.SilkS) (width 0.1)) + (fp_poly (pts (xy 4 2.2) (xy 4 0.375) (xy 5 1.2875)) (layer ${p.side}.SilkS) (width 0.1)) - (pad 1 smd rect (at -2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.VCC.str}) - (pad 2 smd rect (at -2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.dout.str}) - (pad 3 smd rect (at 2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.GND.str}) - (pad 4 smd rect (at 2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.din.str}) + (pad 1 smd rect (at -2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.VCC.str}) + (pad 2 smd rect (at -2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.dout.str}) + (pad 3 smd rect (at 2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.GND.str}) + (pad 4 smd rect (at 2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.din.str}) - (pad 11 smd rect (at -2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.VCC.str}) - (pad 22 smd rect (at -2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.dout.str}) - (pad 33 smd rect (at 2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.GND.str}) - (pad 44 smd rect (at 2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.din.str}) + (pad 11 smd rect (at -2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.VCC.str}) + (pad 22 smd rect (at -2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.dout.str}) + (pad 33 smd rect (at 2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.GND.str}) + (pad 44 smd rect (at 2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.din.str}) ) diff --git a/src/footprints/rotary.js b/src/footprints/rotary.js index 54129d6..60092bf 100644 --- a/src/footprints/rotary.js +++ b/src/footprints/rotary.js @@ -8,16 +8,14 @@ // C: corresponds to pin 3 (for rotary) module.exports = { - nets: { + params: { + designator: 'ROT', from: undefined, to: undefined, A: undefined, B: undefined, C: undefined }, - params: { - class: 'ROT' - }, body: p => ` (module rotary_encoder (layer F.Cu) (tedit 603326DE) @@ -58,11 +56,11 @@ module.exports = { (fp_circle (center -0.12 -0.04) (end 2.88 -0.04) (layer F.Fab) (width 0.12)) ${''/* pin names */} - (pad A thru_hole rect (at -7.62 -2.54 ${p.rot}) (size 2 2) (drill 1) (layers *.Cu *.Mask) ${p.net.A.str}) - (pad C thru_hole circle (at -7.62 -0.04) (size 2 2) (drill 1) (layers *.Cu *.Mask) ${p.net.C.str}) - (pad B thru_hole circle (at -7.62 2.46) (size 2 2) (drill 1) (layers *.Cu *.Mask) ${p.net.B.str}) - (pad 1 thru_hole circle (at 6.88 -2.54) (size 1.5 1.5) (drill 1) (layers *.Cu *.Mask) ${p.net.from.str}) - (pad 2 thru_hole circle (at 6.88 2.46) (size 1.5 1.5) (drill 1) (layers *.Cu *.Mask) ${p.net.to.str}) + (pad A thru_hole rect (at -7.62 -2.54 ${p.rot}) (size 2 2) (drill 1) (layers *.Cu *.Mask) ${p.A.str}) + (pad C thru_hole circle (at -7.62 -0.04) (size 2 2) (drill 1) (layers *.Cu *.Mask) ${p.C.str}) + (pad B thru_hole circle (at -7.62 2.46) (size 2 2) (drill 1) (layers *.Cu *.Mask) ${p.B.str}) + (pad 1 thru_hole circle (at 6.88 -2.54) (size 1.5 1.5) (drill 1) (layers *.Cu *.Mask) ${p.from.str}) + (pad 2 thru_hole circle (at 6.88 2.46) (size 1.5 1.5) (drill 1) (layers *.Cu *.Mask) ${p.to.str}) ${''/* Legs */} (pad "" thru_hole rect (at -0.12 -5.64 ${p.rot}) (size 3.2 2) (drill oval 2.8 1.5) (layers *.Cu *.Mask)) diff --git a/src/footprints/scrollwheel.js b/src/footprints/scrollwheel.js index 748106f..3024d29 100644 --- a/src/footprints/scrollwheel.js +++ b/src/footprints/scrollwheel.js @@ -21,7 +21,9 @@ module.exports = { - nets: { + params: { + designator: 'S', + reverse: false, from: undefined, to: undefined, A: undefined, @@ -29,10 +31,6 @@ module.exports = { C: undefined, D: undefined }, - params: { - class: 'S', - reverse: false - }, body: p => { const standard = ` (module RollerEncoder_Panasonic_EVQWGD001 (layer F.Cu) (tedit 6040A10C) @@ -59,18 +57,18 @@ module.exports = { (fp_arc (start ${def_pos}9.5 -6.3) (end ${def_pos}9.8 -6.3) (angle ${def_neg}90) (layer Edge.Cuts) (width 0.15)) ${'' /* pins */} - (pad S1 thru_hole circle (at ${def_neg}6.85 -6.2 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.net.from.str}) - (pad S2 thru_hole circle (at ${def_neg}5 -6.2 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.net.to.str}) - (pad A thru_hole circle (at ${def_neg}5.625 -3.81 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.net.A.str}) - (pad B thru_hole circle (at ${def_neg}5.625 -1.27 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.net.B.str}) - (pad C thru_hole circle (at ${def_neg}5.625 1.27 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.net.C.str}) - (pad D thru_hole circle (at ${def_neg}5.625 3.81 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.net.D.str}) + (pad S1 thru_hole circle (at ${def_neg}6.85 -6.2 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.from.str}) + (pad S2 thru_hole circle (at ${def_neg}5 -6.2 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.to.str}) + (pad A thru_hole circle (at ${def_neg}5.625 -3.81 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.A.str}) + (pad B thru_hole circle (at ${def_neg}5.625 -1.27 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.B.str}) + (pad C thru_hole circle (at ${def_neg}5.625 1.27 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.C.str}) + (pad D thru_hole circle (at ${def_neg}5.625 3.81 ${p.rot}) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask) ${p.D.str}) ${'' /* stabilizer */} (pad "" np_thru_hole circle (at ${def_neg}5.625 6.3 ${p.rot}) (size 1.5 1.5) (drill 1.5) (layers *.Cu *.Mask)) ` } - if(p.param.reverse) { + if(p.reverse) { return ` ${standard} ${pins('-', '')} diff --git a/src/footprints/slider.js b/src/footprints/slider.js index 4bab2ed..fa117fd 100644 --- a/src/footprints/slider.js +++ b/src/footprints/slider.js @@ -1,16 +1,14 @@ module.exports = { - nets: { + params: { + designator: 'T', // for Toggle + side: 'F', from: undefined, to: undefined }, - params: { - class: 'T', // for Toggle - side: 'F' - }, body: p => { - const left = p.param.side == 'F' ? '-' : '' - const right = p.param.side == 'F' ? '' : '-' + const left = p.side == 'F' ? '-' : '' + const right = p.side == 'F' ? '' : '-' return ` @@ -23,12 +21,12 @@ module.exports = { (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) ${'' /* outline */} - (fp_line (start 1.95 -1.35) (end -1.95 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 0 -1.35) (end -3.3 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -3.3 -1.35) (end -3.3 1.5) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start -3.3 1.5) (end 3.3 1.5) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 3.3 1.5) (end 3.3 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) - (fp_line (start 0 -1.35) (end 3.3 -1.35) (layer ${p.param.side}.SilkS) (width 0.15)) + (fp_line (start 1.95 -1.35) (end -1.95 -1.35) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 0 -1.35) (end -3.3 -1.35) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -3.3 -1.35) (end -3.3 1.5) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start -3.3 1.5) (end 3.3 1.5) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 3.3 1.5) (end 3.3 -1.35) (layer ${p.side}.SilkS) (width 0.15)) + (fp_line (start 0 -1.35) (end 3.3 -1.35) (layer ${p.side}.SilkS) (width 0.15)) ${'' /* extra indicator for the slider */} (fp_line (start -1.95 -3.85) (end 1.95 -3.85) (layer Dwgs.User) (width 0.15)) @@ -40,15 +38,15 @@ module.exports = { (pad "" np_thru_hole circle (at -1.5 0) (size 1 1) (drill 0.9) (layers *.Cu *.Mask)) ${'' /* pins */} - (pad 1 smd rect (at ${right}2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.from.str}) - (pad 2 smd rect (at ${left}0.75 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask) ${p.net.to.str}) - (pad 3 smd rect (at ${left}2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask)) + (pad 1 smd rect (at ${right}2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.from.str}) + (pad 2 smd rect (at ${left}0.75 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.to.str}) + (pad 3 smd rect (at ${left}2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask)) ${'' /* side mounts */} - (pad "" smd rect (at 3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask)) - (pad "" smd rect (at 3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask)) - (pad "" smd rect (at -3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask)) - (pad "" smd rect (at -3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param.side}.Cu ${p.param.side}.Paste ${p.param.side}.Mask)) + (pad "" smd rect (at 3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask)) + (pad "" smd rect (at 3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask)) + (pad "" smd rect (at -3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask)) + (pad "" smd rect (at -3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask)) ) ` diff --git a/src/footprints/trrs.js b/src/footprints/trrs.js index 7b30569..6728e7b 100644 --- a/src/footprints/trrs.js +++ b/src/footprints/trrs.js @@ -34,17 +34,15 @@ // pins 1 and 2 must be identical if symmetric is true, as they will overlap module.exports = { - nets: { + params: { + designator: 'TRRS', + reverse: false, + symmetric: false, A: undefined, B: undefined, C: undefined, D: undefined }, - params: { - class: 'TRRS', - reverse: false, - symmetric: false - }, body: p => { const standard = ` (module TRRS-PJ-320A-dual (layer F.Cu) (tedit 5970F8E5) @@ -73,20 +71,20 @@ module.exports = { } function pins(def_neg, def_pos) { return ` - (pad 1 thru_hole oval (at ${def_neg} 11.3 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.net.A.str}) - (pad 2 thru_hole oval (at ${def_pos} 10.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.net.B.str}) - (pad 3 thru_hole oval (at ${def_pos} 6.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.net.C.str}) - (pad 4 thru_hole oval (at ${def_pos} 3.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.net.D.str}) + (pad 1 thru_hole oval (at ${def_neg} 11.3 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.A.str}) + (pad 2 thru_hole oval (at ${def_pos} 10.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.B.str}) + (pad 3 thru_hole oval (at ${def_pos} 6.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.C.str}) + (pad 4 thru_hole oval (at ${def_pos} 3.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.D.str}) ` } - if(p.param.reverse & p.param.symmetric) { + if(p.reverse & p.symmetric) { return ` ${standard} ${stabilizers('-2.3')} ${pins('0', '-4.6')} ${pins('-4.6', '0')}) ` - } else if(p.param.reverse) { + } else if(p.reverse) { return ` ${standard} ${stabilizers('-2.3')} diff --git a/src/footprints/via.js b/src/footprints/via.js index 7e439aa..c83924a 100644 --- a/src/footprints/via.js +++ b/src/footprints/via.js @@ -3,7 +3,7 @@ // net: the net this via should be connected to module.exports = { - nets: { + params: { net: undefined }, body: p => ` @@ -14,7 +14,7 @@ module.exports = { (fp_text value VIA-0.6mm (at 0 -1.4) (layer F.Fab) hide (effects (font (size 1 1) (thickness 0.15)))) ${'' /* via */} - (pad 1 thru_hole circle (at 0 0) (size 0.6 0.6) (drill 0.3) (layers *.Cu) (zone_connect 2) ${p.net.net.str}) + (pad 1 thru_hole circle (at 0 0) (size 0.6 0.6) (drill 0.3) (layers *.Cu) (zone_connect 2) ${p.net.str}) ) ` } \ No newline at end of file diff --git a/src/pcbs.js b/src/pcbs.js index 0cede01..be8fce4 100644 --- a/src/pcbs.js +++ b/src/pcbs.js @@ -1,4 +1,5 @@ const m = require('makerjs') +const u = require('./utils') const a = require('./assert') const prep = require('./prepare') const anchor = require('./anchor').parse @@ -162,17 +163,41 @@ const footprint = exports._footprint = (points, net_indexer, component_indexer, // parsing parameters for (const [param_name, param_def] of Object.entries(fp.params)) { - let value = prep.extend(param_def.value, params[param_name]) - // templating support + // expand param definition shorthand + let parsed_def = param_def + let def_type = a.type(param_def)(units) + if (def_type == 'string') { + parsed_def = {type: 'string', value: param_def} + } else if (def_type == 'number') { + parsed_def = {type: 'number', value: a.mathnum(param_def)(units)} + } else if (def_type == 'boolean') { + parsed_def = {type: 'boolean', value: param_def} + } else if (def_type == 'undefined') { + parsed_def = {type: 'net', value: undefined} + } + + // combine default value with potential user override + let value = prep.extend(parsed_def.value, params[param_name]) + let type = parsed_def.type + + // templating support, with conversion back to raw datatypes + const converters = { + string: v => v, + number: v => a.sane(v, `${name}.params.${param_name}`, 'number')(units), + boolean: v => v === 'true', + net: v => v, + anchor: v => v + } if (a.type(value)() == 'string') { value = u.template(value, point.meta) + value = converters[type](value) } // type-specific processing - if (['string', 'number', 'boolean'].includes(param_def.type)) { - parsed_params[param_name] = a.sane(value, `${name}.params.${param_name}`, param_def.type)(units) - } else if (param_def.type == 'net') { + if (['string', 'number', 'boolean'].includes(type)) { + parsed_params[param_name] = value + } else if (type == 'net') { const net = a.sane(value, `${name}.params.${param_name}`, 'string')(units) const index = net_indexer(net) parsed_params[param_name] = { @@ -180,7 +205,7 @@ const footprint = exports._footprint = (points, net_indexer, component_indexer, index: index, str: `(net ${index} "${net}")` } - } else if (param_def.type == 'anchor') { + } else if (type == 'anchor') { let parsed_anchor = anchor(value || {}, `${name}.params.${param_name}`, points, point)(units) parsed_anchor.y = -parsed_anchor.y // kicad mirror, as per usual parsed_params[param_name] = parsed_anchor @@ -188,7 +213,7 @@ const footprint = exports._footprint = (points, net_indexer, component_indexer, } // reference - const component_ref = parsed_params.ref = component_indexer(parsed_params.param.class || '_') + const component_ref = parsed_params.ref = component_indexer(parsed_params.designator || '_') parsed_params.ref_hide = extra.references ? '' : 'hide' // footprint positioning diff --git a/test/fixtures/bundle.zip b/test/fixtures/bundle.zip index 5314848..0c1ea1c 100644 Binary files a/test/fixtures/bundle.zip and b/test/fixtures/bundle.zip differ diff --git a/test/fixtures/bundle/footprints/injected.js b/test/fixtures/bundle/footprints/injected.js index 9ef0ad5..579a160 100644 --- a/test/fixtures/bundle/footprints/injected.js +++ b/test/fixtures/bundle/footprints/injected.js @@ -1,6 +1,6 @@ module.exports = { params: { - class: 'I' + designator: 'I' }, body: p => ` (module injected_test_footprint (layer F.Cu) (tedit 5E1ADAC2) diff --git a/test/footprints/button.yaml b/test/footprints/button.yaml index bcb66f0..dd424d3 100644 --- a/test/footprints/button.yaml +++ b/test/footprints/button.yaml @@ -3,15 +3,14 @@ pcbs.pcb.footprints: # front - what: button - nets: + params: from: from to: to # back - what: button - nets: + params: from: from to: to - params: side: B adjust.shift: [50, 0] \ No newline at end of file diff --git a/test/footprints/choc.yaml b/test/footprints/choc.yaml index 303b117..2c3e39e 100644 --- a/test/footprints/choc.yaml +++ b/test/footprints/choc.yaml @@ -3,43 +3,39 @@ pcbs.pcb.footprints: # base - what: choc - nets: + params: from: from to: to # keycap visualization - what: choc - nets: + params: from: from to: to - params: keycaps: true adjust.shift: [50, 0] # reverse - what: choc - nets: + params: from: from to: to - params: reverse: true adjust.shift: [100, 0] # hotswap - what: choc - nets: + params: from: from to: to - params: hotswap: true adjust.shift: [150, 0] # both reverse and hotswap - what: choc - nets: + params: from: from to: to - params: reverse: true hotswap: true adjust.shift: [200, 0] \ No newline at end of file diff --git a/test/footprints/chocmini.yaml b/test/footprints/chocmini.yaml index 32311b4..2cadb43 100644 --- a/test/footprints/chocmini.yaml +++ b/test/footprints/chocmini.yaml @@ -3,24 +3,22 @@ pcbs.pcb.footprints: # base - what: chocmini - nets: + params: from: from to: to # keycap visualization - what: chocmini - nets: + params: from: from to: to - params: keycaps: true adjust.shift: [50, 0] # reverse - what: chocmini - nets: + params: from: from to: to - params: reverse: true adjust.shift: [100, 0] diff --git a/test/footprints/diode.yaml b/test/footprints/diode.yaml index bb465a3..8e6319c 100644 --- a/test/footprints/diode.yaml +++ b/test/footprints/diode.yaml @@ -1,6 +1,6 @@ points.zones.matrix: pcbs.pcb.footprints: - what: diode - nets: + params: from: from to: to \ No newline at end of file diff --git a/test/footprints/mx.yaml b/test/footprints/mx.yaml index fccbd2c..ee4a5dc 100644 --- a/test/footprints/mx.yaml +++ b/test/footprints/mx.yaml @@ -3,43 +3,39 @@ pcbs.pcb.footprints: # base - what: mx - nets: + params: from: from to: to # keycap visualization - what: mx - nets: + params: from: from to: to - params: keycaps: true adjust.shift: [50, 0] # reverse - what: mx - nets: + params: from: from to: to - params: reverse: true adjust.shift: [100, 0] # hotswap - what: mx - nets: + params: from: from to: to - params: hotswap: true adjust.shift: [150, 0] # both reverse and hotswap - what: mx - nets: + params: from: from to: to - params: reverse: true hotswap: true adjust.shift: [200, 0] \ No newline at end of file diff --git a/test/footprints/pad.yaml b/test/footprints/pad.yaml index 00c605d..3d05355 100644 --- a/test/footprints/pad.yaml +++ b/test/footprints/pad.yaml @@ -2,29 +2,26 @@ points.zones.matrix: pcbs.pcb.footprints: - what: pad - nets: + params: net: net - what: pad - nets: - net: net params: + net: net align: right text: text adjust.shift: [50, 0] - what: pad - nets: - net: net params: + net: net align: up front: false adjust.shift: [0, 50] - what: pad - nets: - net: net params: + net: net align: down mirrored: true adjust.shift: [50, 50] diff --git a/test/footprints/rest.yaml b/test/footprints/rest.yaml index afea689..769682a 100644 --- a/test/footprints/rest.yaml +++ b/test/footprints/rest.yaml @@ -2,42 +2,42 @@ points.zones.matrix: pcbs.pcb.footprints: - what: alps - nets: + params: from: from to: to - what: jstph - nets: + params: pos: pos neg: neg adjust.shift: [50, 0] - what: jumper - nets: + params: from: from to: to adjust.shift: [100, 0] - what: oled - nets: + params: SDA: SDA SCL: SCL adjust.shift: [0, 50] - what: omron - nets: + params: from: from to: to adjust.shift: [50, 50] - what: rgb - nets: + params: din: din dout: dout adjust.shift: [100, 50] - what: rotary - nets: + params: from: from to: to A: A @@ -46,7 +46,7 @@ pcbs.pcb.footprints: adjust.shift: [0, 100] - what: scrollwheel - nets: + params: from: from to: to A: A @@ -56,12 +56,12 @@ pcbs.pcb.footprints: adjust.shift: [50, 100] - what: slider - nets: + params: from: from to: to adjust.shift: [100, 100] - what: via - nets: + params: net: net adjust.shift: [0, 150] \ No newline at end of file diff --git a/test/footprints/trrs.yaml b/test/footprints/trrs.yaml index c2f39db..36547ab 100644 --- a/test/footprints/trrs.yaml +++ b/test/footprints/trrs.yaml @@ -3,7 +3,7 @@ pcbs.pcb.footprints: # basic - what: trrs - nets: + params: A: A B: B C: C @@ -11,23 +11,21 @@ pcbs.pcb.footprints: # reversible - what: trrs - nets: + params: A: A B: B C: C D: D - params: reverse: true adjust.shift: [50, 0] # reversible + symmetric - what: trrs - nets: + params: A: A B: B C: C D: D - params: reverse: true symmetric: true adjust.shift: [100, 0] \ No newline at end of file diff --git a/test/helpers/mock_footprints.js b/test/helpers/mock_footprints.js index ddb0e82..8a6b47f 100644 --- a/test/helpers/mock_footprints.js +++ b/test/helpers/mock_footprints.js @@ -1,11 +1,9 @@ exports.inject = (ergogen) => { ergogen.inject('footprint', 'trace_test', { - nets: { - P1: 'P1' - }, params: { - class: 'T', - side: 'F' + designator: 'T', + side: 'F', + P1: {type: 'net', value: 'P1'} }, body: p => { return ` @@ -15,26 +13,24 @@ exports.inject = (ergogen) => { ${p.at /* parametric position */} (pad 1 smd rect (at 0 0 ${p.rot}) (size 1 1) (layers F.Cu F.Paste F.Mask) - ${p.net.P1.str} (solder_mask_margin 0.2)) + ${p.P1.str} (solder_mask_margin 0.2)) (pad 2 smd rect (at 5 5 ${p.rot}) (size 1 1) (layers F.Cu F.Paste F.Mask) - ${p.net.P1.str} (solder_mask_margin 0.2)) + ${p.P1.str} (solder_mask_margin 0.2)) ) - (segment (start ${p.xy(0, 0)}) (end ${p.xy(5, 5)}) (width 0.25) (layer F.Cu) (net ${p.net.P1.index})) + (segment (start ${p.xy(0, 0)}) (end ${p.xy(5, 5)}) (width 0.25) (layer F.Cu) (net ${p.P1.index})) ` } }) ergogen.inject('footprint', 'zone_test', { - nets: { - P1: 'P1' - }, params: { - class: 'T', - side: 'F' + designator: 'T', + side: 'F', + P1: {type: 'net', value: 'P1'} }, body: p => { return ` @@ -44,14 +40,14 @@ exports.inject = (ergogen) => { ${p.at /* parametric position */} (pad 1 smd rect (at 0 0 ${p.rot}) (size 1 1) (layers F.Cu F.Paste F.Mask) - ${p.net.P1.str} (solder_mask_margin 0.2)) + ${p.P1.str} (solder_mask_margin 0.2)) (pad 2 smd rect (at 5 5 ${p.rot}) (size 1 1) (layers F.Cu F.Paste F.Mask) - ${p.net.P1.str} (solder_mask_margin 0.2)) + ${p.P1.str} (solder_mask_margin 0.2)) ) - (zone (net ${p.net.P1.index}) (net_name ${p.net.P1.name}) (layer ${p.param.side}.Cu) (tstamp 0) (hatch full 0.508) + (zone (net ${p.P1.index}) (net_name ${p.P1.name}) (layer ${p.side}.Cu) (tstamp 0) (hatch full 0.508) (connect_pads (clearance 0.508)) (min_thickness 0.254) (fill yes (arc_segments 32) (thermal_gap 0.508) (thermal_bridge_width 0.508)) @@ -63,9 +59,8 @@ exports.inject = (ergogen) => { }) ergogen.inject('footprint', 'dynamic_net_test', { - nets: {}, params: { - class: 'T', + designator: 'T', side: 'F' }, body: p => { @@ -91,13 +86,10 @@ exports.inject = (ergogen) => { }) ergogen.inject('footprint', 'anchor_test', { - nets: {}, params: { - class: 'T', - side: 'F' - }, - anchors: { - end: undefined + designator: 'T', + side: 'F', + end: {type: 'anchor', value: undefined} }, body: p => { return ` @@ -106,7 +98,7 @@ exports.inject = (ergogen) => { ${p.at /* parametric position */} - (fp_line (start 0 0) (end ${p.anchors.end.x} ${p.anchors.end.y}) (layer Dwgs.User) (width 0.05)) + (fp_line (start 0 0) (end ${p.end.x} ${p.end.y}) (layer Dwgs.User) (width 0.05)) ) @@ -115,7 +107,6 @@ exports.inject = (ergogen) => { }) ergogen.inject('footprint', 'references_test', { - nets: {}, params: {}, body: p => { return `references ${p.ref_hide ? 'hidden' : 'shown'}` diff --git a/test/pcbs/mock_footprints.yaml b/test/pcbs/mock_footprints.yaml index 6444a04..e3614a7 100644 --- a/test/pcbs/mock_footprints.yaml +++ b/test/pcbs/mock_footprints.yaml @@ -24,7 +24,7 @@ pcbs: what: dynamic_net_test anc: what: anchor_test - anchors: + params: end: ref: matrix shift: [10, 10] \ No newline at end of file