Skip to content

Commit 9ca4461

Browse files
authored
SVGPCB templates name fix (#348)
Makes the ID consistent with the netlist name generation.
1 parent ba1570c commit 9ca4461

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

electronics_lib/LedMatrix.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def _svgpcb_template(self) -> str:
5151
5252
for (let xIndex=0; xIndex < kXCount; xIndex++) {{
5353
ledPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
54-
obj.footprints[`d[${{yIndex}}_${{xIndex}}]`] = led = board.add({led_footprint}, {{
54+
obj.footprints[`led[${{yIndex}}_${{xIndex}}]`] = led = board.add({led_footprint}, {{
5555
translate: ledPos,
56-
id: `{self._svgpcb_pathname()}_d[${{yIndex}}_${{xIndex}}]`
56+
id: `{self._svgpcb_pathname()}_led_${{yIndex}}_${{xIndex}}_`
5757
}})
5858
rowLeds.push(led)
5959
@@ -98,9 +98,9 @@ def _svgpcb_template(self) -> str:
9898
allResistors = []
9999
for (let xIndex=0; xIndex < kXCount; xIndex++) {{
100100
const resPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * kYCount]
101-
obj.footprints[`r[${{xIndex + 1}}]`] = res = board.add({res_footprint}, {{
101+
obj.footprints[`res[${{xIndex + 1}}]`] = res = board.add({res_footprint}, {{
102102
translate: resPos,
103-
id: `{self._svgpcb_pathname()}_r[${{xIndex + 1}}]`
103+
id: `{self._svgpcb_pathname()}_res_${{xIndex + 1}}_`
104104
}})
105105
allResistors.push(res)
106106

electronics_lib/Neopixel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _svgpcb_template(self) -> str:
272272
obj.footprints[`led[${{i}}]`] = led = board.add({led_footprint}, {{
273273
translate: origin,
274274
rotate: angle + rot,
275-
id: `{self._svgpcb_pathname()}_led[${{i}}]`
275+
id: `{self._svgpcb_pathname()}_led_${{i}}_`
276276
}})
277277
278278
const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))

electronics_lib/SwitchMatrix.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,19 @@ def _svgpcb_template(self) -> str:
5555
index = yIndex * ncols + xIndex + 1
5656
5757
buttonPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
58-
obj.footprints[`sw[${{xIndex}}][${{yIndex}}]`] = button = board.add(
58+
obj.footprints[`sw[${{xIndex}},${{yIndex}}]`] = button = board.add(
5959
{switch_footprint},
6060
{{
6161
translate: buttonPos, rotate: 0,
62-
id: `{self._svgpcb_pathname()}_sw[${{xIndex}}][${{yIndex}}]`
62+
id: `{self._svgpcb_pathname()}_sw_${{xIndex}}_${{yIndex}}_`
6363
}})
6464
6565
diodePos = [buttonPos[0] + diodeOffset[0], buttonPos[1] + diodeOffset[1]]
66-
obj[`d[${{xIndex}}][${{yIndex}}]`] = diode = board.add(
66+
obj[`d[${{xIndex}},${{yIndex}}]`] = diode = board.add(
6767
{diode_footprint},
6868
{{
6969
translate: diodePos, rotate: 90,
70-
id: `{self._svgpcb_pathname()}_d[${{xIndex}}][${{yIndex}}]`
70+
id: `{self._svgpcb_pathname()}_d_${{xIndex}}_${{yIndex}}_`
7171
}})
7272
7373
// create stub wire for button -> column common line

examples/BasicKeyboard/BasicKeyboard.svgpcb.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ function SwitchMatrix_2_3_sw(xy, colSpacing=1, rowSpacing=1, diodeOffset=[0.25,
2323
index = yIndex * ncols + xIndex + 1
2424

2525
buttonPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
26-
obj.footprints[`sw[${xIndex}][${yIndex}]`] = button = board.add(
26+
obj.footprints[`sw[${xIndex},${yIndex}]`] = button = board.add(
2727
SW_Hotswap_Kailh_MX,
2828
{
2929
translate: buttonPos, rotate: 0,
30-
id: `sw_sw[${xIndex}][${yIndex}]`
30+
id: `sw_sw_${xIndex}_${yIndex}_`
3131
})
3232

3333
diodePos = [buttonPos[0] + diodeOffset[0], buttonPos[1] + diodeOffset[1]]
34-
obj[`d[${xIndex}][${yIndex}]`] = diode = board.add(
34+
obj[`d[${xIndex},${yIndex}]`] = diode = board.add(
3535
D_SMA,
3636
{
3737
translate: diodePos, rotate: 90,
38-
id: `sw_d[${xIndex}][${yIndex}]`
38+
id: `sw_d_${xIndex}_${yIndex}_`
3939
})
4040

4141
// create stub wire for button -> column common line

examples/IotKnob/IotKnob.svgpcb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function NeopixelArrayCircular_4_rgb_knob(xy, rot=90, radius=1, startAngle=0, en
7070
obj.footprints[`led[${i}]`] = led = board.add(LED_SK6812_EC15_1_5x1_5mm, {
7171
translate: origin,
7272
rotate: angle + rot,
73-
id: `rgb_knob_led[${i}]`
73+
id: `rgb_knob_led_${i}_`
7474
})
7575

7676
const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))
@@ -181,7 +181,7 @@ function NeopixelArrayCircular_24_rgb_ring(xy, rot=90, radius=1, startAngle=0, e
181181
obj.footprints[`led[${i}]`] = led = board.add(LED_SK6812_EC15_1_5x1_5mm, {
182182
translate: origin,
183183
rotate: angle + rot,
184-
id: `rgb_ring_led[${i}]`
184+
id: `rgb_ring_led_${i}_`
185185
})
186186

187187
const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))
@@ -292,7 +292,7 @@ function NeopixelArrayCircular_6_rgb_sw(xy, rot=90, radius=1, startAngle=0, endA
292292
obj.footprints[`led[${i}]`] = led = board.add(LED_SK6812_EC15_1_5x1_5mm, {
293293
translate: origin,
294294
rotate: angle + rot,
295-
id: `rgb_sw_led[${i}]`
295+
id: `rgb_sw_led_${i}_`
296296
})
297297

298298
const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))

examples/Keyboard/Keyboard.svgpcb.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ function SwitchMatrix_2_3_sw(xy, colSpacing=1, rowSpacing=1, diodeOffset=[0.25,
2323
index = yIndex * ncols + xIndex + 1
2424

2525
buttonPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
26-
obj.footprints[`sw[${xIndex}][${yIndex}]`] = button = board.add(
26+
obj.footprints[`sw[${xIndex},${yIndex}]`] = button = board.add(
2727
SW_Hotswap_Kailh_MX,
2828
{
2929
translate: buttonPos, rotate: 0,
30-
id: `sw_sw[${xIndex}][${yIndex}]`
30+
id: `sw_sw_${xIndex}_${yIndex}_`
3131
})
3232

3333
diodePos = [buttonPos[0] + diodeOffset[0], buttonPos[1] + diodeOffset[1]]
34-
obj[`d[${xIndex}][${yIndex}]`] = diode = board.add(
34+
obj[`d[${xIndex},${yIndex}]`] = diode = board.add(
3535
D_SMA,
3636
{
3737
translate: diodePos, rotate: 90,
38-
id: `sw_d[${xIndex}][${yIndex}]`
38+
id: `sw_d_${xIndex}_${yIndex}_`
3939
})
4040

4141
// create stub wire for button -> column common line

examples/LedMatrix/LedMatrix.svgpcb.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function CharlieplexedLedMatrix_5_6_matrix(xy, colSpacing=1, rowSpacing=1) {
2424

2525
for (let xIndex=0; xIndex < kXCount; xIndex++) {
2626
ledPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
27-
obj.footprints[`d[${yIndex}_${xIndex}]`] = led = board.add(LED_0603_1608Metric, {
27+
obj.footprints[`led[${yIndex}_${xIndex}]`] = led = board.add(LED_0603_1608Metric, {
2828
translate: ledPos,
29-
id: `matrix_d[${yIndex}_${xIndex}]`
29+
id: `matrix_led_${yIndex}_${xIndex}_`
3030
})
3131
rowLeds.push(led)
3232

@@ -71,9 +71,9 @@ function CharlieplexedLedMatrix_5_6_matrix(xy, colSpacing=1, rowSpacing=1) {
7171
allResistors = []
7272
for (let xIndex=0; xIndex < kXCount; xIndex++) {
7373
const resPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * kYCount]
74-
obj.footprints[`r[${xIndex + 1}]`] = res = board.add(R_0603_1608Metric, {
74+
obj.footprints[`res[${xIndex + 1}]`] = res = board.add(R_0603_1608Metric, {
7575
translate: resPos,
76-
id: `matrix_r[${xIndex + 1}]`
76+
id: `matrix_res_${xIndex + 1}_`
7777
})
7878
allResistors.push(res)
7979

0 commit comments

Comments
 (0)