Skip to content

Commit 7cbbb1f

Browse files
committed
wip
1 parent cc4e12d commit 7cbbb1f

File tree

66 files changed

+125
-46615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+125
-46615
lines changed

edg/electronics_model/SvgPcbBackend.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,25 @@ def arrange_blocks(blocks: List[NetBlock],
3030
BLOCK_BORDER = 2 # mm
3131

3232
# create list of blocks by path
33-
block_subblocks: Dict[Tuple[str, ...], Set[str]] = {}
33+
block_subblocks: Dict[Tuple[str, ...], List[str]] = {} # list to maintain sortedness
3434
block_footprints: Dict[Tuple[str, ...], List[Union[NetBlock, BlackBoxBlock]]] = {}
3535

3636
# for here, we only group one level deep
3737
for block in blocks:
3838
containing_path = block.full_path.blocks[0:min(len(block.full_path.blocks) - 1, 1)]
3939
block_footprints.setdefault(containing_path, []).append(block)
4040
for i in range(len(containing_path)):
41-
block_subblocks.setdefault(tuple(containing_path[:i]), set()).add(containing_path[i])
41+
subblocks_list = block_subblocks.setdefault(tuple(containing_path[:i]), list())
42+
if containing_path[i] not in subblocks_list:
43+
subblocks_list.append(containing_path[i])
4244

4345
for blackbox in additional_blocks:
4446
containing_path = blackbox.path.blocks[0:min(len(blackbox.path.blocks) - 1, 1)]
4547
block_footprints.setdefault(containing_path, []).append(blackbox)
4648
for i in range(len(containing_path)):
47-
block_subblocks.setdefault(tuple(containing_path[:i]), set()).add(containing_path[i])
49+
subblocks_list = block_subblocks.setdefault(tuple(containing_path[:i]), list())
50+
if containing_path[i] not in subblocks_list:
51+
subblocks_list.append(containing_path[i])
4852

4953
def arrange_hierarchy(root: Tuple[str, ...]) -> PlacedBlock:
5054
"""Recursively arranges the immediate components of a hierarchy, treating each element
@@ -53,7 +57,7 @@ def arrange_hierarchy(root: Tuple[str, ...]) -> PlacedBlock:
5357
ASPECT_RATIO = 16 / 9
5458

5559
sub_placed: List[Tuple[float, float, Union[PlacedBlock, NetBlock, BlackBoxBlock]]] = [] # (width, height, entry)
56-
for subblock in block_subblocks.get(root, set()):
60+
for subblock in block_subblocks.get(root, list()):
5761
subplaced = arrange_hierarchy(root + (subblock,))
5862
sub_placed.append((subplaced.width + BLOCK_BORDER, subplaced.height + BLOCK_BORDER, subplaced))
5963

examples/BldcController/BldcController.svgpcb.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ const board = new PCB();
22

33
// jlc_th.th1
44
const H1 = board.add(JlcToolingHole_1_152mm, {
5-
translate: pt(0.735, 1.763), rotate: 0,
5+
translate: pt(0.485, 1.763), rotate: 0,
66
id: 'H1'
77
})
88
// jlc_th.th2
99
const H2 = board.add(JlcToolingHole_1_152mm, {
10-
translate: pt(0.775, 1.763), rotate: 0,
10+
translate: pt(0.524, 1.763), rotate: 0,
1111
id: 'H2'
1212
})
1313
// jlc_th.th3
1414
const H3 = board.add(JlcToolingHole_1_152mm, {
15-
translate: pt(0.735, 1.803), rotate: 0,
15+
translate: pt(0.485, 1.803), rotate: 0,
1616
id: 'H3'
1717
})
1818
// mcu
1919
const U1 = board.add(FEATHERWING_NODIM, {
20-
translate: pt(0.893, 1.763), rotate: 0,
20+
translate: pt(0.643, 1.763), rotate: 0,
2121
id: 'U1'
2222
})
2323
// motor_pwr.conn
2424
const J1 = board.add(JST_PH_B2B_PH_K_1x02_P2_00mm_Vertical, {
25-
translate: pt(1.738, 1.286), rotate: 0,
25+
translate: pt(2.135, 0.937), rotate: 0,
2626
id: 'J1'
2727
})
2828
// sw1.package
@@ -32,52 +32,52 @@ const SW1 = board.add(SW_SPST_SKQG_WithoutStem, {
3232
})
3333
// ledr.package
3434
const D1 = board.add(LED_0603_1608Metric, {
35-
translate: pt(0.058, 1.519), rotate: 0,
35+
translate: pt(1.951, 1.185), rotate: 0,
3636
id: 'D1'
3737
})
3838
// ledr.res
3939
const R1 = board.add(R_0603_1608Metric, {
40-
translate: pt(0.058, 1.617), rotate: 0,
40+
translate: pt(1.950, 1.282), rotate: 0,
4141
id: 'R1'
4242
})
4343
// ledg.package
4444
const D2 = board.add(LED_0603_1608Metric, {
45-
translate: pt(0.293, 1.519), rotate: 0,
45+
translate: pt(2.185, 1.185), rotate: 0,
4646
id: 'D2'
4747
})
4848
// ledg.res
4949
const R2 = board.add(R_0603_1608Metric, {
50-
translate: pt(0.293, 1.617), rotate: 0,
50+
translate: pt(2.185, 1.282), rotate: 0,
5151
id: 'R2'
5252
})
5353
// ledb.package
5454
const D3 = board.add(LED_0603_1608Metric, {
55-
translate: pt(2.340, 1.185), rotate: 0,
55+
translate: pt(0.058, 1.519), rotate: 0,
5656
id: 'D3'
5757
})
5858
// ledb.res
5959
const R3 = board.add(R_0603_1608Metric, {
60-
translate: pt(2.340, 1.282), rotate: 0,
60+
translate: pt(0.058, 1.617), rotate: 0,
6161
id: 'R3'
6262
})
6363
// i2c_pull.scl_res.res
6464
const R4 = board.add(R_0603_1608Metric, {
65-
translate: pt(0.763, 1.519), rotate: 0,
65+
translate: pt(0.293, 1.519), rotate: 0,
6666
id: 'R4'
6767
})
6868
// i2c_pull.sda_res.res
6969
const R5 = board.add(R_0603_1608Metric, {
70-
translate: pt(0.763, 1.616), rotate: 0,
70+
translate: pt(0.293, 1.616), rotate: 0,
7171
id: 'R5'
7272
})
7373
// i2c_tp.tp_scl.tp
7474
const TP1 = board.add(TestPoint_TE_RCT_0805, {
75-
translate: pt(2.098, 1.193), rotate: 0,
75+
translate: pt(1.708, 1.193), rotate: 0,
7676
id: 'TP1'
7777
})
7878
// i2c_tp.tp_sda.tp
7979
const TP2 = board.add(TestPoint_TE_RCT_0805, {
80-
translate: pt(2.098, 1.307), rotate: 0,
80+
translate: pt(1.708, 1.307), rotate: 0,
8181
id: 'TP2'
8282
})
8383
// i2c.conn
@@ -97,17 +97,17 @@ const R7 = board.add(R_0603_1608Metric, {
9797
})
9898
// ref_buf.amp.ic
9999
const U2 = board.add(SOT_23_5, {
100-
translate: pt(0.516, 0.874), rotate: 0,
100+
translate: pt(0.081, 0.874), rotate: 0,
101101
id: 'U2'
102102
})
103103
// ref_buf.amp.vdd_cap.cap
104104
const C1 = board.add(C_0603_1608Metric, {
105-
translate: pt(0.494, 1.009), rotate: 0,
105+
translate: pt(0.058, 1.009), rotate: 0,
106106
id: 'C1'
107107
})
108108
// ref_tp.tp
109109
const TP3 = board.add(TestPoint_TE_RCT_0805, {
110-
translate: pt(1.741, 1.528), rotate: 0,
110+
translate: pt(1.005, 1.528), rotate: 0,
111111
id: 'TP3'
112112
})
113113
// hall.conn
@@ -132,32 +132,32 @@ const R10 = board.add(R_0603_1608Metric, {
132132
})
133133
// hall_tp.tp[u].tp
134134
const TP4 = board.add(TestPoint_TE_RCT_0805, {
135-
translate: pt(2.134, 0.037), rotate: 0,
135+
translate: pt(1.633, 0.037), rotate: 0,
136136
id: 'TP4'
137137
})
138138
// hall_tp.tp[v].tp
139139
const TP5 = board.add(TestPoint_TE_RCT_0805, {
140-
translate: pt(2.134, 0.152), rotate: 0,
140+
translate: pt(1.633, 0.152), rotate: 0,
141141
id: 'TP5'
142142
})
143143
// hall_tp.tp[w].tp
144144
const TP6 = board.add(TestPoint_TE_RCT_0805, {
145-
translate: pt(2.134, 0.266), rotate: 0,
145+
translate: pt(1.633, 0.266), rotate: 0,
146146
id: 'TP6'
147147
})
148148
// vsense.div.top_res
149149
const R11 = board.add(R_0603_1608Metric, {
150-
translate: pt(0.997, 1.519), rotate: 0,
150+
translate: pt(0.762, 1.519), rotate: 0,
151151
id: 'R11'
152152
})
153153
// vsense.div.bottom_res
154154
const R12 = board.add(R_0603_1608Metric, {
155-
translate: pt(0.997, 1.616), rotate: 0,
155+
translate: pt(0.762, 1.616), rotate: 0,
156156
id: 'R12'
157157
})
158158
// vsense_tp.tp
159159
const TP7 = board.add(TestPoint_TE_RCT_0805, {
160-
translate: pt(1.490, 1.528), rotate: 0,
160+
translate: pt(1.255, 1.528), rotate: 0,
161161
id: 'TP7'
162162
})
163163
// isense.sense.res.res
@@ -197,12 +197,12 @@ const R17 = board.add(R_0603_1608Metric, {
197197
})
198198
// isense_tp.tp
199199
const TP8 = board.add(TestPoint_TE_RCT_0805, {
200-
translate: pt(1.991, 1.528), rotate: 0,
200+
translate: pt(1.506, 1.528), rotate: 0,
201201
id: 'TP8'
202202
})
203203
// isense_clamp.res
204204
const R18 = board.add(R_0603_1608Metric, {
205-
translate: pt(0.559, 1.792), rotate: 0,
205+
translate: pt(0.309, 1.792), rotate: 0,
206206
id: 'R18'
207207
})
208208
// bldc_drv.ic
@@ -257,37 +257,37 @@ const R21 = board.add(R_2512_6332Metric, {
257257
})
258258
// bldc_fault_tp.tp
259259
const TP9 = board.add(TestPoint_TE_RCT_0805, {
260-
translate: pt(0.066, 1.801), rotate: 0,
260+
translate: pt(1.756, 1.528), rotate: 0,
261261
id: 'TP9'
262262
})
263263
// bldc_en_tp.tp[1].tp
264264
const TP10 = board.add(TestPoint_TE_RCT_0805, {
265-
translate: pt(1.633, 0.037), rotate: 0,
265+
translate: pt(1.883, 0.037), rotate: 0,
266266
id: 'TP10'
267267
})
268268
// bldc_en_tp.tp[2].tp
269269
const TP11 = board.add(TestPoint_TE_RCT_0805, {
270-
translate: pt(1.633, 0.152), rotate: 0,
270+
translate: pt(1.883, 0.152), rotate: 0,
271271
id: 'TP11'
272272
})
273273
// bldc_en_tp.tp[3].tp
274274
const TP12 = board.add(TestPoint_TE_RCT_0805, {
275-
translate: pt(1.633, 0.266), rotate: 0,
275+
translate: pt(1.883, 0.266), rotate: 0,
276276
id: 'TP12'
277277
})
278278
// bldc_in_tp.tp[1].tp
279279
const TP13 = board.add(TestPoint_TE_RCT_0805, {
280-
translate: pt(1.883, 0.037), rotate: 0,
280+
translate: pt(2.134, 0.037), rotate: 0,
281281
id: 'TP13'
282282
})
283283
// bldc_in_tp.tp[2].tp
284284
const TP14 = board.add(TestPoint_TE_RCT_0805, {
285-
translate: pt(1.883, 0.152), rotate: 0,
285+
translate: pt(2.134, 0.152), rotate: 0,
286286
id: 'TP14'
287287
})
288288
// bldc_in_tp.tp[3].tp
289289
const TP15 = board.add(TestPoint_TE_RCT_0805, {
290-
translate: pt(1.883, 0.266), rotate: 0,
290+
translate: pt(2.134, 0.266), rotate: 0,
291291
id: 'TP15'
292292
})
293293
// bldc.conn
@@ -297,52 +297,52 @@ const J4 = board.add(JST_PH_B3B_PH_K_1x03_P2_00mm_Vertical, {
297297
})
298298
// curr_amp[1].amp.ic
299299
const U5 = board.add(SOT_23_5, {
300-
translate: pt(0.796, 0.874), rotate: 0,
300+
translate: pt(0.360, 0.874), rotate: 0,
301301
id: 'U5'
302302
})
303303
// curr_amp[1].amp.vdd_cap.cap
304304
const C9 = board.add(C_0603_1608Metric, {
305-
translate: pt(0.974, 0.836), rotate: 0,
305+
translate: pt(0.539, 0.836), rotate: 0,
306306
id: 'C9'
307307
})
308308
// curr_amp[1].r1
309309
const R22 = board.add(R_0603_1608Metric, {
310-
translate: pt(0.773, 1.009), rotate: 0,
310+
translate: pt(0.338, 1.009), rotate: 0,
311311
id: 'R22'
312312
})
313313
// curr_amp[1].r2
314314
const R23 = board.add(R_0603_1608Metric, {
315-
translate: pt(0.929, 1.009), rotate: 0,
315+
translate: pt(0.494, 1.009), rotate: 0,
316316
id: 'R23'
317317
})
318318
// curr_tp[1].tp
319319
const TP16 = board.add(TestPoint_TE_RCT_0805, {
320-
translate: pt(2.241, 1.528), rotate: 0,
320+
translate: pt(2.006, 1.528), rotate: 0,
321321
id: 'TP16'
322322
})
323323
// curr_amp[2].amp.ic
324324
const U6 = board.add(SOT_23_5, {
325-
translate: pt(0.081, 0.874), rotate: 0,
325+
translate: pt(0.796, 0.874), rotate: 0,
326326
id: 'U6'
327327
})
328328
// curr_amp[2].amp.vdd_cap.cap
329329
const C10 = board.add(C_0603_1608Metric, {
330-
translate: pt(0.259, 0.836), rotate: 0,
330+
translate: pt(0.974, 0.836), rotate: 0,
331331
id: 'C10'
332332
})
333333
// curr_amp[2].r1
334334
const R24 = board.add(R_0603_1608Metric, {
335-
translate: pt(0.058, 1.009), rotate: 0,
335+
translate: pt(0.773, 1.009), rotate: 0,
336336
id: 'R24'
337337
})
338338
// curr_amp[2].r2
339339
const R25 = board.add(R_0603_1608Metric, {
340-
translate: pt(0.214, 1.009), rotate: 0,
340+
translate: pt(0.929, 1.009), rotate: 0,
341341
id: 'R25'
342342
})
343343
// curr_tp[2].tp
344344
const TP17 = board.add(TestPoint_TE_RCT_0805, {
345-
translate: pt(0.317, 1.801), rotate: 0,
345+
translate: pt(2.257, 1.528), rotate: 0,
346346
id: 'TP17'
347347
})
348348
// curr_amp[3].amp.ic
@@ -367,7 +367,7 @@ const R27 = board.add(R_0603_1608Metric, {
367367
})
368368
// curr_tp[3].tp
369369
const TP18 = board.add(TestPoint_TE_RCT_0805, {
370-
translate: pt(1.240, 1.528), rotate: 0,
370+
translate: pt(0.066, 1.801), rotate: 0,
371371
id: 'TP18'
372372
})
373373

examples/CanAdapter/CanAdapter.svgpcb.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,42 +172,42 @@ const C19 = board.add(C_0603_1608Metric, {
172172
})
173173
// rgb_usb.package
174174
const D1 = board.add(LED_LiteOn_LTST_C19HE1WT, {
175-
translate: pt(0.432, 1.512), rotate: 0,
175+
translate: pt(0.041, 1.512), rotate: 0,
176176
id: 'D1'
177177
})
178178
// rgb_usb.red_res
179179
const R6 = board.add(R_0603_1608Metric, {
180-
translate: pt(0.571, 1.486), rotate: 0,
180+
translate: pt(0.180, 1.486), rotate: 0,
181181
id: 'R6'
182182
})
183183
// rgb_usb.green_res
184184
const R7 = board.add(R_0603_1608Metric, {
185-
translate: pt(0.449, 1.635), rotate: 0,
185+
translate: pt(0.058, 1.635), rotate: 0,
186186
id: 'R7'
187187
})
188188
// rgb_usb.blue_res
189189
const R8 = board.add(R_0603_1608Metric, {
190-
translate: pt(0.605, 1.635), rotate: 0,
190+
translate: pt(0.214, 1.635), rotate: 0,
191191
id: 'R8'
192192
})
193193
// rgb_can.package
194194
const D2 = board.add(LED_LiteOn_LTST_C19HE1WT, {
195-
translate: pt(0.041, 1.512), rotate: 0,
195+
translate: pt(0.432, 1.512), rotate: 0,
196196
id: 'D2'
197197
})
198198
// rgb_can.red_res
199199
const R9 = board.add(R_0603_1608Metric, {
200-
translate: pt(0.180, 1.486), rotate: 0,
200+
translate: pt(0.571, 1.486), rotate: 0,
201201
id: 'R9'
202202
})
203203
// rgb_can.green_res
204204
const R10 = board.add(R_0603_1608Metric, {
205-
translate: pt(0.058, 1.635), rotate: 0,
205+
translate: pt(0.449, 1.635), rotate: 0,
206206
id: 'R10'
207207
})
208208
// rgb_can.blue_res
209209
const R11 = board.add(R_0603_1608Metric, {
210-
translate: pt(0.214, 1.635), rotate: 0,
210+
translate: pt(0.605, 1.635), rotate: 0,
211211
id: 'R11'
212212
})
213213
// can

0 commit comments

Comments
 (0)