circuit-json-to-lbrn 0.0.51 → 0.0.53
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.
- package/.github/workflows/stalebot.yml +29 -0
- package/CLAUDE.md +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +140 -9
- package/lib/ConvertContext.ts +4 -0
- package/lib/createOxidationCleaningLayerForLayer.ts +120 -0
- package/lib/index.ts +66 -11
- package/lib/layer-indexes.ts +22 -0
- package/package.json +1 -1
- package/tests/basics/copper-cut-fill/__snapshots__/copper-cut-fill-basic.snap.svg +1 -1
- package/tests/basics/copper-cut-fill/__snapshots__/copper-cut-fill-with-pads.snap.svg +1 -1
- package/tests/basics/oxidation-cleaning/__snapshots__/oxidation-cleaning-basic.snap.svg +8 -0
- package/tests/basics/oxidation-cleaning/oxidation-cleaning-basic.test.ts +42 -0
- package/tests/examples/example05/__snapshots__/example05.snap.svg +1 -1
|
@@ -3,6 +3,6 @@
|
|
|
3
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="25" y="50" width="750" height="500" data-type="pcb_boundary" data-pcb-layer="global"/><path class="pcb-board" d="M 25 550 L 775 550 L 775 50 L 25 50 Z" fill="none" stroke="rgba(255, 255, 255, 0.5)" stroke-width="2.5" data-type="pcb_board" data-pcb-layer="board"/><rect class="pcb-pad" fill="rgb(200, 52, 52)" x="175" y="262.5" width="50" height="75" data-type="pcb_smtpad" data-pcb-layer="top"/><rect class="pcb-pad" fill="rgb(200, 52, 52)" x="575" y="262.5" width="50" height="75" data-type="pcb_smtpad" data-pcb-layer="top"/><path class="pcb-trace" stroke="rgb(200, 52, 52)" fill="none" d="M 225 300 L 575 300" stroke-width="12.5" stroke-linecap="round" stroke-linejoin="round" shape-rendering="crispEdges" data-type="pcb_trace" data-pcb-layer="top"/>
|
|
4
4
|
</g>
|
|
5
5
|
<g transform="translate(0, 600) scale(16, 16) translate(15.9, 18.4)">
|
|
6
|
-
<defs><pattern id="hatch-0.0050-45-true-
|
|
6
|
+
<defs><pattern id="hatch-0.0050-45-true-_2300FFFF-0.1000-0.80__stack1" patternUnits="userSpaceOnUse" width="0.005" height="0.005" patternTransform="rotate(45)"><path d="M -0.005 0 L 0.005 0 M 0 -0.005 L 0 0.005" stroke="#00FFFF" stroke-width="0.1" stroke-opacity="0.8"/></pattern></defs><rect x="-15.9" y="-18.4" width="50" height="40" fill="white"/><g transform="matrix(1 0 0 -1 0 3.200000000000003)"><g transform="matrix(1,0,0,1,0,0)"><path d="M -5.9 -8.4 L 24.1 -8.4 L 24.1 11.6 L -5.9 11.6 L -5.9 -8.4 L -5.9 -8.4 Z" fill="none" stroke="#FF0000" stroke-width="0.1" stroke-linecap="round" stroke-linejoin="round"/></g><g transform="matrix(1,0,0,1,0,0)"><path d="M 15.988675552865574 1.35 L 15.994762056099601 1.3459331285593963 L 16.1 1.3250000000000002 L 16.1 0.10000000000000009 L 18.1 0.10000000000000009 L 18.1 3.1 L 16.1 3.1 L 16.1 1.8750000000000004 L 15.994762056099601 1.854066871440604 L 15.988675552865574 1.85 L 2.211324447134427 1.85 L 2.2052379439003995 1.854066871440604 L 2.0999999999999996 1.875 L 2.0999999999999996 3.1 L 0.09999999999999964 3.1 L 0.09999999999999964 0.10000000000000009 L 2.0999999999999996 0.10000000000000009 L 2.0999999999999996 1.3250000000000002 L 2.2052379439003995 1.3459331285593963 L 2.2113244471344267 1.35 L 15.988675552865574 1.35 L 15.988675552865574 1.35" fill="none" stroke="#000000" stroke-width="0.1" stroke-linecap="round" stroke-linejoin="round"/></g><g><path d="M 0.10000000149011612 3.100000001490116 L 2.100000001490116 3.100000001490116 L 2.100000001490116 1.875 L 2.2052379474043846 1.8540668711066246 L 2.2113244459033012 1.8500000014901161 L 15.988675557076931 1.8500000014901161 L 15.994762055575848 1.8540668711066246 L 16.100000001490116 1.875 L 16.100000001490116 3.100000001490116 L 18.100000001490116 3.100000001490116 L 18.100000001490116 0.10000000149011612 L 16.100000001490116 0.10000000149011612 L 16.100000001490116 1.3250000029802322 L 15.994762055575848 1.3459331318736076 L 15.988675557076931 1.3500000014901161 L 2.2113244459033012 1.3500000014901161 L 2.2052379474043846 1.3459331318736076 L 2.100000001490116 1.3250000029802322 L 2.100000001490116 0.10000000149011612 L 0.10000000149011612 0.10000000149011612 L 0.10000000149011612 3.100000001490116 L 0.10000000149011612 3.100000001490116 Z M 2.256072260439396 -0.6846282184123993 L 2.406146749854088 -0.6391036286950111 L 2.5444561913609505 -0.5651756897568703 L 2.665685422718525 -0.4656854197382927 L 2.7651756927371025 -0.34445618838071823 L 2.8391036316752434 -0.2061467468738556 L 2.8846282213926315 -0.056072257459163666 L 2.899999998509884 0.10000000149011612 L 2.899999998509884 0.5499999970197678 L 15.299999997019768 0.5499999970197678 L 15.299999997019768 0.10000000149011612 L 15.3153717815876 -0.056072257459163666 L 15.360896371304989 -0.2061467468738556 L 15.43482431024313 -0.34445618838071823 L 15.534314580261707 -0.4656854197382927 L 15.655543811619282 -0.5651756897568703 L 15.793853253126144 -0.6391036286950111 L 15.943927742540836 -0.6846282184123993 L 16.100000001490116 -0.7000000029802322 L 18.100000001490116 -0.7000000029802322 L 18.256072260439396 -0.6846282184123993 L 18.406146749854088 -0.6391036286950111 L 18.54445619136095 -0.5651756897568703 L 18.665685422718525 -0.4656854197382927 L 18.765175692737103 -0.34445618838071823 L 18.839103631675243 -0.2061467468738556 L 18.88462822139263 -0.056072257459163666 L 18.899999998509884 0.10000000149011612 L 18.899999998509884 3.100000001490116 L 18.88462822139263 3.256072260439396 L 18.839103631675243 3.406146749854088 L 18.765175692737103 3.5444561913609505 L 18.665685422718525 3.665685422718525 L 18.54445619136095 3.7651756927371025 L 18.406146749854088 3.8391036316752434 L 18.256072260439396 3.8846282213926315 L 18.100000001490116 3.899999998509884 L 16.100000001490116 3.899999998509884 L 15.943927742540836 3.8846282213926315 L 15.793853253126144 3.8391036316752434 L 15.655543811619282 3.7651756927371025 L 15.534314580261707 3.665685422718525 L 15.43482431024313 3.5444561913609505 L 15.360896371304989 3.406146749854088 L 15.3153717815876 3.256072260439396 L 15.299999997019768 3.100000001490116 L 15.299999997019768 2.649999998509884 L 2.899999998509884 2.649999998509884 L 2.899999998509884 3.100000001490116 L 2.8846282213926315 3.256072260439396 L 2.8391036316752434 3.406146749854088 L 2.7651756927371025 3.5444561913609505 L 2.665685422718525 3.665685422718525 L 2.5444561913609505 3.7651756927371025 L 2.406146749854088 3.8391036316752434 L 2.256072260439396 3.8846282213926315 L 2.100000001490116 3.899999998509884 L 0.10000000149011612 3.899999998509884 L -0.056072257459163666 3.8846282213926315 L -0.2061467468738556 3.8391036316752434 L -0.34445618838071823 3.7651756927371025 L -0.4656854197382927 3.665685422718525 L -0.5651756897568703 3.5444561913609505 L -0.6391036286950111 3.406146749854088 L -0.6846282184123993 3.256072260439396 L -0.7000000029802322 3.100000001490116 L -0.7000000029802322 0.10000000149011612 L -0.6846282184123993 -0.056072257459163666 L -0.6391036286950111 -0.2061467468738556 L -0.5651756897568703 -0.34445618838071823 L -0.4656854197382927 -0.4656854197382927 L -0.34445618838071823 -0.5651756897568703 L -0.2061467468738556 -0.6391036286950111 L -0.056072257459163666 -0.6846282184123993 L 0.10000000149011612 -0.7000000029802322 L 2.100000001490116 -0.7000000029802322 L 2.256072260439396 -0.6846282184123993 L 2.256072260439396 -0.6846282184123993 Z" fill="url(#hatch-0.0050-45-true-_2300FFFF-0.1000-0.80__stack1)" fill-rule="nonzero" stroke="none"/><path d="M 0.10000000149011612 3.100000001490116 L 2.100000001490116 3.100000001490116 L 2.100000001490116 1.875 L 2.2052379474043846 1.8540668711066246 L 2.2113244459033012 1.8500000014901161 L 15.988675557076931 1.8500000014901161 L 15.994762055575848 1.8540668711066246 L 16.100000001490116 1.875 L 16.100000001490116 3.100000001490116 L 18.100000001490116 3.100000001490116 L 18.100000001490116 0.10000000149011612 L 16.100000001490116 0.10000000149011612 L 16.100000001490116 1.3250000029802322 L 15.994762055575848 1.3459331318736076 L 15.988675557076931 1.3500000014901161 L 2.2113244459033012 1.3500000014901161 L 2.2052379474043846 1.3459331318736076 L 2.100000001490116 1.3250000029802322 L 2.100000001490116 0.10000000149011612 L 0.10000000149011612 0.10000000149011612 L 0.10000000149011612 3.100000001490116 L 0.10000000149011612 3.100000001490116 Z M 2.256072260439396 -0.6846282184123993 L 2.406146749854088 -0.6391036286950111 L 2.5444561913609505 -0.5651756897568703 L 2.665685422718525 -0.4656854197382927 L 2.7651756927371025 -0.34445618838071823 L 2.8391036316752434 -0.2061467468738556 L 2.8846282213926315 -0.056072257459163666 L 2.899999998509884 0.10000000149011612 L 2.899999998509884 0.5499999970197678 L 15.299999997019768 0.5499999970197678 L 15.299999997019768 0.10000000149011612 L 15.3153717815876 -0.056072257459163666 L 15.360896371304989 -0.2061467468738556 L 15.43482431024313 -0.34445618838071823 L 15.534314580261707 -0.4656854197382927 L 15.655543811619282 -0.5651756897568703 L 15.793853253126144 -0.6391036286950111 L 15.943927742540836 -0.6846282184123993 L 16.100000001490116 -0.7000000029802322 L 18.100000001490116 -0.7000000029802322 L 18.256072260439396 -0.6846282184123993 L 18.406146749854088 -0.6391036286950111 L 18.54445619136095 -0.5651756897568703 L 18.665685422718525 -0.4656854197382927 L 18.765175692737103 -0.34445618838071823 L 18.839103631675243 -0.2061467468738556 L 18.88462822139263 -0.056072257459163666 L 18.899999998509884 0.10000000149011612 L 18.899999998509884 3.100000001490116 L 18.88462822139263 3.256072260439396 L 18.839103631675243 3.406146749854088 L 18.765175692737103 3.5444561913609505 L 18.665685422718525 3.665685422718525 L 18.54445619136095 3.7651756927371025 L 18.406146749854088 3.8391036316752434 L 18.256072260439396 3.8846282213926315 L 18.100000001490116 3.899999998509884 L 16.100000001490116 3.899999998509884 L 15.943927742540836 3.8846282213926315 L 15.793853253126144 3.8391036316752434 L 15.655543811619282 3.7651756927371025 L 15.534314580261707 3.665685422718525 L 15.43482431024313 3.5444561913609505 L 15.360896371304989 3.406146749854088 L 15.3153717815876 3.256072260439396 L 15.299999997019768 3.100000001490116 L 15.299999997019768 2.649999998509884 L 2.899999998509884 2.649999998509884 L 2.899999998509884 3.100000001490116 L 2.8846282213926315 3.256072260439396 L 2.8391036316752434 3.406146749854088 L 2.7651756927371025 3.5444561913609505 L 2.665685422718525 3.665685422718525 L 2.5444561913609505 3.7651756927371025 L 2.406146749854088 3.8391036316752434 L 2.256072260439396 3.8846282213926315 L 2.100000001490116 3.899999998509884 L 0.10000000149011612 3.899999998509884 L -0.056072257459163666 3.8846282213926315 L -0.2061467468738556 3.8391036316752434 L -0.34445618838071823 3.7651756927371025 L -0.4656854197382927 3.665685422718525 L -0.5651756897568703 3.5444561913609505 L -0.6391036286950111 3.406146749854088 L -0.6846282184123993 3.256072260439396 L -0.7000000029802322 3.100000001490116 L -0.7000000029802322 0.10000000149011612 L -0.6846282184123993 -0.056072257459163666 L -0.6391036286950111 -0.2061467468738556 L -0.5651756897568703 -0.34445618838071823 L -0.4656854197382927 -0.4656854197382927 L -0.34445618838071823 -0.5651756897568703 L -0.2061467468738556 -0.6391036286950111 L -0.056072257459163666 -0.6846282184123993 L 0.10000000149011612 -0.7000000029802322 L 2.100000001490116 -0.7000000029802322 L 2.256072260439396 -0.6846282184123993 L 2.256072260439396 -0.6846282184123993 Z" fill="none" fill-rule="nonzero" stroke="#00FFFF" stroke-width="0.1"/></g></g>
|
|
7
7
|
</g>
|
|
8
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"/>
|
|
4
|
+
</g>
|
|
5
|
+
<g transform="translate(0, 600) scale(19.999999999254943, 19.999999999254943) translate(19.9, 19.9)">
|
|
6
|
+
<defs><pattern id="hatch-0.0050-45-true-_23C0C0C0-0.1000-0.80__stack1" patternUnits="userSpaceOnUse" width="0.005" height="0.005" patternTransform="rotate(45)"><path d="M -0.005 0 L 0.005 0 M 0 -0.005 L 0 0.005" stroke="#C0C0C0" stroke-width="0.1" stroke-opacity="0.8"/></pattern></defs><rect x="-19.9" y="-19.9" width="40.000000001490115" height="40.000000001490115" fill="white"/><g transform="matrix(1 0 0 -1 0 0.20000000149011754)"><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="#FF0000" stroke-width="0.1" stroke-linecap="round" stroke-linejoin="round"/></g><g><path d="M 10.100000001490116 10.100000001490116 L -9.899999998509884 10.100000001490116 L -9.899999998509884 -9.899999998509884 L 10.100000001490116 -9.899999998509884 L 10.100000001490116 10.100000001490116 L 10.100000001490116 10.100000001490116 Z" fill="url(#hatch-0.0050-45-true-_23C0C0C0-0.1000-0.80__stack1)" fill-rule="nonzero" stroke="none"/><path d="M 10.100000001490116 10.100000001490116 L -9.899999998509884 10.100000001490116 L -9.899999998509884 -9.899999998509884 L 10.100000001490116 -9.899999998509884 L 10.100000001490116 10.100000001490116 L 10.100000001490116 10.100000001490116 Z" fill="none" fill-rule="nonzero" stroke="#C0C0C0" stroke-width="0.1"/></g></g>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import type { CircuitJson } from "circuit-json"
|
|
3
|
+
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
|
|
4
|
+
import { generateLightBurnSvg } from "lbrnts"
|
|
5
|
+
import { stackSvgsVertically } from "stack-svgs"
|
|
6
|
+
import { convertCircuitJsonToLbrn } from "../../../lib"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Test basic oxidation cleaning layer functionality.
|
|
10
|
+
* The oxidation cleaning layer should fill the entire board area
|
|
11
|
+
* for laser ablation to clean oxidation from the copper surface.
|
|
12
|
+
*/
|
|
13
|
+
test("oxidation-cleaning-basic", async () => {
|
|
14
|
+
const circuitJson = [
|
|
15
|
+
{
|
|
16
|
+
type: "pcb_board",
|
|
17
|
+
pcb_board_id: "board_1",
|
|
18
|
+
width: 20,
|
|
19
|
+
height: 20,
|
|
20
|
+
center: { x: 0, y: 0 },
|
|
21
|
+
},
|
|
22
|
+
] as CircuitJson
|
|
23
|
+
|
|
24
|
+
const pcbSvg = await convertCircuitJsonToPcbSvg(circuitJson)
|
|
25
|
+
|
|
26
|
+
const project = await convertCircuitJsonToLbrn(circuitJson, {
|
|
27
|
+
includeOxidationCleaningLayer: true,
|
|
28
|
+
includeLayers: ["top"],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
Bun.write(
|
|
32
|
+
"debug-output/oxidation-cleaning-basic.lbrn2",
|
|
33
|
+
project.getString(),
|
|
34
|
+
{ createPath: true },
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
const lbrnSvg = await generateLightBurnSvg(project)
|
|
38
|
+
|
|
39
|
+
expect(stackSvgsVertically([pcbSvg, lbrnSvg])).toMatchSvgSnapshot(
|
|
40
|
+
import.meta.filename,
|
|
41
|
+
)
|
|
42
|
+
})
|