circuit-json-to-lbrn 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,13 +9,19 @@ import type { CircuitJson } from "circuit-json"
9
9
  test("example01 - rp2040 zero with two interconnects", async () => {
10
10
  const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson as CircuitJson)
11
11
 
12
- const project = convertCircuitJsonToLbrn(circuitJson as CircuitJson)
12
+ const project = convertCircuitJsonToLbrn(circuitJson as CircuitJson, {
13
+ includeLayers: ["top"],
14
+ })
13
15
 
14
16
  // Bun.write("debug-output/lga-interconnect.lbrn2", project.getString(), {
15
17
  // createPath: true,
16
18
  // })
17
19
 
18
- const lbrnSvg = await generateLightBurnSvg(project)
20
+ const lbrnSvg = await generateLightBurnSvg(project, {
21
+ width: 800,
22
+ height: 600,
23
+ defaultStrokeWidth: 0.01,
24
+ })
19
25
 
20
26
  expect(lbrnSvg).toMatchSvgSnapshot(import.meta.filename)
21
27
 
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="600" height="400" viewBox="-2.3 -4.3 10 10" style="background-color: white;"><rect x="-2.3" y="-4.3" width="10" height="10" fill="white"/><g transform="matrix(1 0 0 -1 0 1.4000000000000004)"><g transform="matrix(1,0,0,1,0,0)"><path d="M -2.3 -4.3 L 7.7 -4.3 L 7.7 5.7 L -2.3 5.7 L -2.3 -4.3 L -2.3 -4.3 Z" fill="none" stroke="#FF0000" stroke-width="0.0025"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 1.292613144748213 0.7749999999999999 L 1.2884711682419385 0.8170541932096769 L 1.2543277195067724 0.9296100594190538 L 1.1988817673815273 1.0333421398117613 L 1.1242640687119287 1.1242640687119283 L 1.0333421398117615 1.198881767381527 L 0.9296100594190541 1.254327719506772 L 0.8170541932096772 1.288471168241938 L 0.7000000000000002 1.2999999999999998 L 0.5829458067903233 1.288471168241938 L 0.47038994058094635 1.254327719506772 L 0.36665786018823904 1.198881767381527 L 0.2757359312880717 1.1242640687119285 L 0.201118232618473 1.0333421398117613 L 0.1456722804932281 0.929610059419054 L 0.11152883175806194 0.8170541932096771 L 0.1000000000000002 0.7000000000000001 L 0.11152883175806194 0.5829458067903229 L 0.1456722804932281 0.4703899405809462 L 0.20111823261847295 0.3666578601882388 L 0.27573593128807156 0.2757359312880715 L 0.36665786018823887 0.20111823261847284 L 0.47038994058094596 0.1456722804932281 L 0.582945806790323 0.11152883175806183 L 0.7000000000000001 0.09999999999999998 L 0.8170541932096771 0.11152883175806172 L 0.9296100594190542 0.145672280493228 L 1.0333421398117613 0.20111823261847273 L 1.1242640687119285 0.27573593128807133 L 1.1988817673815273 0.36665786018823865 L 1.254327719506772 0.47038994058094574 L 1.2884711682419383 0.5829458067903227 L 1.292613144748213 0.625 L 2.62 0.625 L 2.62 0.62 L 4.107879312268573 0.62 L 4.111528831758062 0.5829458067903229 L 4.145672280493228 0.4703899405809462 L 4.201118232618473 0.3666578601882388 L 4.275735931288072 0.2757359312880715 L 4.366657860188239 0.20111823261847284 L 4.470389940580946 0.1456722804932281 L 4.582945806790323 0.11152883175806183 L 4.7 0.09999999999999998 L 4.817054193209677 0.11152883175806172 L 4.929610059419054 0.145672280493228 L 5.0333421398117615 0.20111823261847273 L 5.124264068711929 0.27573593128807133 L 5.198881767381527 0.36665786018823865 L 5.254327719506772 0.47038994058094574 L 5.288471168241938 0.5829458067903227 L 5.3 0.7 L 5.288471168241938 0.8170541932096769 L 5.254327719506772 0.9296100594190538 L 5.198881767381527 1.0333421398117613 L 5.124264068711929 1.1242640687119283 L 5.0333421398117615 1.198881767381527 L 4.929610059419054 1.254327719506772 L 4.817054193209677 1.288471168241938 L 4.7 1.2999999999999998 L 4.582945806790323 1.288471168241938 L 4.470389940580946 1.254327719506772 L 4.366657860188239 1.198881767381527 L 4.275735931288072 1.1242640687119285 L 4.201118232618473 1.0333421398117613 L 4.145672280493228 0.929610059419054 L 4.111528831758062 0.8170541932096771 L 4.107879312268573 0.7799999999999999 L 2.7800000000000002 0.7799999999999999 L 2.7800000000000002 2.62 L 4.107879312268572 2.62 L 4.111528831758062 2.582945806790323 L 4.145672280493228 2.4703899405809464 L 4.201118232618473 2.366657860188239 L 4.275735931288072 2.2757359312880716 L 4.366657860188239 2.201118232618473 L 4.470389940580946 2.1456722804932284 L 4.582945806790323 2.1115288317580623 L 4.7 2.1 L 4.817054193209677 2.111528831758062 L 4.929610059419054 2.145672280493228 L 5.0333421398117615 2.201118232618473 L 5.124264068711929 2.2757359312880716 L 5.198881767381527 2.366657860188239 L 5.254327719506772 2.470389940580946 L 5.288471168241938 2.582945806790323 L 5.3 2.7 L 5.288471168241938 2.8170541932096773 L 5.254327719506772 2.929610059419054 L 5.198881767381527 3.0333421398117615 L 5.124264068711929 3.1242640687119287 L 5.0333421398117615 3.1988817673815273 L 4.929610059419054 3.2543277195067724 L 4.817054193209677 3.2884711682419385 L 4.7 3.3000000000000003 L 4.582945806790323 3.2884711682419385 L 4.470389940580946 3.2543277195067724 L 4.366657860188239 3.1988817673815273 L 4.275735931288072 3.1242640687119287 L 4.201118232618473 3.0333421398117615 L 4.145672280493228 2.929610059419054 L 4.111528831758062 2.8170541932096773 L 4.107879312268573 2.7800000000000002 L 2.62 2.7800000000000002 L 2.62 0.7749999999999999 L 1.292613144748213 0.7749999999999999 L 1.292613144748213 0.7749999999999999" fill="none" stroke="#000000" stroke-width="0.0025"/></g></g></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="600" height="400" viewBox="-2.3 -4.15 10 10" style="background-color: white;"><rect x="-2.3" y="-4.15" width="10" height="10" fill="white"/><g transform="matrix(1 0 0 -1 0 1.6999999999999993)"><g transform="matrix(1,0,0,1,0,0)"><path d="M 5.2 0.85 L 5.197592363336098 0.8990085701647803 L 5.190392640201615 0.9475451610080641 L 5.178470167866105 0.9951423386272311 L 5.161939766255643 1.041341716182545 L 5.140960632174178 1.0856983684129988 L 5.115734806151273 1.1277851165098012 L 5.086505226681369 1.1671966420818227 L 5.053553390593274 1.2035533905932736 L 5.017196642081823 1.2365052266813685 L 4.977785116509802 1.2657348061512725 L 4.935698368412999 1.2909606321741776 L 4.891341716182545 1.3119397662556433 L 4.845142338627231 1.3284701678661044 L 4.797545161008064 1.3403926402016153 L 4.74900857016478 1.3475923633360984 L 4.7 1.35 L 4.65099142983522 1.3475923633360984 L 4.602454838991936 1.3403926402016153 L 4.554857661372769 1.3284701678661044 L 4.508658283817455 1.3119397662556433 L 4.464301631587001 1.2909606321741776 L 4.4222148834901995 1.2657348061512725 L 4.382803357918178 1.2365052266813685 L 4.346446609406726 1.2035533905932738 L 4.313494773318632 1.1671966420818227 L 4.284265193848728 1.1277851165098012 L 4.259039367825823 1.0856983684129988 L 4.238060233744357 1.041341716182545 L 4.221529832133895 0.9951423386272311 L 4.209607359798385 0.9475451610080643 L 4.202407636663902 0.8990085701647804 L 4.2 0.8500000000000001 L 4.202407636663902 0.8009914298352196 L 4.209607359798385 0.7524548389919358 L 4.221529832133895 0.704857661372769 L 4.238060233744357 0.6586582838174552 L 4.259039367825823 0.6143016315870011 L 4.284265193848728 0.572214883490199 L 4.313494773318632 0.5328033579181773 L 4.346446609406726 0.49644660940672625 L 4.382803357918177 0.46349477331863165 L 4.422214883490199 0.43426519384872736 L 4.464301631587001 0.4090393678258225 L 4.508658283817455 0.3880602337443567 L 4.554857661372769 0.37152983213389557 L 4.602454838991936 0.3596073597983848 L 4.65099142983522 0.3524076366639015 L 4.7 0.35 L 4.74900857016478 0.3524076366639015 L 4.797545161008064 0.35960735979838476 L 4.845142338627231 0.3715298321338955 L 4.891341716182545 0.38806023374435666 L 4.935698368412999 0.40903936782582245 L 4.977785116509801 0.43426519384872725 L 5.017196642081823 0.46349477331863154 L 5.053553390593274 0.49644660940672614 L 5.086505226681369 0.532803357918177 L 5.115734806151273 0.5722148834901989 L 5.140960632174178 0.614301631587001 L 5.161939766255643 0.6586582838174548 L 5.178470167866105 0.7048576613727687 L 5.190392640201615 0.7524548389919357 L 5.197592363336098 0.8009914298352198 L 5.2 0.85 L 5.2 0.85 Z" fill="none" stroke="#FF0000" stroke-width="0.01"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -2.3 -4.15 L 7.7 -4.15 L 7.7 5.85 L -2.3 5.85 L -2.3 -4.15 L -2.3 -4.15 Z" fill="none" stroke="#FF0000" stroke-width="0.01"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 1.2926131447482132 0.9249999999999999 L 1.2884711682419385 0.9670541932096769 L 1.2543277195067724 1.0796100594190539 L 1.1988817673815273 1.1833421398117614 L 1.1242640687119287 1.2742640687119284 L 1.0333421398117615 1.3488817673815272 L 0.9296100594190541 1.404327719506772 L 0.8170541932096772 1.4384711682419382 L 0.7000000000000002 1.45 L 0.5829458067903233 1.4384711682419382 L 0.47038994058094635 1.404327719506772 L 0.36665786018823904 1.3488817673815272 L 0.2757359312880717 1.2742640687119284 L 0.201118232618473 1.1833421398117614 L 0.1456722804932281 1.0796100594190539 L 0.11152883175806194 0.9670541932096771 L 0.1000000000000002 0.8500000000000001 L 0.11152883175806194 0.732945806790323 L 0.1456722804932281 0.6203899405809462 L 0.20111823261847295 0.5166578601882388 L 0.27573593128807156 0.4257359312880715 L 0.36665786018823887 0.35111823261847286 L 0.47038994058094596 0.29567228049322813 L 0.582945806790323 0.26152883175806185 L 0.7000000000000001 0.25 L 0.8170541932096771 0.26152883175806174 L 0.9296100594190542 0.295672280493228 L 1.0333421398117613 0.35111823261847275 L 1.1242640687119285 0.42573593128807136 L 1.1988817673815273 0.5166578601882387 L 1.254327719506772 0.6203899405809458 L 1.2884711682419383 0.7329458067903227 L 1.2926131447482128 0.775 L 2.62 0.775 L 2.62 0.77 L 3.9578793122685734 0.77 L 3.9644110396975774 0.7036822584879037 L 4.007090350616535 0.5629874257261827 L 4.0763977907730915 0.4333223252352985 L 4.16966991411009 0.3196699141100894 L 4.283322325235298 0.22639779077309108 L 4.4129874257261825 0.1570903506165351 L 4.553682258487903 0.11441103969757727 L 4.7 0.09999999999999998 L 4.846317741512096 0.11441103969757715 L 4.987012574273818 0.15709035061653498 L 5.116677674764702 0.22639779077309086 L 5.230330085889911 0.31966991411008927 L 5.323602209226909 0.43332232523529834 L 5.392909649383465 0.5629874257261822 L 5.435588960302423 0.7036822584879034 L 5.45 0.85 L 5.4355889603024234 0.9963177415120962 L 5.392909649383466 1.1370125742738173 L 5.323602209226909 1.2666776747647015 L 5.230330085889911 1.3803300858899106 L 5.116677674764702 1.4736022092269088 L 4.987012574273818 1.542909649383465 L 4.846317741512096 1.585588960302423 L 4.7 1.6 L 4.553682258487904 1.585588960302423 L 4.4129874257261825 1.542909649383465 L 4.283322325235298 1.473602209226909 L 4.16966991411009 1.3803300858899106 L 4.0763977907730915 1.2666776747647015 L 4.007090350616535 1.1370125742738173 L 3.9644110396975774 0.9963177415120964 L 3.9578793122685734 0.9299999999999999 L 2.7800000000000002 0.9299999999999999 L 2.7800000000000002 2.77 L 4.107879312268573 2.77 L 4.111528831758062 2.732945806790323 L 4.145672280493228 2.6203899405809463 L 4.201118232618473 2.516657860188239 L 4.275735931288072 2.4257359312880715 L 4.366657860188239 2.351118232618473 L 4.470389940580946 2.2956722804932284 L 4.582945806790323 2.2615288317580617 L 4.7 2.25 L 4.817054193209677 2.2615288317580617 L 4.929610059419054 2.2956722804932284 L 5.0333421398117615 2.351118232618473 L 5.124264068711929 2.4257359312880715 L 5.198881767381527 2.516657860188239 L 5.254327719506772 2.620389940580946 L 5.288471168241938 2.732945806790323 L 5.3 2.85 L 5.288471168241938 2.9670541932096772 L 5.254327719506772 3.079610059419054 L 5.198881767381527 3.1833421398117614 L 5.124264068711929 3.2742640687119287 L 5.0333421398117615 3.348881767381527 L 4.929610059419054 3.4043277195067723 L 4.817054193209677 3.4384711682419384 L 4.7 3.45 L 4.582945806790323 3.4384711682419384 L 4.470389940580946 3.4043277195067723 L 4.366657860188239 3.348881767381527 L 4.275735931288072 3.2742640687119287 L 4.201118232618473 3.1833421398117614 L 4.145672280493228 3.079610059419054 L 4.111528831758062 2.9670541932096772 L 4.107879312268573 2.93 L 2.62 2.93 L 2.62 0.9249999999999999 L 1.2926131447482132 0.9249999999999999 L 1.2926131447482132 0.9249999999999999" fill="none" stroke="#000000" stroke-width="0.01"/></g></g></svg>
@@ -19,7 +19,7 @@
19
19
  "port_hints": ["pin1", "1"],
20
20
  "source_component_id": "source_component_0",
21
21
  "subcircuit_id": "subcircuit_source_group_0",
22
- "subcircuit_connectivity_map_key": "unnamedsubcircuit140_connectivity_net0"
22
+ "subcircuit_connectivity_map_key": "unnamedsubcircuit223_connectivity_net0"
23
23
  },
24
24
  {
25
25
  "type": "source_component",
@@ -41,7 +41,7 @@
41
41
  "port_hints": ["pin1", "1"],
42
42
  "source_component_id": "source_component_1",
43
43
  "subcircuit_id": "subcircuit_source_group_0",
44
- "subcircuit_connectivity_map_key": "unnamedsubcircuit140_connectivity_net0"
44
+ "subcircuit_connectivity_map_key": "unnamedsubcircuit223_connectivity_net0"
45
45
  },
46
46
  {
47
47
  "type": "source_component",
@@ -49,9 +49,9 @@
49
49
  "ftype": "simple_test_point",
50
50
  "name": "TP2",
51
51
  "supplier_part_numbers": {},
52
- "footprint_variant": "pad",
53
- "pad_shape": "circle",
54
- "pad_diameter": 1.2,
52
+ "footprint_variant": "through_hole",
53
+ "pad_shape": "rect",
54
+ "hole_diameter": 1,
55
55
  "are_pins_interchangeable": true,
56
56
  "source_group_id": "source_group_0"
57
57
  },
@@ -63,7 +63,7 @@
63
63
  "port_hints": ["pin1", "1"],
64
64
  "source_component_id": "source_component_2",
65
65
  "subcircuit_id": "subcircuit_source_group_0",
66
- "subcircuit_connectivity_map_key": "unnamedsubcircuit140_connectivity_net0"
66
+ "subcircuit_connectivity_map_key": "unnamedsubcircuit223_connectivity_net0"
67
67
  },
68
68
  {
69
69
  "type": "source_component",
@@ -89,7 +89,7 @@
89
89
  "connected_source_net_ids": [],
90
90
  "subcircuit_id": "subcircuit_source_group_0",
91
91
  "display_name": "TP1.pin1 to TP2.pin1",
92
- "subcircuit_connectivity_map_key": "unnamedsubcircuit140_connectivity_net0"
92
+ "subcircuit_connectivity_map_key": "unnamedsubcircuit223_connectivity_net0"
93
93
  },
94
94
  {
95
95
  "type": "source_trace",
@@ -98,7 +98,7 @@
98
98
  "connected_source_net_ids": [],
99
99
  "subcircuit_id": "subcircuit_source_group_0",
100
100
  "display_name": "TP2.pin1 to TP3.pin1",
101
- "subcircuit_connectivity_map_key": "unnamedsubcircuit140_connectivity_net0"
101
+ "subcircuit_connectivity_map_key": "unnamedsubcircuit223_connectivity_net0"
102
102
  },
103
103
  {
104
104
  "type": "schematic_component",
@@ -247,7 +247,7 @@
247
247
  "y": 0
248
248
  }
249
249
  ],
250
- "subcircuit_connectivity_map_key": "unnamedsubcircuit140_connectivity_net0"
250
+ "subcircuit_connectivity_map_key": "unnamedsubcircuit223_connectivity_net0"
251
251
  },
252
252
  {
253
253
  "type": "schematic_trace",
@@ -291,7 +291,7 @@
291
291
  "y": 0
292
292
  }
293
293
  ],
294
- "subcircuit_connectivity_map_key": "unnamedsubcircuit140_connectivity_net0"
294
+ "subcircuit_connectivity_map_key": "unnamedsubcircuit223_connectivity_net0"
295
295
  },
296
296
  {
297
297
  "type": "pcb_component",
@@ -319,8 +319,8 @@
319
319
  "x": 2,
320
320
  "y": 0
321
321
  },
322
- "width": 1.2000000000000002,
323
- "height": 1.2,
322
+ "width": 1.5,
323
+ "height": 1.5,
324
324
  "layer": "top",
325
325
  "rotation": 0,
326
326
  "source_component_id": "source_component_1",
@@ -408,17 +408,18 @@
408
408
  "subcircuit_id": "subcircuit_source_group_0"
409
409
  },
410
410
  {
411
- "type": "pcb_smtpad",
412
- "pcb_smtpad_id": "pcb_smtpad_1",
411
+ "type": "pcb_plated_hole",
412
+ "pcb_plated_hole_id": "pcb_plated_hole_0",
413
413
  "pcb_component_id": "pcb_component_1",
414
414
  "pcb_port_id": "pcb_port_1",
415
- "layer": "top",
415
+ "outer_diameter": 1.5,
416
+ "hole_diameter": 1,
416
417
  "shape": "circle",
417
- "radius": 0.6,
418
- "port_hints": ["1"],
419
- "is_covered_with_solder_mask": false,
418
+ "port_hints": ["unnamed_platedhole1", "1"],
420
419
  "x": 2,
421
420
  "y": 0,
421
+ "layers": ["top", "bottom"],
422
+ "is_covered_with_solder_mask": false,
422
423
  "subcircuit_id": "subcircuit_source_group_0"
423
424
  },
424
425
  {
@@ -426,11 +427,19 @@
426
427
  "pcb_solder_paste_id": "pcb_solder_paste_1",
427
428
  "layer": "top",
428
429
  "shape": "circle",
429
- "radius": 0.42,
430
+ "radius": 0.75,
431
+ "x": 2,
432
+ "y": 0,
433
+ "subcircuit_id": "subcircuit_source_group_0"
434
+ },
435
+ {
436
+ "type": "pcb_solder_paste",
437
+ "pcb_solder_paste_id": "pcb_solder_paste_2",
438
+ "layer": "bottom",
439
+ "shape": "circle",
440
+ "radius": 0.75,
430
441
  "x": 2,
431
442
  "y": 0,
432
- "pcb_component_id": "pcb_component_1",
433
- "pcb_smtpad_id": "pcb_smtpad_1",
434
443
  "subcircuit_id": "subcircuit_source_group_0"
435
444
  },
436
445
  {
@@ -439,7 +448,7 @@
439
448
  "anchor_alignment": "center",
440
449
  "anchor_position": {
441
450
  "x": 2,
442
- "y": 1.1
451
+ "y": 1.25
443
452
  },
444
453
  "font": "tscircuit2024",
445
454
  "font_size": 0.4,
@@ -451,7 +460,7 @@
451
460
  },
452
461
  {
453
462
  "type": "pcb_smtpad",
454
- "pcb_smtpad_id": "pcb_smtpad_2",
463
+ "pcb_smtpad_id": "pcb_smtpad_1",
455
464
  "pcb_component_id": "pcb_component_2",
456
465
  "pcb_port_id": "pcb_port_2",
457
466
  "layer": "top",
@@ -465,14 +474,14 @@
465
474
  },
466
475
  {
467
476
  "type": "pcb_solder_paste",
468
- "pcb_solder_paste_id": "pcb_solder_paste_2",
477
+ "pcb_solder_paste_id": "pcb_solder_paste_3",
469
478
  "layer": "top",
470
479
  "shape": "circle",
471
480
  "radius": 0.42,
472
481
  "x": 2,
473
482
  "y": 2,
474
483
  "pcb_component_id": "pcb_component_2",
475
- "pcb_smtpad_id": "pcb_smtpad_2",
484
+ "pcb_smtpad_id": "pcb_smtpad_1",
476
485
  "subcircuit_id": "subcircuit_source_group_0"
477
486
  },
478
487
  {
@@ -505,7 +514,7 @@
505
514
  "type": "pcb_port",
506
515
  "pcb_port_id": "pcb_port_1",
507
516
  "pcb_component_id": "pcb_component_1",
508
- "layers": ["top"],
517
+ "layers": ["top", "inner1", "inner2", "bottom"],
509
518
  "subcircuit_id": "subcircuit_source_group_0",
510
519
  "x": 2,
511
520
  "y": 0,
@@ -592,7 +601,7 @@
592
601
  },
593
602
  "pcb_component_id": "pcb_component_1",
594
603
  "source_component_id": "source_component_1",
595
- "footprinter_string": "smtpad_circle_d1.2"
604
+ "footprinter_string": "platedhole_d1"
596
605
  },
597
606
  {
598
607
  "type": "cad_component",
@@ -9,17 +9,20 @@ import type { CircuitJson } from "circuit-json"
9
9
  test("example02 - two connected test points", async () => {
10
10
  const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson as CircuitJson)
11
11
 
12
- const project = convertCircuitJsonToLbrn(circuitJson as CircuitJson)
12
+ const project = convertCircuitJsonToLbrn(circuitJson as CircuitJson, {
13
+ includeLayers: ["top"],
14
+ })
13
15
 
14
16
  Bun.write("debug-output/example02.lbrn2", project.getString(), {
15
17
  createPath: true,
16
18
  })
19
+ console.log("debug-output/example02.lbrn2")
17
20
 
18
21
  const lbrnSvg = await generateLightBurnSvg(project, {
19
22
  margin: 0,
20
23
  width: 600,
21
24
  height: 400,
22
- defaultStrokeWidth: 0.0025,
25
+ defaultStrokeWidth: 0.01,
23
26
  })
24
27
 
25
28
  expect(lbrnSvg).toMatchSvgSnapshot(import.meta.filename)