circuit-json-to-lbrn 0.0.6 → 0.0.8

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.
Files changed (37) hide show
  1. package/dist/index.js +636 -16
  2. package/lib/ConvertContext.ts +1 -0
  3. package/lib/element-handlers/addPcbBoard/index.ts +50 -0
  4. package/lib/element-handlers/addPlatedHole/addCirclePlatedHole.ts +30 -72
  5. package/lib/element-handlers/addPlatedHole/addCircularHoleWithRectPad.ts +44 -3
  6. package/lib/element-handlers/addPlatedHole/addHoleWithPolygonPad.ts +55 -4
  7. package/lib/element-handlers/addPlatedHole/addOvalPlatedHole.ts +49 -4
  8. package/lib/element-handlers/addPlatedHole/addPillHoleWithRectPad.ts +52 -4
  9. package/lib/element-handlers/addPlatedHole/addPillPlatedHole.ts +52 -0
  10. package/lib/element-handlers/addPlatedHole/addRotatedPillHoleWithRectPad.ts +57 -4
  11. package/lib/element-handlers/addPlatedHole/index.ts +4 -1
  12. package/lib/helpers/circleShape.ts +42 -0
  13. package/lib/helpers/ovalShape.ts +51 -0
  14. package/lib/helpers/pathPointUtils.ts +45 -0
  15. package/lib/helpers/pillShape.ts +99 -0
  16. package/lib/helpers/polygonShape.ts +38 -0
  17. package/lib/helpers/roundedRectShape.ts +121 -0
  18. package/lib/index.ts +17 -3
  19. package/package.json +1 -1
  20. package/tests/examples/__snapshots__/board-outline.snap.svg +8 -0
  21. package/tests/examples/__snapshots__/lga-interconnect.snap.svg +2 -2
  22. package/tests/examples/__snapshots__/single-trace.snap.svg +2 -2
  23. package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-circle.snap.svg +8 -0
  24. package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-circular-hole-with-rect-pad.snap.svg +8 -0
  25. package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-oval.snap.svg +8 -0
  26. package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-pill-with-rect-pad.snap.svg +8 -0
  27. package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-pill.snap.svg +8 -0
  28. package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-polygon.snap.svg +8 -0
  29. package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-rotated-pill-with-rect-pad.snap.svg +8 -0
  30. package/tests/examples/addPlatedHole/pcb-plated-hole-circle.test.ts +62 -0
  31. package/tests/examples/addPlatedHole/pcb-plated-hole-circular-hole-with-rect-pad.test.ts +54 -0
  32. package/tests/examples/addPlatedHole/pcb-plated-hole-oval.test.ts +101 -0
  33. package/tests/examples/addPlatedHole/pcb-plated-hole-pill-with-rect-pad.test.ts +54 -0
  34. package/tests/examples/addPlatedHole/pcb-plated-hole-pill.test.ts +101 -0
  35. package/tests/examples/addPlatedHole/pcb-plated-hole-polygon.test.ts +59 -0
  36. package/tests/examples/addPlatedHole/pcb-plated-hole-rotated-pill-with-rect-pad.test.ts +56 -0
  37. package/tests/examples/board-outline.test.ts +102 -0
@@ -0,0 +1,8 @@
1
+ <svg width="800" height="1400" viewBox="0 0 800 1400" xmlns="http://www.w3.org/2000/svg">
2
+ <g transform="translate(0, 0)">
3
+ <style></style><rect class="boundary" x="0" y="0" fill="#000" width="800" height="600" data-type="pcb_background" data-pcb-layer="global"/><rect class="pcb-boundary" fill="none" stroke="#fff" stroke-width="0.3" x="127.27272727272725" y="27.272727272727252" width="545.4545454545455" height="545.4545454545455" data-type="pcb_boundary" data-pcb-layer="global"/><path class="pcb-board" d="M 127.27272727272725 572.7272727272727 L 672.7272727272727 572.7272727272727 L 672.7272727272727 27.272727272727252 L 127.27272727272725 27.272727272727252 Z" fill="none" stroke="rgba(255, 255, 255, 0.5)" stroke-width="2.7272727272727275" data-type="pcb_board" data-pcb-layer="board"/><g data-type="pcb_plated_hole" data-pcb-layer="through"><path class="pcb-hole-outer" fill="rgb(200, 52, 52)" d="M-81.81818181818181,-27.272727272727273 h163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,54.54545454545455 h-163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,-54.54545454545455 z" transform="translate(536.3636363636364 436.3636363636364)" data-type="pcb_plated_hole" data-pcb-layer="top"/><path class="pcb-hole-inner" fill="#FF26E2" d="M-68.18181818181817,-13.636363636363637 h136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,27.272727272727273 h-136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,-27.272727272727273 z" transform="translate(536.3636363636364 436.3636363636364)" data-type="pcb_plated_hole_drill" data-pcb-layer="drill"/></g><g data-type="pcb_plated_hole" data-pcb-layer="through"><path class="pcb-hole-outer" fill="rgb(200, 52, 52)" d="M-81.81818181818181,-27.272727272727273 h163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,54.54545454545455 h-163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,-54.54545454545455 z" transform="translate(536.3636363636364 163.63636363636363)" data-type="pcb_plated_hole" data-pcb-layer="top"/><path class="pcb-hole-inner" fill="#FF26E2" d="M-68.18181818181817,-13.636363636363637 h136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,27.272727272727273 h-136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,-27.272727272727273 z" transform="translate(536.3636363636364 163.63636363636363)" data-type="pcb_plated_hole_drill" data-pcb-layer="drill"/></g><g data-type="pcb_plated_hole" data-pcb-layer="through"><path class="pcb-hole-outer" fill="rgb(200, 52, 52)" d="M-81.81818181818181,-27.272727272727273 h163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,54.54545454545455 h-163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,-54.54545454545455 z" transform="translate(263.6363636363636 436.3636363636364) rotate(-90)" data-type="pcb_plated_hole" data-pcb-layer="top"/><path class="pcb-hole-inner" fill="#FF26E2" d="M-68.18181818181817,-13.636363636363637 h136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,27.272727272727273 h-136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,-27.272727272727273 z" transform="translate(263.6363636363636 436.3636363636364) rotate(-90)" data-type="pcb_plated_hole_drill" data-pcb-layer="drill"/></g><g data-type="pcb_plated_hole" data-pcb-layer="through"><path class="pcb-hole-outer" fill="rgb(200, 52, 52)" d="M-81.81818181818181,-27.272727272727273 h163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,54.54545454545455 h-163.63636363636363 a27.272727272727273,27.272727272727273 0 0 1 0,-54.54545454545455 z" transform="translate(263.6363636363636 163.63636363636363) rotate(-45)" data-type="pcb_plated_hole" data-pcb-layer="top"/><path class="pcb-hole-inner" fill="#FF26E2" d="M-68.18181818181817,-13.636363636363637 h136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,27.272727272727273 h-136.36363636363635 a13.636363636363637,13.636363636363637 0 0 1 0,-27.272727272727273 z" transform="translate(263.6363636363636 163.63636363636363) rotate(-45)" data-type="pcb_plated_hole_drill" data-pcb-layer="drill"/></g>
4
+ </g>
5
+ <g transform="translate(0, 600) scale(20, 20) translate(19.9, 19.9)">
6
+ <rect x="-19.9" y="-19.9" width="40" height="40" fill="white"/><g transform="matrix(1 0 0 -1 0 0.20000000000000284)"><g transform="matrix(1,0,0,1,0,0)"><path d="M 8.1 -5.9 L 8.19801714032956 -5.8951847266721975 L 8.295090322016128 -5.880785280403231 L 8.390284677254462 -5.856940335732209 L 8.48268343236509 -5.823879532511287 L 8.571396736825998 -5.781921264348355 L 8.655570233019603 -5.731469612302545 L 8.734393284163644 -5.673010453362737 L 8.807106781186548 -5.607106781186548 L 8.873010453362737 -5.534393284163646 L 8.931469612302545 -5.4555702330196025 L 8.981921264348355 -5.371396736825998 L 9.023879532511286 -5.28268343236509 L 9.05694033573221 -5.190284677254462 L 9.08078528040323 -5.095090322016128 L 9.095184726672196 -4.998017140329561 L 9.1 -4.9 L 9.095184726672196 -4.8019828596704395 L 9.08078528040323 -4.704909677983872 L 9.05694033573221 -4.609715322745538 L 9.023879532511286 -4.517316567634911 L 8.981921264348355 -4.428603263174002 L 8.931469612302545 -4.344429766980398 L 8.873010453362737 -4.265606715836355 L 8.807106781186548 -4.1928932188134524 L 8.734393284163644 -4.1269895466372635 L 8.655570233019601 -4.0685303876974555 L 8.571396736825998 -4.018078735651645 L 8.48268343236509 -3.9761204674887134 L 8.390284677254462 -3.9430596642677918 L 8.295090322016128 -3.91921471959677 L 8.19801714032956 -3.9048152733278036 L 8.1 -3.9000000000000004 L 2.0999999999999996 -3.9000000000000004 L 2.0999999999999996 -3.9000000000000004 L 2.001982859670439 -3.904815273327803 L 1.9049096779838715 -3.91921471959677 L 1.8097153227455376 -3.9430596642677913 L 1.71731656763491 -3.9761204674887134 L 1.628603263174002 -4.018078735651645 L 1.5444297669803977 -4.0685303876974555 L 1.4656067158363544 -4.1269895466372635 L 1.3928932188134522 -4.1928932188134524 L 1.3269895466372628 -4.265606715836355 L 1.2685303876974543 -4.344429766980398 L 1.2180787356516447 -4.428603263174002 L 1.176120467488713 -4.517316567634911 L 1.1430596642677908 -4.609715322745538 L 1.1192147195967692 -4.7049096779838715 L 1.104815273327803 -4.8019828596704395 L 1.0999999999999996 -4.9 L 1.1048152733278027 -4.998017140329561 L 1.1192147195967692 -5.095090322016128 L 1.1430596642677906 -5.190284677254462 L 1.1761204674887127 -5.28268343236509 L 1.2180787356516447 -5.371396736825998 L 1.2685303876974543 -5.4555702330196025 L 1.3269895466372625 -5.534393284163645 L 1.392893218813452 -5.607106781186548 L 1.4656067158363544 -5.673010453362737 L 1.5444297669803975 -5.731469612302545 L 1.6286032631740017 -5.781921264348355 L 1.7173165676349094 -5.823879532511286 L 1.8097153227455371 -5.856940335732209 L 1.904909677983871 -5.880785280403231 L 2.001982859670439 -5.8951847266721975 L 2.0999999999999996 -5.9 L 8.1 -5.9 L 8.1 -5.9 L 8.1 -5.9 Z" fill="none" stroke="#000000" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 7.6 -5.4 L 7.64900857016478 -5.3975923633360985 L 7.697545161008064 -5.390392640201616 L 7.745142338627231 -5.378470167866105 L 7.7913417161825445 -5.361939766255643 L 7.835698368412999 -5.340960632174178 L 7.877785116509801 -5.315734806151273 L 7.917196642081822 -5.286505226681369 L 7.953553390593274 -5.253553390593274 L 7.986505226681368 -5.217196642081823 L 8.015734806151272 -5.177785116509801 L 8.040960632174176 -5.135698368412999 L 8.061939766255643 -5.091341716182545 L 8.078470167866104 -5.045142338627231 L 8.090392640201614 -4.997545161008064 L 8.097592363336098 -4.94900857016478 L 8.1 -4.9 L 8.097592363336098 -4.85099142983522 L 8.090392640201614 -4.802454838991936 L 8.078470167866104 -4.754857661372769 L 8.061939766255643 -4.7086582838174555 L 8.040960632174176 -4.664301631587001 L 8.015734806151272 -4.6222148834902 L 7.986505226681368 -4.582803357918178 L 7.953553390593274 -4.546446609406726 L 7.917196642081822 -4.513494773318632 L 7.8777851165098 -4.484265193848728 L 7.835698368412999 -4.459039367825823 L 7.7913417161825445 -4.438060233744357 L 7.745142338627231 -4.421529832133896 L 7.697545161008064 -4.409607359798385 L 7.64900857016478 -4.402407636663902 L 7.6 -4.4 L 2.5999999999999996 -4.4 L 2.5999999999999996 -4.4 L 2.550991429835219 -4.402407636663902 L 2.5024548389919357 -4.409607359798385 L 2.4548576613727686 -4.421529832133896 L 2.408658283817455 -4.438060233744357 L 2.3643016315870007 -4.459039367825823 L 2.3222148834901986 -4.484265193848728 L 2.282803357918177 -4.513494773318632 L 2.2464466094067257 -4.546446609406726 L 2.213494773318631 -4.582803357918178 L 2.184265193848727 -4.6222148834902 L 2.159039367825822 -4.664301631587001 L 2.138060233744356 -4.7086582838174555 L 2.1215298321338953 -4.754857661372769 L 2.1096073597983844 -4.802454838991936 L 2.102407636663901 -4.85099142983522 L 2.0999999999999996 -4.9 L 2.102407636663901 -4.94900857016478 L 2.1096073597983844 -4.997545161008064 L 2.1215298321338953 -5.045142338627231 L 2.138060233744356 -5.091341716182545 L 2.159039367825822 -5.135698368412999 L 2.1842651938487267 -5.177785116509801 L 2.213494773318631 -5.217196642081823 L 2.2464466094067257 -5.253553390593274 L 2.2828033579181772 -5.286505226681369 L 2.3222148834901986 -5.315734806151273 L 2.3643016315870007 -5.340960632174178 L 2.4086582838174544 -5.361939766255643 L 2.4548576613727686 -5.378470167866105 L 2.502454838991935 -5.390392640201616 L 2.550991429835219 -5.3975923633360985 L 2.5999999999999996 -5.4 L 7.6 -5.4 L 7.6 -5.4 L 7.6 -5.4 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 8.1 4.1 L 8.19801714032956 4.1048152733278025 L 8.295090322016128 4.119214719596769 L 8.390284677254462 4.143059664267791 L 8.48268343236509 4.176120467488713 L 8.571396736825998 4.218078735651645 L 8.655570233019603 4.268530387697455 L 8.734393284163644 4.326989546637263 L 8.807106781186548 4.392893218813452 L 8.873010453362737 4.465606715836354 L 8.931469612302545 4.5444297669803975 L 8.981921264348355 4.628603263174002 L 9.023879532511286 4.71731656763491 L 9.05694033573221 4.809715322745538 L 9.08078528040323 4.904909677983872 L 9.095184726672196 5.001982859670439 L 9.1 5.1 L 9.095184726672196 5.1980171403295605 L 9.08078528040323 5.295090322016128 L 9.05694033573221 5.390284677254462 L 9.023879532511286 5.482683432365089 L 8.981921264348355 5.571396736825998 L 8.931469612302545 5.655570233019602 L 8.873010453362737 5.734393284163645 L 8.807106781186548 5.8071067811865476 L 8.734393284163644 5.8730104533627365 L 8.655570233019601 5.9314696123025445 L 8.571396736825998 5.981921264348355 L 8.48268343236509 6.023879532511287 L 8.390284677254462 6.056940335732208 L 8.295090322016128 6.08078528040323 L 8.19801714032956 6.095184726672197 L 8.1 6.1 L 2.0999999999999996 6.1 L 2.0999999999999996 6.1 L 2.001982859670439 6.095184726672197 L 1.9049096779838715 6.08078528040323 L 1.8097153227455376 6.056940335732208 L 1.71731656763491 6.023879532511287 L 1.628603263174002 5.981921264348355 L 1.5444297669803977 5.9314696123025445 L 1.4656067158363544 5.8730104533627365 L 1.3928932188134522 5.8071067811865476 L 1.3269895466372628 5.734393284163645 L 1.2685303876974543 5.655570233019602 L 1.2180787356516447 5.571396736825998 L 1.176120467488713 5.482683432365089 L 1.1430596642677908 5.390284677254462 L 1.1192147195967692 5.2950903220161285 L 1.104815273327803 5.1980171403295605 L 1.0999999999999996 5.1 L 1.1048152733278027 5.001982859670439 L 1.1192147195967692 4.904909677983872 L 1.1430596642677906 4.809715322745538 L 1.1761204674887127 4.71731656763491 L 1.2180787356516447 4.628603263174002 L 1.2685303876974543 4.5444297669803975 L 1.3269895466372625 4.465606715836355 L 1.392893218813452 4.392893218813452 L 1.4656067158363544 4.326989546637263 L 1.5444297669803975 4.268530387697455 L 1.6286032631740017 4.218078735651645 L 1.7173165676349094 4.176120467488714 L 1.8097153227455371 4.143059664267791 L 1.904909677983871 4.119214719596769 L 2.001982859670439 4.1048152733278025 L 2.0999999999999996 4.1 L 8.1 4.1 L 8.1 4.1 L 8.1 4.1 Z" fill="none" stroke="#000000" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 7.6 4.6 L 7.64900857016478 4.6024076366639015 L 7.697545161008064 4.609607359798384 L 7.745142338627231 4.621529832133895 L 7.7913417161825445 4.638060233744357 L 7.835698368412999 4.659039367825822 L 7.877785116509801 4.684265193848727 L 7.917196642081822 4.713494773318631 L 7.953553390593274 4.746446609406726 L 7.986505226681368 4.782803357918177 L 8.015734806151272 4.822214883490199 L 8.040960632174176 4.864301631587001 L 8.061939766255643 4.908658283817455 L 8.078470167866104 4.954857661372769 L 8.090392640201614 5.002454838991936 L 8.097592363336098 5.05099142983522 L 8.1 5.1 L 8.097592363336098 5.14900857016478 L 8.090392640201614 5.197545161008064 L 8.078470167866104 5.245142338627231 L 8.061939766255643 5.2913417161825445 L 8.040960632174176 5.335698368412999 L 8.015734806151272 5.3777851165098 L 7.986505226681368 5.417196642081822 L 7.953553390593274 5.453553390593274 L 7.917196642081822 5.486505226681368 L 7.8777851165098 5.515734806151272 L 7.835698368412999 5.540960632174177 L 7.7913417161825445 5.561939766255643 L 7.745142338627231 5.578470167866104 L 7.697545161008064 5.590392640201615 L 7.64900857016478 5.597592363336098 L 7.6 5.6 L 2.5999999999999996 5.6 L 2.5999999999999996 5.6 L 2.550991429835219 5.597592363336098 L 2.5024548389919357 5.590392640201615 L 2.4548576613727686 5.578470167866104 L 2.408658283817455 5.561939766255643 L 2.3643016315870007 5.540960632174177 L 2.3222148834901986 5.515734806151272 L 2.282803357918177 5.486505226681368 L 2.2464466094067257 5.453553390593274 L 2.213494773318631 5.417196642081822 L 2.184265193848727 5.3777851165098 L 2.159039367825822 5.335698368412999 L 2.138060233744356 5.2913417161825445 L 2.1215298321338953 5.245142338627231 L 2.1096073597983844 5.197545161008064 L 2.102407636663901 5.14900857016478 L 2.0999999999999996 5.1 L 2.102407636663901 5.05099142983522 L 2.1096073597983844 5.002454838991936 L 2.1215298321338953 4.954857661372769 L 2.138060233744356 4.908658283817455 L 2.159039367825822 4.864301631587001 L 2.1842651938487267 4.822214883490199 L 2.213494773318631 4.782803357918177 L 2.2464466094067257 4.746446609406726 L 2.2828033579181772 4.713494773318631 L 2.3222148834901986 4.684265193848727 L 2.3643016315870007 4.659039367825822 L 2.4086582838174544 4.638060233744357 L 2.4548576613727686 4.621529832133895 L 2.502454838991935 4.609607359798384 L 2.550991429835219 4.6024076366639015 L 2.5999999999999996 4.6 L 7.6 4.6 L 7.6 4.6 L 7.6 4.6 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -3.9000000000000004 -1.9000000000000004 L -3.904815273327803 -1.8019828596704395 L -3.91921471959677 -1.704909677983872 L -3.9430596642677918 -1.6097153227455383 L -3.9761204674887134 -1.5173165676349107 L -4.018078735651645 -1.4286032631740024 L -4.0685303876974555 -1.3444297669803982 L -4.1269895466372635 -1.2656067158363546 L -4.1928932188134524 -1.192893218813453 L -4.265606715836355 -1.1269895466372635 L -4.344429766980398 -1.068530387697455 L -4.428603263174002 -1.0180787356516454 L -4.517316567634911 -0.9761204674887134 L -4.609715322745538 -0.9430596642677913 L -4.704909677983872 -0.9192147195967699 L -4.8019828596704395 -0.9048152733278032 L -4.9 -0.9000000000000004 L -4.998017140329561 -0.9048152733278032 L -5.095090322016128 -0.9192147195967699 L -5.190284677254462 -0.9430596642677913 L -5.28268343236509 -0.9761204674887134 L -5.371396736825998 -1.0180787356516454 L -5.4555702330196025 -1.068530387697455 L -5.534393284163646 -1.1269895466372635 L -5.607106781186548 -1.192893218813453 L -5.673010453362737 -1.2656067158363546 L -5.731469612302545 -1.3444297669803982 L -5.781921264348355 -1.4286032631740024 L -5.823879532511287 -1.5173165676349107 L -5.856940335732209 -1.6097153227455383 L -5.880785280403231 -1.704909677983872 L -5.895184726672197 -1.8019828596704395 L -5.9 -1.9000000000000004 L -5.9 -7.9 L -5.9 -7.9 L -5.8951847266721975 -7.998017140329561 L -5.880785280403231 -8.095090322016128 L -5.85694033573221 -8.190284677254462 L -5.823879532511287 -8.28268343236509 L -5.781921264348355 -8.371396736825998 L -5.731469612302545 -8.455570233019602 L -5.673010453362737 -8.534393284163645 L -5.607106781186548 -8.607106781186548 L -5.534393284163646 -8.673010453362737 L -5.4555702330196025 -8.731469612302545 L -5.371396736825998 -8.781921264348355 L -5.28268343236509 -8.823879532511286 L -5.190284677254462 -8.85694033573221 L -5.095090322016129 -8.88078528040323 L -4.998017140329561 -8.895184726672197 L -4.9 -8.9 L -4.8019828596704395 -8.895184726672197 L -4.704909677983872 -8.88078528040323 L -4.609715322745538 -8.85694033573221 L -4.517316567634911 -8.823879532511286 L -4.428603263174002 -8.781921264348355 L -4.344429766980398 -8.731469612302545 L -4.2656067158363555 -8.673010453362737 L -4.1928932188134524 -8.607106781186548 L -4.1269895466372635 -8.534393284163645 L -4.0685303876974555 -8.455570233019603 L -4.018078735651645 -8.371396736825998 L -3.9761204674887143 -8.28268343236509 L -3.9430596642677918 -8.190284677254462 L -3.91921471959677 -8.095090322016128 L -3.904815273327803 -7.998017140329561 L -3.9000000000000004 -7.9 L -3.9000000000000004 -1.9000000000000004 L -3.9000000000000004 -1.9000000000000004 L -3.9000000000000004 -1.9000000000000004 Z" fill="none" stroke="#000000" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -4.4 -2.4000000000000004 L -4.402407636663902 -2.35099142983522 L -4.409607359798385 -2.3024548389919364 L -4.421529832133896 -2.2548576613727693 L -4.438060233744357 -2.2086582838174555 L -4.459039367825823 -2.1643016315870014 L -4.484265193848728 -2.1222148834901993 L -4.513494773318632 -2.0828033579181775 L -4.546446609406726 -2.0464466094067264 L -4.582803357918178 -2.013494773318632 L -4.6222148834902 -1.984265193848728 L -4.664301631587001 -1.9590393678258229 L -4.7086582838174555 -1.9380602337443569 L -4.754857661372769 -1.9215298321338956 L -4.802454838991936 -1.9096073597983851 L -4.85099142983522 -1.9024076366639018 L -4.9 -1.9000000000000004 L -4.94900857016478 -1.9024076366639018 L -4.997545161008064 -1.9096073597983851 L -5.045142338627231 -1.9215298321338956 L -5.091341716182545 -1.9380602337443569 L -5.135698368412999 -1.9590393678258229 L -5.177785116509801 -1.984265193848728 L -5.217196642081823 -2.013494773318632 L -5.253553390593274 -2.0464466094067264 L -5.286505226681369 -2.0828033579181775 L -5.315734806151273 -2.1222148834901993 L -5.340960632174178 -2.1643016315870014 L -5.361939766255643 -2.2086582838174555 L -5.378470167866105 -2.2548576613727693 L -5.390392640201616 -2.302454838991936 L -5.3975923633360985 -2.35099142983522 L -5.4 -2.4000000000000004 L -5.4 -7.4 L -5.4 -7.4 L -5.3975923633360985 -7.44900857016478 L -5.390392640201616 -7.497545161008064 L -5.378470167866105 -7.545142338627231 L -5.361939766255643 -7.591341716182545 L -5.340960632174178 -7.635698368412999 L -5.315734806151273 -7.677785116509801 L -5.286505226681369 -7.717196642081823 L -5.253553390593274 -7.753553390593274 L -5.217196642081823 -7.786505226681369 L -5.177785116509801 -7.815734806151273 L -5.135698368412999 -7.840960632174178 L -5.091341716182545 -7.861939766255643 L -5.045142338627231 -7.878470167866105 L -4.997545161008064 -7.890392640201616 L -4.94900857016478 -7.8975923633360985 L -4.9 -7.9 L -4.85099142983522 -7.8975923633360985 L -4.802454838991936 -7.890392640201616 L -4.754857661372769 -7.878470167866105 L -4.7086582838174555 -7.861939766255643 L -4.664301631587001 -7.840960632174178 L -4.6222148834902 -7.815734806151273 L -4.582803357918178 -7.786505226681369 L -4.546446609406726 -7.753553390593274 L -4.513494773318632 -7.717196642081823 L -4.484265193848728 -7.677785116509801 L -4.459039367825823 -7.635698368412999 L -4.438060233744357 -7.591341716182545 L -4.421529832133896 -7.545142338627231 L -4.409607359798385 -7.497545161008064 L -4.402407636663902 -7.44900857016478 L -4.4 -7.4 L -4.4 -2.4000000000000004 L -4.4 -2.4000000000000004 L -4.4 -2.4000000000000004 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -2.07157287525381 6.514213562373094 L -2.00566920307762 6.586927059395997 L -1.9472100441378126 6.665750110540039 L -1.896758392092003 6.7499236067336446 L -1.854800123929071 6.838636911194552 L -1.8217393207081487 6.9310356663051795 L -1.7978943760371275 7.0262300215435145 L -1.7834949297681608 7.123303203230081 L -1.7786796564403573 7.221320343559642 L -1.7834949297681608 7.3193374838892025 L -1.7978943760371273 7.4164106655757704 L -1.821739320708149 7.511605020814104 L -1.854800123929071 7.604003775924732 L -1.8967583920920026 7.69271708038564 L -1.9472100441378126 7.776890576579245 L -2.00566920307762 7.855713627723287 L -2.07157287525381 7.9284271247461895 L -2.1442863722767123 7.994330796922379 L -2.2231094234207553 8.052789955862186 L -2.3072829196143596 8.103241607907997 L -2.3959962240752675 8.14519987607093 L -2.4883949791858955 8.178260679291851 L -2.5835893344242296 8.202105623962872 L -2.680662516110797 8.21650507023184 L -2.7786796564403575 8.221320343559642 L -2.876696796769918 8.216505070231838 L -2.973769978456486 8.202105623962872 L -3.0689643336948196 8.178260679291851 L -3.1613630888054476 8.14519987607093 L -3.250076393266355 8.103241607907997 L -3.3342498894599597 8.052789955862186 L -3.413072940604003 7.99433079692238 L -3.485786437626905 7.9284271247461895 L -7.72842712474619 3.6857864376269047 L -7.72842712474619 3.6857864376269047 L -7.794330796922381 3.6130729406040025 L -7.852789955862188 3.53424988945996 L -7.903241607907998 3.4500763932663547 L -7.94519987607093 3.3613630888054473 L -7.978260679291852 3.2689643336948198 L -8.002105623962873 3.173769978456486 L -8.016505070231839 3.076696796769918 L -8.021320343559644 2.9786796564403573 L -8.01650507023184 2.880662516110797 L -8.002105623962873 2.7835893344242293 L -7.978260679291852 2.688394979185895 L -7.945199876070929 2.5959962240752676 L -7.903241607907998 2.507282919614359 L -7.852789955862189 2.4231094234207555 L -7.79433079692238 2.3442863722767124 L -7.72842712474619 2.27157287525381 L -7.655713627723288 2.2056692030776204 L -7.576890576579246 2.1472100441378124 L -7.492717080385641 2.096758392092002 L -7.404003775924733 2.054800123929071 L -7.311605020814104 2.0217393207081487 L -7.216410665575771 1.997894376037127 L -7.119337483889205 1.983494929768161 L -7.021320343559643 1.9786796564403564 L -6.923303203230081 1.983494929768161 L -6.826230021543515 1.9978943760371264 L -6.73103566630518 2.021739320708148 L -6.638636911194554 2.054800123929071 L -6.549923606733645 2.0967583920920028 L -6.46575011054004 2.147210044137812 L -6.3869270593959975 2.20566920307762 L -6.314213562373096 2.27157287525381 L -2.07157287525381 6.514213562373094 L -2.07157287525381 6.514213562373094 L -2.07157287525381 6.514213562373094 Z" fill="none" stroke="#000000" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -2.7786796564403575 6.514213562373095 L -2.745727820352263 6.550570310884545 L -2.7164982408823586 6.589981836456567 L -2.691272414859454 6.632068584553369 L -2.670293280777988 6.676425236783823 L -2.6537628791675267 6.722624614339137 L -2.6418404068320163 6.7702217919583045 L -2.634640683697533 6.8187583828015885 L -2.6322330470336315 6.8677669529663685 L -2.6346406836975333 6.9167755231311485 L -2.6418404068320167 6.9653121139744325 L -2.6537628791675267 7.012909291593599 L -2.670293280777988 7.059108669148913 L -2.6912724148594536 7.1034653213793675 L -2.716498240882359 7.145552069476169 L -2.745727820352263 7.184963595048191 L -2.7786796564403575 7.221320343559642 L -2.815036404951808 7.254272179647736 L -2.85444793052383 7.283501759117641 L -2.896534678620632 7.308727585140545 L -2.9408913308510862 7.3297067192220124 L -2.9870907084064005 7.346237120832472 L -3.034687886025567 7.358159593167983 L -3.0832244768688506 7.365359316302467 L -3.1322330470336315 7.3677669529663685 L -3.181241617198412 7.365359316302467 L -3.2297782080416955 7.358159593167983 L -3.2773753856608625 7.346237120832472 L -3.323574763216176 7.329706719222012 L -3.3679314154466304 7.308727585140546 L -3.4100181635434326 7.283501759117641 L -3.449429689115454 7.254272179647737 L -3.4857864376269054 7.2213203435596425 L -7.021320343559643 3.6857864376269047 L -7.021320343559643 3.6857864376269047 L -7.054272179647737 3.6494296891154536 L -7.083501759117642 3.6100181635434323 L -7.108727585140547 3.5679314154466306 L -7.129706719222012 3.523574763216176 L -7.146237120832474 3.4773753856608622 L -7.158159593167984 3.429778208041695 L -7.165359316302467 3.3812416171984117 L -7.167766952966369 3.3322330470336308 L -7.165359316302468 3.2832244768688508 L -7.1581595931679844 3.234687886025567 L -7.146237120832474 3.1870907084064 L -7.129706719222013 3.1408913308510864 L -7.108727585140547 3.096534678620632 L -7.083501759117643 3.0544479305238297 L -7.054272179647737 3.0150364049518084 L -7.021320343559643 2.9786796564403573 L -6.984963595048192 2.945727820352263 L -6.945552069476171 2.9164982408823588 L -6.903465321379369 2.8912724148594533 L -6.859108669148914 2.870293280777988 L -6.8129092915936 2.8537628791675265 L -6.765312113974434 2.8418404068320164 L -6.71677552313115 2.8346406836975326 L -6.667766952966369 2.8322330470336308 L -6.618758382801589 2.8346406836975326 L -6.570221791958305 2.841840406832016 L -6.522624614339138 2.8537628791675265 L -6.476425236783825 2.870293280777988 L -6.432068584553369 2.8912724148594533 L -6.389981836456569 2.9164982408823583 L -6.350570310884547 2.9457278203522628 L -6.314213562373095 2.978679656440357 L -2.7786796564403575 6.514213562373095 L -2.7786796564403575 6.514213562373095 L -2.7786796564403575 6.514213562373095 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -9.9 -9.9 L 10.1 -9.9 L 10.1 10.1 L -9.9 10.1 L -9.9 -9.9 L -9.9 -9.9 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g></g>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="800" height="1400" viewBox="0 0 800 1400" xmlns="http://www.w3.org/2000/svg">
2
+ <g transform="translate(0, 0)">
3
+ <style></style><rect class="boundary" x="0" y="0" fill="#000" width="800" height="600" data-type="pcb_background" data-pcb-layer="global"/><rect class="pcb-boundary" fill="none" stroke="#fff" stroke-width="0.3" x="127.27272727272725" y="27.272727272727252" width="545.4545454545455" height="545.4545454545455" data-type="pcb_boundary" data-pcb-layer="global"/><path class="pcb-board" d="M 127.27272727272725 572.7272727272727 L 672.7272727272727 572.7272727272727 L 672.7272727272727 27.272727272727252 L 127.27272727272725 27.272727272727252 Z" fill="none" stroke="rgba(255, 255, 255, 0.5)" stroke-width="2.7272727272727275" data-type="pcb_board" data-pcb-layer="board"/><g data-type="pcb_plated_hole" data-pcb-layer="through"><polygon class="pcb-hole-outer-pad" fill="rgb(200, 52, 52)" points="345.45454545454544,354.54545454545456 454.54545454545456,354.54545454545456 481.8181818181818,245.45454545454544 454.54545454545456,218.1818181818182 345.45454545454544,218.1818181818182 345.45454545454544,354.54545454545456" data-type="pcb_plated_hole" data-pcb-layer="top"/><circle class="pcb-hole-inner" fill="#FF26E2" cx="400" cy="300" r="27.272727272727273" data-type="pcb_plated_hole_drill" data-pcb-layer="drill"/></g>
4
+ </g>
5
+ <g transform="translate(0, 600) scale(20, 20) translate(19.9, 19.9)">
6
+ <rect x="-19.9" y="-19.9" width="40" height="40" fill="white"/><g transform="matrix(1 0 0 -1 0 0.20000000000000284)"><g transform="matrix(1,0,0,1,0,0)"><path d="M -1.9 -1.9 L 2.1 -1.9 L 3.1 2.1 L 2.1 3.1 L -1.9 3.1 L -1.9 -1.9 L -1.9 -1.9 L -1.9 -1.9 Z" fill="none" stroke="#000000" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 1.1 0.1 L 1.095184726672197 0.1980171403295606 L 1.0807852804032305 0.2950903220161283 L 1.056940335732209 0.39028467725446236 L 1.0238795325112868 0.4826834323650898 L 0.981921264348355 0.5713967368259977 L 0.9314696123025452 0.6555702330196022 L 0.873010453362737 0.7343932841636455 L 0.8071067811865476 0.8071067811865474 L 0.7343932841636455 0.873010453362737 L 0.6555702330196023 0.9314696123025452 L 0.5713967368259978 0.9819212643483549 L 0.4826834323650898 1.0238795325112868 L 0.39028467725446236 1.056940335732209 L 0.29509032201612834 1.0807852804032305 L 0.19801714032956078 1.0951847266721968 L 0.10000000000000006 1.1 L 0.0019828596704393603 1.095184726672197 L -0.09509032201612819 1.0807852804032305 L -0.19028467725446216 1.056940335732209 L -0.28268343236508975 1.0238795325112868 L -0.3713967368259977 0.981921264348355 L -0.455570233019602 0.9314696123025453 L -0.5343932841636454 0.8730104533627371 L -0.6071067811865475 0.8071067811865476 L -0.673010453362737 0.7343932841636455 L -0.7314696123025454 0.6555702330196022 L -0.781921264348355 0.5713967368259979 L -0.8238795325112868 0.4826834323650899 L -0.8569403357322088 0.39028467725446236 L -0.8807852804032305 0.2950903220161286 L -0.8951847266721968 0.19801714032956083 L -0.9 0.10000000000000013 L -0.895184726672197 0.001982859670439416 L -0.8807852804032305 -0.09509032201612835 L -0.856940335732209 -0.1902846772544621 L -0.8238795325112869 -0.28268343236508964 L -0.7819212643483551 -0.3713967368259976 L -0.7314696123025455 -0.455570233019602 L -0.6730104533627371 -0.5343932841636453 L -0.6071067811865477 -0.6071067811865475 L -0.5343932841636458 -0.6730104533627367 L -0.4555702330196022 -0.7314696123025453 L -0.37139673682599794 -0.781921264348355 L -0.2826834323650903 -0.8238795325112865 L -0.19028467725446244 -0.8569403357322088 L -0.09509032201612866 -0.8807852804032303 L 0.0019828596704395546 -0.895184726672197 L 0.09999999999999983 -0.9 L 0.19801714032956008 -0.895184726672197 L 0.2950903220161283 -0.8807852804032305 L 0.39028467725446203 -0.856940335732209 L 0.48268343236509004 -0.8238795325112866 L 0.5713967368259976 -0.7819212643483551 L 0.6555702330196018 -0.7314696123025455 L 0.7343932841636456 -0.6730104533627369 L 0.8071067811865473 -0.6071067811865477 L 0.8730104533627366 -0.534393284163646 L 0.9314696123025452 -0.4555702330196022 L 0.9819212643483548 -0.37139673682599794 L 1.0238795325112866 -0.2826834323650904 L 1.056940335732209 -0.1902846772544625 L 1.0807852804032303 -0.09509032201612871 L 1.095184726672197 0.001982859670439499 L 1.1 0.1 L 1.1 0.1 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -9.9 -9.9 L 10.1 -9.9 L 10.1 10.1 L -9.9 10.1 L -9.9 -9.9 L -9.9 -9.9 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g></g>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="800" height="1400" viewBox="0 0 800 1400" xmlns="http://www.w3.org/2000/svg">
2
+ <g transform="translate(0, 0)">
3
+ <style></style><rect class="boundary" x="0" y="0" fill="#000" width="800" height="600" data-type="pcb_background" data-pcb-layer="global"/><rect class="pcb-boundary" fill="none" stroke="#fff" stroke-width="0.3" x="150" y="50" width="500" height="500" data-type="pcb_boundary" data-pcb-layer="global"/><path class="pcb-board" d="M 150 550 L 650 550 L 650 50 L 150 50 Z" fill="none" stroke="rgba(255, 255, 255, 0.5)" stroke-width="5" data-type="pcb_board" data-pcb-layer="board"/><g data-type="pcb_plated_hole" data-pcb-layer="through"><rect class="pcb-hole-outer-pad" fill="rgb(200, 52, 52)" x="-75" y="-100" width="150" height="200" transform="translate(400 300) rotate(0)" rx="10" ry="10" data-type="pcb_plated_hole" data-pcb-layer="top"/><rect class="pcb-hole-inner" fill="#FF26E2" x="-25" y="-50" width="50" height="100" rx="25" ry="25" transform="translate(425 275) rotate(-45)" data-type="pcb_plated_hole_drill" data-pcb-layer="drill"/></g>
4
+ </g>
5
+ <g transform="translate(0, 600) scale(26.666666666666668, 26.666666666666668) translate(14.9, 14.9)">
6
+ <rect x="-14.9" y="-14.9" width="30" height="30" fill="white"/><g transform="matrix(1 0 0 -1 0 0.1999999999999993)"><g transform="matrix(1,0,0,1,0,0)"><path d="M -1.2 -1.9 L 1.4000000000000001 -1.9 L 1.4000000000000001 -1.9 L 1.476536686473018 -1.8847759065022573 L 1.5414213562373096 -1.8414213562373094 L 1.5847759065022575 -1.776536686473018 L 1.6 -1.7 L 1.6 -1.7 L 1.6 1.9000000000000001 L 1.6 1.9000000000000001 L 1.5847759065022575 1.976536686473018 L 1.5414213562373096 2.0414213562373096 L 1.476536686473018 2.0847759065022573 L 1.4000000000000001 2.1 L 1.4000000000000001 2.1 L -1.2 2.1 L -1.2 2.1 L -1.2765366864730179 2.0847759065022573 L -1.3414213562373094 2.0414213562373096 L -1.3847759065022573 1.976536686473018 L -1.4 1.9000000000000001 L -1.4 1.9000000000000001 L -1.4 -1.7 L -1.4 -1.7 L -1.3847759065022573 -1.7765366864730179 L -1.3414213562373094 -1.8414213562373094 L -1.276536686473018 -1.8847759065022573 L -1.2 -1.9 L -1.2 -1.9 L -1.2 -1.9 Z" fill="none" stroke="#000000" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 0.5999999999999999 -0.10710678118654748 L 0.636356748511451 -0.1400586172746423 L 0.6757682740834726 -0.16928819674454643 L 0.7178550221802746 -0.19451402276745122 L 0.7622116744107287 -0.21549315684891718 L 0.8084110519660426 -0.23202355845937828 L 0.8560082295852094 -0.24394603079488897 L 0.9045448204284932 -0.2511457539293722 L 0.9535533905932736 -0.2535533905932738 L 1.0025619607580538 -0.2511457539293722 L 1.051098551601338 -0.24394603079488908 L 1.0986957292205046 -0.23202355845937833 L 1.1448951067758184 -0.21549315684891734 L 1.1892517590062726 -0.19451402276745133 L 1.2313385071030747 -0.16928819674454665 L 1.2707500326750965 -0.1400586172746423 L 1.3071067811865473 -0.1071067811865477 L 1.340058617274642 -0.07075003267509683 L 1.3692881967445465 -0.031338507103075064 L 1.394514022767451 0.010748240993727176 L 1.415493156848917 0.05510489322418144 L 1.4320235584593781 0.101304270779495 L 1.4439460307948888 0.14890144839866182 L 1.4511457539293722 0.19743803924194558 L 1.4535533905932736 0.24644660940672602 L 1.4511457539293722 0.2954551795715066 L 1.4439460307948888 0.34399177041479023 L 1.4320235584593783 0.39158894803395716 L 1.4154931568489173 0.4377883255892706 L 1.394514022767451 0.4821449778197249 L 1.3692881967445465 0.524231725916527 L 1.340058617274642 0.563643251488549 L 1.3071067811865476 0.6 L 0.6000000000000001 1.3071067811865476 L 0.6000000000000001 1.3071067811865476 L 0.563643251488549 1.3400586172746423 L 0.5242317259165272 1.3692881967445465 L 0.4821449778197249 1.3945140227674513 L 0.4377883255892711 1.415493156848917 L 0.3915889480339575 1.4320235584593783 L 0.34399177041479034 1.443946030794889 L 0.29545517957150647 1.4511457539293724 L 0.24644660940672636 1.453553390593274 L 0.19743803924194592 1.4511457539293722 L 0.14890144839866204 1.4439460307948893 L 0.10130427077949511 1.4320235584593783 L 0.05510489322418122 1.4154931568489173 L 0.01074824099372751 1.3945140227674513 L -0.03133850710307484 1.3692881967445465 L -0.0707500326750965 1.3400586172746425 L -0.10710678118654748 1.3071067811865476 L -0.14005861727464242 1.2707500326750967 L -0.16928819674454643 1.2313385071030751 L -0.19451402276745133 1.189251759006273 L -0.21549315684891723 1.1448951067758188 L -0.23202355845937817 1.098695729220505 L -0.24394603079488908 1.051098551601338 L -0.2511457539293722 1.0025619607580543 L -0.25355339059327375 0.9535533905932738 L -0.25114575392937233 0.9045448204284936 L -0.24394603079488908 0.8560082295852097 L -0.23202355845937828 0.8084110519660428 L -0.2154931568489173 0.7622116744107291 L -0.1945140227674514 0.7178550221802751 L -0.16928819674454654 0.6757682740834728 L -0.14005861727464236 0.6363567485114513 L -0.1071067811865476 0.6000000000000001 L 0.5999999999999999 -0.10710678118654754 L 0.5999999999999999 -0.10710678118654748 L 0.5999999999999999 -0.10710678118654748 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M -4.9 -4.9 L 5.1 -4.9 L 5.1 5.1 L -4.9 5.1 L -4.9 -4.9 L -4.9 -4.9 Z" fill="none" stroke="#0000FF" stroke-width="0.1"/></g></g>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,62 @@
1
+ import { test, expect } from "bun:test"
2
+ import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
3
+ import { generateLightBurnSvg } from "lbrnts"
4
+ import { convertCircuitJsonToLbrn } from "../../../lib"
5
+ import { stackSvgsVertically } from "stack-svgs"
6
+ import type { CircuitJson } from "circuit-json"
7
+
8
+ const circuitJson: CircuitJson = [
9
+ {
10
+ type: "source_port",
11
+ name: "via1",
12
+ source_port_id: "source_port_1",
13
+ },
14
+ {
15
+ type: "pcb_board",
16
+ pcb_board_id: "board_circle",
17
+ width: 10,
18
+ height: 10,
19
+ center: { x: 0, y: 0 },
20
+ thickness: 1.6,
21
+ num_layers: 2,
22
+ material: "fr4",
23
+ },
24
+ {
25
+ type: "pcb_plated_hole",
26
+ pcb_plated_hole_id: "pcb_plated_hole_1",
27
+ pcb_component_id: "pcb_component_1",
28
+ pcb_port_id: "pcb_port_1",
29
+ outer_diameter: 2,
30
+ hole_diameter: 1,
31
+ shape: "circle",
32
+ port_hints: ["1"],
33
+ x: -1,
34
+ y: 3,
35
+ layers: ["top", "bottom"],
36
+ },
37
+ {
38
+ type: "pcb_plated_hole",
39
+ pcb_plated_hole_id: "pcb_plated_hole_2",
40
+ pcb_component_id: "pcb_component_1",
41
+ pcb_port_id: "pcb_port_2",
42
+ outer_diameter: 4,
43
+ hole_diameter: 3,
44
+ shape: "circle",
45
+ port_hints: ["2"],
46
+ x: 1,
47
+ y: -1,
48
+ layers: ["top", "bottom"],
49
+ },
50
+ ]
51
+
52
+ test("renders a circle plated hole with copper cut", async () => {
53
+ const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
54
+
55
+ const project = convertCircuitJsonToLbrn(circuitJson)
56
+
57
+ const lbrnSvg = await generateLightBurnSvg(project)
58
+
59
+ expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
60
+ import.meta.filename,
61
+ )
62
+ })
@@ -0,0 +1,54 @@
1
+ import { test, expect } from "bun:test"
2
+ import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
3
+ import { generateLightBurnSvg } from "lbrnts"
4
+ import { convertCircuitJsonToLbrn } from "../../../lib"
5
+ import { stackSvgsVertically } from "stack-svgs"
6
+ import type { CircuitJson } from "circuit-json"
7
+
8
+ const circuitJson: CircuitJson = [
9
+ {
10
+ type: "source_port",
11
+ name: "via1",
12
+ source_port_id: "source_port_1",
13
+ },
14
+ {
15
+ type: "pcb_board",
16
+ pcb_board_id: "board_circle",
17
+ width: 10,
18
+ height: 10,
19
+ center: { x: 0, y: 0 },
20
+ thickness: 1.6,
21
+ num_layers: 2,
22
+ material: "fr4",
23
+ },
24
+ {
25
+ type: "pcb_plated_hole",
26
+ pcb_plated_hole_id: "pcb_plated_hole_3",
27
+ pcb_component_id: "pcb_component_1",
28
+ pcb_port_id: "pcb_port_3",
29
+ shape: "circular_hole_with_rect_pad",
30
+ port_hints: ["3"],
31
+ x: 1,
32
+ y: 1,
33
+ hole_shape: "circle",
34
+ hole_diameter: 1,
35
+ pad_shape: "rect",
36
+ rect_pad_width: 2,
37
+ rect_pad_height: 2,
38
+ hole_offset_x: 0,
39
+ hole_offset_y: 0,
40
+ layers: ["top", "bottom"],
41
+ },
42
+ ]
43
+
44
+ test("renders a circular hole with rect pad", async () => {
45
+ const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
46
+
47
+ const project = convertCircuitJsonToLbrn(circuitJson)
48
+
49
+ const lbrnSvg = await generateLightBurnSvg(project)
50
+
51
+ expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
52
+ import.meta.filename,
53
+ )
54
+ })
@@ -0,0 +1,101 @@
1
+ import { test, expect } from "bun:test"
2
+ import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
3
+ import { generateLightBurnSvg } from "lbrnts"
4
+ import { convertCircuitJsonToLbrn } from "../../../lib"
5
+ import { stackSvgsVertically } from "stack-svgs"
6
+ import type { CircuitJson } from "circuit-json"
7
+
8
+ const circuitJson: CircuitJson = [
9
+ {
10
+ type: "source_port",
11
+ name: "via1",
12
+ source_port_id: "source_port_1",
13
+ },
14
+ {
15
+ type: "pcb_board",
16
+ pcb_board_id: "board_oval",
17
+ width: 20,
18
+ height: 20,
19
+ center: { x: 0, y: 0 },
20
+ thickness: 1.6,
21
+ num_layers: 2,
22
+ material: "fr4",
23
+ },
24
+ // Large oval with different proportions
25
+ {
26
+ type: "pcb_plated_hole",
27
+ pcb_plated_hole_id: "pcb_plated_hole_4",
28
+ pcb_component_id: "pcb_component_1",
29
+ pcb_port_id: "pcb_port_4",
30
+ shape: "oval",
31
+ port_hints: ["4"],
32
+ x: 5,
33
+ y: -5,
34
+ outer_width: 8,
35
+ outer_height: 2,
36
+ hole_width: 6,
37
+ hole_height: 1,
38
+ ccw_rotation: 0,
39
+ layers: ["top", "bottom"],
40
+ },
41
+ {
42
+ type: "pcb_plated_hole",
43
+ pcb_plated_hole_id: "pcb_plated_hole_5",
44
+ pcb_component_id: "pcb_component_1",
45
+ pcb_port_id: "pcb_port_5",
46
+ shape: "oval",
47
+ port_hints: ["5"],
48
+ x: 5,
49
+ y: 5,
50
+ outer_width: 8,
51
+ outer_height: 2,
52
+ hole_width: 6,
53
+ hole_height: 1,
54
+ ccw_rotation: 0,
55
+ layers: ["top", "bottom"],
56
+ },
57
+ {
58
+ type: "pcb_plated_hole",
59
+ pcb_plated_hole_id: "pcb_plated_hole_6",
60
+ pcb_component_id: "pcb_component_1",
61
+ pcb_port_id: "pcb_port_6",
62
+ shape: "oval",
63
+ port_hints: ["6"],
64
+ x: -5,
65
+ y: -5,
66
+ outer_width: 8,
67
+ outer_height: 2,
68
+ hole_width: 6,
69
+ hole_height: 1,
70
+ ccw_rotation: 45,
71
+ layers: ["top", "bottom"],
72
+ },
73
+ {
74
+ type: "pcb_plated_hole",
75
+ pcb_plated_hole_id: "pcb_plated_hole_7",
76
+ pcb_component_id: "pcb_component_1",
77
+ pcb_port_id: "pcb_port_7",
78
+ shape: "oval",
79
+ port_hints: ["7"],
80
+ x: -5,
81
+ y: 5,
82
+ outer_width: 8,
83
+ outer_height: 2,
84
+ hole_width: 6,
85
+ hole_height: 1,
86
+ ccw_rotation: 90,
87
+ layers: ["top", "bottom"],
88
+ },
89
+ ]
90
+
91
+ test("renders oval plated holes with different orientations", async () => {
92
+ const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
93
+
94
+ const project = convertCircuitJsonToLbrn(circuitJson)
95
+
96
+ const lbrnSvg = await generateLightBurnSvg(project)
97
+
98
+ expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
99
+ import.meta.filename,
100
+ )
101
+ })
@@ -0,0 +1,54 @@
1
+ import { test, expect } from "bun:test"
2
+ import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
3
+ import { generateLightBurnSvg } from "lbrnts"
4
+ import { convertCircuitJsonToLbrn } from "../../../lib"
5
+ import { stackSvgsVertically } from "stack-svgs"
6
+ import type { CircuitJson } from "circuit-json"
7
+
8
+ const circuitJson: CircuitJson = [
9
+ {
10
+ type: "source_port",
11
+ name: "via1",
12
+ source_port_id: "source_port_1",
13
+ },
14
+ {
15
+ type: "pcb_board",
16
+ pcb_board_id: "board",
17
+ width: 10,
18
+ height: 10,
19
+ center: { x: 0, y: 0 },
20
+ thickness: 1.6,
21
+ num_layers: 2,
22
+ material: "fr4",
23
+ },
24
+ {
25
+ type: "pcb_plated_hole",
26
+ pcb_plated_hole_id: "pcb_plated_hole_1",
27
+ pcb_component_id: "pcb_component_1",
28
+ pcb_port_id: "pcb_port_1",
29
+ shape: "pill_hole_with_rect_pad",
30
+ port_hints: ["1"],
31
+ x: 0,
32
+ y: 0,
33
+ hole_shape: "pill",
34
+ hole_width: 1,
35
+ hole_height: 2,
36
+ pad_shape: "rect",
37
+ rect_pad_width: 3,
38
+ rect_pad_height: 4,
39
+ rect_border_radius: 0.2,
40
+ hole_offset_x: 0.5,
41
+ hole_offset_y: 0.5,
42
+ layers: ["top", "bottom"],
43
+ },
44
+ ]
45
+
46
+ test("renders pill holes with rectangular pads", async () => {
47
+ const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
48
+ const project = convertCircuitJsonToLbrn(circuitJson)
49
+ const lbrnSvg = await generateLightBurnSvg(project)
50
+
51
+ expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
52
+ import.meta.filename,
53
+ )
54
+ })
@@ -0,0 +1,101 @@
1
+ import { test, expect } from "bun:test"
2
+ import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
3
+ import { generateLightBurnSvg } from "lbrnts"
4
+ import { convertCircuitJsonToLbrn } from "../../../lib"
5
+ import { stackSvgsVertically } from "stack-svgs"
6
+ import type { CircuitJson } from "circuit-json"
7
+
8
+ const circuitJson: CircuitJson = [
9
+ {
10
+ type: "source_port",
11
+ name: "via1",
12
+ source_port_id: "source_port_1",
13
+ },
14
+ {
15
+ type: "pcb_board",
16
+ pcb_board_id: "board_pill",
17
+ width: 20,
18
+ height: 20,
19
+ center: { x: 0, y: 0 },
20
+ thickness: 1.6,
21
+ num_layers: 2,
22
+ material: "fr4",
23
+ },
24
+ // Large oval with different proportions
25
+ {
26
+ type: "pcb_plated_hole",
27
+ pcb_plated_hole_id: "pcb_plated_hole_4",
28
+ pcb_component_id: "pcb_component_1",
29
+ pcb_port_id: "pcb_port_4",
30
+ shape: "pill",
31
+ port_hints: ["4"],
32
+ x: 5,
33
+ y: -5,
34
+ outer_width: 8,
35
+ outer_height: 2,
36
+ hole_width: 6,
37
+ hole_height: 1,
38
+ ccw_rotation: 0,
39
+ layers: ["top", "bottom"],
40
+ },
41
+ {
42
+ type: "pcb_plated_hole",
43
+ pcb_plated_hole_id: "pcb_plated_hole_5",
44
+ pcb_component_id: "pcb_component_1",
45
+ pcb_port_id: "pcb_port_5",
46
+ shape: "pill",
47
+ port_hints: ["5"],
48
+ x: 5,
49
+ y: 5,
50
+ outer_width: 8,
51
+ outer_height: 2,
52
+ hole_width: 6,
53
+ hole_height: 1,
54
+ ccw_rotation: 0,
55
+ layers: ["top", "bottom"],
56
+ },
57
+ {
58
+ type: "pcb_plated_hole",
59
+ pcb_plated_hole_id: "pcb_plated_hole_6",
60
+ pcb_component_id: "pcb_component_1",
61
+ pcb_port_id: "pcb_port_6",
62
+ shape: "pill",
63
+ port_hints: ["6"],
64
+ x: -5,
65
+ y: -5,
66
+ outer_width: 8,
67
+ outer_height: 2,
68
+ hole_width: 6,
69
+ hole_height: 1,
70
+ ccw_rotation: 90,
71
+ layers: ["top", "bottom"],
72
+ },
73
+ {
74
+ type: "pcb_plated_hole",
75
+ pcb_plated_hole_id: "pcb_plated_hole_7",
76
+ pcb_component_id: "pcb_component_1",
77
+ pcb_port_id: "pcb_port_7",
78
+ shape: "pill",
79
+ port_hints: ["7"],
80
+ x: -5,
81
+ y: 5,
82
+ outer_width: 8,
83
+ outer_height: 2,
84
+ hole_width: 6,
85
+ hole_height: 1,
86
+ ccw_rotation: 45,
87
+ layers: ["top", "bottom"],
88
+ },
89
+ ]
90
+
91
+ test("renders pill plated holes with different orientations", async () => {
92
+ const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
93
+
94
+ const project = convertCircuitJsonToLbrn(circuitJson)
95
+
96
+ const lbrnSvg = await generateLightBurnSvg(project)
97
+
98
+ expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
99
+ import.meta.filename,
100
+ )
101
+ })
@@ -0,0 +1,59 @@
1
+ import { test, expect } from "bun:test"
2
+ import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
3
+ import { generateLightBurnSvg } from "lbrnts"
4
+ import { convertCircuitJsonToLbrn } from "../../../lib"
5
+ import { stackSvgsVertically } from "stack-svgs"
6
+ import type { CircuitJson } from "circuit-json"
7
+
8
+ const circuitJson: CircuitJson = [
9
+ {
10
+ type: "source_port",
11
+ name: "via1",
12
+ source_port_id: "source_port_1",
13
+ },
14
+ {
15
+ type: "pcb_board",
16
+ pcb_board_id: "board_polygon",
17
+ width: 20,
18
+ height: 20,
19
+ center: { x: 0, y: 0 },
20
+ thickness: 1.6,
21
+ num_layers: 2,
22
+ material: "fr4",
23
+ },
24
+ {
25
+ type: "pcb_plated_hole",
26
+ pcb_plated_hole_id: "pcb_plated_hole_polygon",
27
+ pcb_component_id: "pcb_component_1",
28
+ pcb_port_id: "pcb_port_1",
29
+ hole_diameter: 2,
30
+ hole_shape: "circle",
31
+ hole_offset_x: 0,
32
+ hole_offset_y: 0,
33
+ shape: "hole_with_polygon_pad",
34
+ port_hints: ["1"],
35
+ x: 0,
36
+ y: 0,
37
+ layers: ["top", "bottom"],
38
+ pad_outline: [
39
+ { x: -2, y: -2 },
40
+ { x: 2, y: -2 },
41
+ { x: 3, y: 2 },
42
+ { x: 2, y: 3 },
43
+ { x: -2, y: 3 },
44
+ { x: -2, y: -2 },
45
+ ],
46
+ },
47
+ ]
48
+
49
+ test("convert pcb plated hole with polygon pad to lbrn", async () => {
50
+ const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
51
+
52
+ const project = convertCircuitJsonToLbrn(circuitJson)
53
+
54
+ const lbrnSvg = await generateLightBurnSvg(project)
55
+
56
+ expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
57
+ import.meta.filename,
58
+ )
59
+ })
@@ -0,0 +1,56 @@
1
+ import { test, expect } from "bun:test"
2
+ import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
3
+ import { generateLightBurnSvg } from "lbrnts"
4
+ import { convertCircuitJsonToLbrn } from "../../../lib"
5
+ import { stackSvgsVertically } from "stack-svgs"
6
+ import type { CircuitJson } from "circuit-json"
7
+
8
+ const circuitJson: CircuitJson = [
9
+ {
10
+ type: "source_port",
11
+ name: "via1",
12
+ source_port_id: "source_port_1",
13
+ },
14
+ {
15
+ type: "pcb_board",
16
+ pcb_board_id: "board",
17
+ width: 10,
18
+ height: 10,
19
+ center: { x: 0, y: 0 },
20
+ thickness: 1.6,
21
+ num_layers: 2,
22
+ material: "fr4",
23
+ },
24
+ {
25
+ type: "pcb_plated_hole",
26
+ pcb_plated_hole_id: "pcb_plated_hole_1",
27
+ pcb_component_id: "pcb_component_1",
28
+ pcb_port_id: "pcb_port_1",
29
+ shape: "rotated_pill_hole_with_rect_pad",
30
+ port_hints: ["1"],
31
+ x: 0,
32
+ y: 0,
33
+ hole_shape: "rotated_pill",
34
+ hole_width: 1,
35
+ hole_height: 2,
36
+ pad_shape: "rect",
37
+ rect_pad_width: 3,
38
+ rect_pad_height: 4,
39
+ rect_border_radius: 0.2,
40
+ hole_offset_x: 0.5,
41
+ hole_offset_y: 0.5,
42
+ layers: ["top", "bottom"],
43
+ hole_ccw_rotation: 45,
44
+ rect_ccw_rotation: 0,
45
+ },
46
+ ]
47
+
48
+ test("renders rotated pill holes with rectangular pads", async () => {
49
+ const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
50
+ const project = convertCircuitJsonToLbrn(circuitJson)
51
+ const lbrnSvg = await generateLightBurnSvg(project)
52
+
53
+ expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
54
+ import.meta.filename,
55
+ )
56
+ })