circuit-json-to-lbrn 0.0.39 → 0.0.41

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 (27) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +388 -374
  3. package/lib/ConvertContext.ts +3 -0
  4. package/lib/element-handlers/addPcbVia/index.ts +11 -2
  5. package/lib/element-handlers/addPlatedHole/addCirclePlatedHole.ts +9 -3
  6. package/lib/element-handlers/addPlatedHole/addCircularHoleWithRectPad.ts +33 -30
  7. package/lib/element-handlers/addPlatedHole/addHoleWithPolygonPad.ts +13 -22
  8. package/lib/element-handlers/addPlatedHole/addOvalPlatedHole.ts +20 -4
  9. package/lib/element-handlers/addPlatedHole/addPillHoleWithRectPad.ts +32 -30
  10. package/lib/element-handlers/addPlatedHole/addPillPlatedHole.ts +21 -8
  11. package/lib/element-handlers/addPlatedHole/addRotatedPillHoleWithRectPad.ts +32 -30
  12. package/lib/element-handlers/addSmtPad/addCircleSmtPad.ts +33 -38
  13. package/lib/element-handlers/addSmtPad/addPillSmtPad.ts +27 -37
  14. package/lib/element-handlers/addSmtPad/addPolygonSmtPad.ts +9 -29
  15. package/lib/element-handlers/addSmtPad/addRectSmtPad.ts +29 -51
  16. package/lib/element-handlers/addSmtPad/addRotatedPillSmtPad.ts +27 -37
  17. package/lib/element-handlers/addSmtPad/addRotatedRectSmtPad.ts +27 -37
  18. package/lib/helpers/addCopperGeometryToNetOrProject.ts +48 -0
  19. package/lib/index.ts +3 -0
  20. package/package.json +1 -1
  21. package/tests/basics/soldermask-margin/__snapshots__/negative-soldermask-margin.snap.svg +1 -1
  22. package/tests/basics/soldermask-margin/__snapshots__/percent-soldermask-margin.snap.svg +8 -0
  23. package/tests/basics/soldermask-margin/percent-soldermask-margin.test.ts +90 -0
  24. package/tests/examples/example02/__snapshots__/example02.snap.svg +1 -1
  25. package/tests/examples/example04/1206x4_3216metric.json +2973 -0
  26. package/tests/examples/example04/__snapshots__/example04.snap.svg +1 -0
  27. package/tests/examples/example04/example04.test.ts +32 -0
@@ -2,7 +2,7 @@ import type { PcbSmtPadPill } from "circuit-json"
2
2
  import type { ConvertContext } from "../../ConvertContext"
3
3
  import { ShapePath } from "lbrnts"
4
4
  import { createPillPath } from "../../helpers/pillShape"
5
- import { pathToPolygon } from "../../helpers/pathToPolygon"
5
+ import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
6
6
 
7
7
  export const addPillSmtPad = (
8
8
  smtPad: PcbSmtPadPill,
@@ -10,16 +10,12 @@ export const addPillSmtPad = (
10
10
  ): void => {
11
11
  const {
12
12
  project,
13
- topCopperCutSetting,
14
- bottomCopperCutSetting,
15
13
  soldermaskCutSetting,
16
- topCutNetGeoms,
17
- bottomCutNetGeoms,
18
14
  origin,
19
15
  includeCopper,
20
16
  includeSoldermask,
21
- connMap,
22
17
  globalCopperSoldermaskMarginAdjustment,
18
+ solderMaskMarginPercent,
23
19
  includeLayers,
24
20
  } = ctx
25
21
 
@@ -32,11 +28,6 @@ export const addPillSmtPad = (
32
28
  return
33
29
  }
34
30
 
35
- // Select the correct cut setting and net geoms based on layer
36
- const copperCutSetting =
37
- padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
38
- const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
39
-
40
31
  const centerX = smtPad.x + origin.x
41
32
  const centerY = smtPad.y + origin.y
42
33
 
@@ -48,37 +39,36 @@ export const addPillSmtPad = (
48
39
  height: smtPad.height,
49
40
  })
50
41
 
51
- // Add to netGeoms for copper (will be merged with traces)
42
+ // Add to copper geometry (will be merged with traces if connected)
52
43
  if (includeCopper) {
53
- const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id)
54
- const polygon = pathToPolygon(outer.verts)
55
-
56
- if (netId) {
57
- // Add to netGeoms to be merged with other elements on the same net
58
- netGeoms.get(netId)?.push(polygon)
59
- } else {
60
- // No net connection - draw directly
61
- project.children.push(
62
- new ShapePath({
63
- cutIndex: copperCutSetting.index,
64
- verts: outer.verts,
65
- prims: outer.prims,
66
- isClosed: true,
67
- }),
68
- )
69
- }
44
+ addCopperGeometryToNetOrProject({
45
+ geometryId: smtPad.pcb_smtpad_id,
46
+ path: outer,
47
+ layer: padLayer,
48
+ ctx,
49
+ })
70
50
  }
71
51
 
72
52
  // Add soldermask opening if drawing soldermask
73
53
  if (includeSoldermask) {
74
- const smWidth =
75
- smtPad.width +
76
- 2 * globalCopperSoldermaskMarginAdjustment +
77
- (smtPad.soldermask_margin ?? 0)
78
- const smHeight =
79
- smtPad.height +
80
- 2 * globalCopperSoldermaskMarginAdjustment +
81
- (smtPad.soldermask_margin ?? 0)
54
+ // Percent margin is additive and may be negative.
55
+ // Absolute per-element margin and global adjustment are always applied.
56
+ const percentMarginX = (solderMaskMarginPercent / 100) * smtPad.width
57
+ const percentMarginY = (solderMaskMarginPercent / 100) * smtPad.height
58
+ const totalMarginX = Math.max(
59
+ globalCopperSoldermaskMarginAdjustment +
60
+ (smtPad.soldermask_margin ?? 0) +
61
+ percentMarginX,
62
+ -smtPad.width / 2,
63
+ )
64
+ const totalMarginY = Math.max(
65
+ globalCopperSoldermaskMarginAdjustment +
66
+ (smtPad.soldermask_margin ?? 0) +
67
+ percentMarginY,
68
+ -smtPad.height / 2,
69
+ )
70
+ const smWidth = smtPad.width + 2 * totalMarginX
71
+ const smHeight = smtPad.height + 2 * totalMarginY
82
72
  const smOuter = createPillPath({
83
73
  centerX,
84
74
  centerY,
@@ -2,7 +2,7 @@ import type { PcbSmtPadPolygon } from "circuit-json"
2
2
  import type { ConvertContext } from "../../ConvertContext"
3
3
  import { ShapePath } from "lbrnts"
4
4
  import { createPolygonPathFromOutline } from "../../helpers/polygonShape"
5
- import { pathToPolygon } from "../../helpers/pathToPolygon"
5
+ import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
6
6
  import { polygonToShapePathData } from "../../polygon-to-shape-path"
7
7
 
8
8
  export const addPolygonSmtPad = (
@@ -11,16 +11,12 @@ export const addPolygonSmtPad = (
11
11
  ): void => {
12
12
  const {
13
13
  project,
14
- topCopperCutSetting,
15
- bottomCopperCutSetting,
16
14
  soldermaskCutSetting,
17
- topCutNetGeoms,
18
- bottomCutNetGeoms,
19
15
  origin,
20
16
  includeCopper,
21
17
  includeSoldermask,
22
- connMap,
23
18
  globalCopperSoldermaskMarginAdjustment,
19
+ solderMaskMarginPercent,
24
20
  includeLayers,
25
21
  } = ctx
26
22
 
@@ -33,11 +29,6 @@ export const addPolygonSmtPad = (
33
29
  return
34
30
  }
35
31
 
36
- // Select the correct cut setting and net geoms based on layer
37
- const copperCutSetting =
38
- padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
39
- const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
40
-
41
32
  // Create the polygon pad
42
33
  if (smtPad.points.length >= 3) {
43
34
  const pad = createPolygonPathFromOutline({
@@ -46,25 +37,14 @@ export const addPolygonSmtPad = (
46
37
  offsetY: origin.y,
47
38
  })
48
39
 
49
- // Add to netGeoms for copper (will be merged with traces)
40
+ // Add to copper geometry (will be merged with traces if connected)
50
41
  if (includeCopper) {
51
- const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id)
52
- const polygon = pathToPolygon(pad.verts)
53
-
54
- if (netId) {
55
- // Add to netGeoms to be merged with other elements on the same net
56
- netGeoms.get(netId)?.push(polygon)
57
- } else {
58
- // No net connection - draw directly
59
- project.children.push(
60
- new ShapePath({
61
- cutIndex: copperCutSetting.index,
62
- verts: pad.verts,
63
- prims: pad.prims,
64
- isClosed: true,
65
- }),
66
- )
67
- }
42
+ addCopperGeometryToNetOrProject({
43
+ geometryId: smtPad.pcb_smtpad_id,
44
+ path: pad,
45
+ layer: padLayer,
46
+ ctx,
47
+ })
68
48
  }
69
49
 
70
50
  // Add soldermask opening if drawing soldermask
@@ -2,20 +2,17 @@ import { Box } from "@flatten-js/core"
2
2
  import type { ConvertContext } from "../../ConvertContext"
3
3
  import type { PcbSmtPadRect } from "circuit-json"
4
4
  import { ShapePath } from "lbrnts"
5
+ import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
5
6
 
6
7
  export const addRectSmtPad = (smtPad: PcbSmtPadRect, ctx: ConvertContext) => {
7
8
  const {
8
9
  project,
9
- topCopperCutSetting,
10
- bottomCopperCutSetting,
11
10
  soldermaskCutSetting,
12
- connMap,
13
- topCutNetGeoms,
14
- bottomCutNetGeoms,
15
11
  origin,
16
12
  includeCopper,
17
13
  includeSoldermask,
18
14
  globalCopperSoldermaskMarginAdjustment,
15
+ solderMaskMarginPercent,
19
16
  includeLayers,
20
17
  } = ctx
21
18
 
@@ -33,66 +30,47 @@ export const addRectSmtPad = (smtPad: PcbSmtPadRect, ctx: ConvertContext) => {
33
30
  const halfWidth = smtPad.width / 2
34
31
  const halfHeight = smtPad.height / 2
35
32
 
36
- const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id)
37
-
38
- // Select the correct cut setting and net geoms based on layer
39
- const copperCutSetting =
40
- padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
41
- const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
42
-
43
33
  // Only add to netGeoms if drawing copper
44
34
  if (includeCopper) {
45
- if (netId) {
46
- // Add to netGeoms to be merged with other elements on the same net
47
- netGeoms
48
- .get(netId)
49
- ?.push(
50
- new Box(
51
- centerX - halfWidth,
52
- centerY - halfHeight,
53
- centerX + halfWidth,
54
- centerY + halfHeight,
55
- ),
56
- )
57
- } else {
58
- // No net connection - draw directly
59
- const verts = [
35
+ const path = {
36
+ verts: [
60
37
  { x: centerX - halfWidth, y: centerY - halfHeight },
61
38
  { x: centerX + halfWidth, y: centerY - halfHeight },
62
39
  { x: centerX + halfWidth, y: centerY + halfHeight },
63
40
  { x: centerX - halfWidth, y: centerY + halfHeight },
64
41
  { x: centerX - halfWidth, y: centerY - halfHeight }, // Close the path
65
- ]
66
-
67
- const prims = [
68
- { type: 0 },
69
- { type: 0 },
70
- { type: 0 },
71
- { type: 0 },
72
- { type: 0 },
73
- ]
74
-
75
- project.children.push(
76
- new ShapePath({
77
- cutIndex: copperCutSetting.index,
78
- verts,
79
- prims,
80
- isClosed: true,
81
- }),
82
- )
42
+ ],
43
+ prims: [{ type: 0 }, { type: 0 }, { type: 0 }, { type: 0 }, { type: 0 }],
83
44
  }
45
+
46
+ addCopperGeometryToNetOrProject({
47
+ geometryId: smtPad.pcb_smtpad_id,
48
+ path,
49
+ layer: padLayer,
50
+ ctx,
51
+ })
84
52
  }
85
53
 
86
54
  // Add soldermask opening if drawing soldermask
87
55
  if (includeSoldermask) {
88
- const smHalfWidth =
89
- halfWidth +
56
+ // Percent margin is additive and may be negative.
57
+ // Absolute per-element margin and global adjustment are always applied.
58
+ const percentMarginX = (solderMaskMarginPercent / 100) * smtPad.width
59
+ const percentMarginY = (solderMaskMarginPercent / 100) * smtPad.height
60
+ const totalMarginX = Math.max(
90
61
  globalCopperSoldermaskMarginAdjustment +
91
- (smtPad.soldermask_margin ?? 0)
92
- const smHalfHeight =
93
- halfHeight +
62
+ (smtPad.soldermask_margin ?? 0) +
63
+ percentMarginX,
64
+ -smtPad.width / 2,
65
+ )
66
+ const totalMarginY = Math.max(
94
67
  globalCopperSoldermaskMarginAdjustment +
95
- (smtPad.soldermask_margin ?? 0)
68
+ (smtPad.soldermask_margin ?? 0) +
69
+ percentMarginY,
70
+ -smtPad.height / 2,
71
+ )
72
+ const smHalfWidth = halfWidth + totalMarginX
73
+ const smHalfHeight = halfHeight + totalMarginY
96
74
 
97
75
  const verts = [
98
76
  { x: centerX - smHalfWidth, y: centerY - smHalfHeight },
@@ -2,7 +2,7 @@ import type { PcbSmtPadRotatedPill } from "circuit-json"
2
2
  import type { ConvertContext } from "../../ConvertContext"
3
3
  import { ShapePath } from "lbrnts"
4
4
  import { createPillPath } from "../../helpers/pillShape"
5
- import { pathToPolygon } from "../../helpers/pathToPolygon"
5
+ import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
6
6
 
7
7
  export const addRotatedPillSmtPad = (
8
8
  smtPad: PcbSmtPadRotatedPill,
@@ -10,16 +10,12 @@ export const addRotatedPillSmtPad = (
10
10
  ): void => {
11
11
  const {
12
12
  project,
13
- topCopperCutSetting,
14
- bottomCopperCutSetting,
15
13
  soldermaskCutSetting,
16
- topCutNetGeoms,
17
- bottomCutNetGeoms,
18
14
  origin,
19
15
  includeCopper,
20
16
  includeSoldermask,
21
- connMap,
22
17
  globalCopperSoldermaskMarginAdjustment,
18
+ solderMaskMarginPercent,
23
19
  includeLayers,
24
20
  } = ctx
25
21
 
@@ -32,11 +28,6 @@ export const addRotatedPillSmtPad = (
32
28
  return
33
29
  }
34
30
 
35
- // Select the correct cut setting and net geoms based on layer
36
- const copperCutSetting =
37
- padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
38
- const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
39
-
40
31
  const centerX = smtPad.x + origin.x
41
32
  const centerY = smtPad.y + origin.y
42
33
 
@@ -49,37 +40,36 @@ export const addRotatedPillSmtPad = (
49
40
  rotation: (smtPad.ccw_rotation ?? 0) * (Math.PI / 180),
50
41
  })
51
42
 
52
- // Add to netGeoms for copper (will be merged with traces)
43
+ // Add to copper geometry (will be merged with traces if connected)
53
44
  if (includeCopper) {
54
- const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id)
55
- const polygon = pathToPolygon(outer.verts)
56
-
57
- if (netId) {
58
- // Add to netGeoms to be merged with other elements on the same net
59
- netGeoms.get(netId)?.push(polygon)
60
- } else {
61
- // No net connection - draw directly
62
- project.children.push(
63
- new ShapePath({
64
- cutIndex: copperCutSetting.index,
65
- verts: outer.verts,
66
- prims: outer.prims,
67
- isClosed: true,
68
- }),
69
- )
70
- }
45
+ addCopperGeometryToNetOrProject({
46
+ geometryId: smtPad.pcb_smtpad_id,
47
+ path: outer,
48
+ layer: padLayer,
49
+ ctx,
50
+ })
71
51
  }
72
52
 
73
53
  // Add soldermask opening if drawing soldermask
74
54
  if (includeSoldermask) {
75
- const smWidth =
76
- smtPad.width +
77
- 2 * globalCopperSoldermaskMarginAdjustment +
78
- (smtPad.soldermask_margin ?? 0)
79
- const smHeight =
80
- smtPad.height +
81
- 2 * globalCopperSoldermaskMarginAdjustment +
82
- (smtPad.soldermask_margin ?? 0)
55
+ // Percent margin is additive and may be negative.
56
+ // Absolute per-element margin and global adjustment are always applied.
57
+ const percentMarginX = (solderMaskMarginPercent / 100) * smtPad.width
58
+ const percentMarginY = (solderMaskMarginPercent / 100) * smtPad.height
59
+ const totalMarginX = Math.max(
60
+ globalCopperSoldermaskMarginAdjustment +
61
+ (smtPad.soldermask_margin ?? 0) +
62
+ percentMarginX,
63
+ -smtPad.width / 2,
64
+ )
65
+ const totalMarginY = Math.max(
66
+ globalCopperSoldermaskMarginAdjustment +
67
+ (smtPad.soldermask_margin ?? 0) +
68
+ percentMarginY,
69
+ -smtPad.height / 2,
70
+ )
71
+ const smWidth = smtPad.width + 2 * totalMarginX
72
+ const smHeight = smtPad.height + 2 * totalMarginY
83
73
  const smOuter = createPillPath({
84
74
  centerX,
85
75
  centerY,
@@ -2,7 +2,7 @@ import type { PcbSmtPadRotatedRect } from "circuit-json"
2
2
  import type { ConvertContext } from "../../ConvertContext"
3
3
  import { ShapePath } from "lbrnts"
4
4
  import { createRoundedRectPath } from "../../helpers/roundedRectShape"
5
- import { pathToPolygon } from "../../helpers/pathToPolygon"
5
+ import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
6
6
 
7
7
  export const addRotatedRectSmtPad = (
8
8
  smtPad: PcbSmtPadRotatedRect,
@@ -10,16 +10,12 @@ export const addRotatedRectSmtPad = (
10
10
  ): void => {
11
11
  const {
12
12
  project,
13
- topCopperCutSetting,
14
- bottomCopperCutSetting,
15
13
  soldermaskCutSetting,
16
- topCutNetGeoms,
17
- bottomCutNetGeoms,
18
14
  origin,
19
15
  includeCopper,
20
16
  includeSoldermask,
21
- connMap,
22
17
  globalCopperSoldermaskMarginAdjustment,
18
+ solderMaskMarginPercent,
23
19
  includeLayers,
24
20
  } = ctx
25
21
 
@@ -32,11 +28,6 @@ export const addRotatedRectSmtPad = (
32
28
  return
33
29
  }
34
30
 
35
- // Select the correct cut setting and net geoms based on layer
36
- const copperCutSetting =
37
- padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
38
- const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
39
-
40
31
  const centerX = smtPad.x + origin.x
41
32
  const centerY = smtPad.y + origin.y
42
33
  const rotation = (smtPad.ccw_rotation ?? 0) * (Math.PI / 180)
@@ -53,37 +44,36 @@ export const addRotatedRectSmtPad = (
53
44
  rotation,
54
45
  })
55
46
 
56
- // Add to netGeoms for copper (will be merged with traces)
47
+ // Add to copper geometry (will be merged with traces if connected)
57
48
  if (includeCopper) {
58
- const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id)
59
- const polygon = pathToPolygon(outer.verts)
60
-
61
- if (netId) {
62
- // Add to netGeoms to be merged with other elements on the same net
63
- netGeoms.get(netId)?.push(polygon)
64
- } else {
65
- // No net connection - draw directly
66
- project.children.push(
67
- new ShapePath({
68
- cutIndex: copperCutSetting.index,
69
- verts: outer.verts,
70
- prims: outer.prims,
71
- isClosed: true,
72
- }),
73
- )
74
- }
49
+ addCopperGeometryToNetOrProject({
50
+ geometryId: smtPad.pcb_smtpad_id,
51
+ path: outer,
52
+ layer: padLayer,
53
+ ctx,
54
+ })
75
55
  }
76
56
 
77
57
  // Add soldermask opening if drawing soldermask
78
58
  if (includeSoldermask) {
79
- const smWidth =
80
- smtPad.width +
81
- 2 * globalCopperSoldermaskMarginAdjustment +
82
- (smtPad.soldermask_margin ?? 0)
83
- const smHeight =
84
- smtPad.height +
85
- 2 * globalCopperSoldermaskMarginAdjustment +
86
- (smtPad.soldermask_margin ?? 0)
59
+ // Percent margin is additive and may be negative.
60
+ // Absolute per-element margin and global adjustment are always applied.
61
+ const percentMarginX = (solderMaskMarginPercent / 100) * smtPad.width
62
+ const percentMarginY = (solderMaskMarginPercent / 100) * smtPad.height
63
+ const totalMarginX = Math.max(
64
+ globalCopperSoldermaskMarginAdjustment +
65
+ (smtPad.soldermask_margin ?? 0) +
66
+ percentMarginX,
67
+ -smtPad.width / 2,
68
+ )
69
+ const totalMarginY = Math.max(
70
+ globalCopperSoldermaskMarginAdjustment +
71
+ (smtPad.soldermask_margin ?? 0) +
72
+ percentMarginY,
73
+ -smtPad.height / 2,
74
+ )
75
+ const smWidth = smtPad.width + 2 * totalMarginX
76
+ const smHeight = smtPad.height + 2 * totalMarginY
87
77
  const smOuter = createRoundedRectPath({
88
78
  centerX,
89
79
  centerY,
@@ -0,0 +1,48 @@
1
+ import type { ConvertContext } from "../ConvertContext"
2
+ import { ShapePath } from "lbrnts"
3
+ import { pathToPolygon } from "./pathToPolygon"
4
+
5
+ export const addCopperGeometryToNetOrProject = ({
6
+ geometryId,
7
+ path,
8
+ layer,
9
+ ctx,
10
+ }: {
11
+ geometryId: string
12
+ path: { verts: { x: number; y: number }[]; prims: Array<{ type: number }> }
13
+ layer: "top" | "bottom"
14
+ ctx: ConvertContext
15
+ }) => {
16
+ const {
17
+ project,
18
+ connMap,
19
+ topCutNetGeoms,
20
+ bottomCutNetGeoms,
21
+ topCopperCutSetting,
22
+ bottomCopperCutSetting,
23
+ includeLayers,
24
+ } = ctx
25
+
26
+ if (!includeLayers.includes(layer)) return
27
+
28
+ const netId = connMap.getNetConnectedToId(geometryId)
29
+ const cutSetting =
30
+ layer === "top" ? topCopperCutSetting : bottomCopperCutSetting
31
+ const netGeoms = layer === "top" ? topCutNetGeoms : bottomCutNetGeoms
32
+
33
+ if (netId) {
34
+ // Add to netGeoms for union with other elements on same net
35
+ const polygon = pathToPolygon(path.verts)
36
+ netGeoms.get(netId)?.push(polygon)
37
+ } else {
38
+ // No net connection - draw directly to project
39
+ project.children.push(
40
+ new ShapePath({
41
+ cutIndex: cutSetting.index,
42
+ verts: path.verts,
43
+ prims: path.prims,
44
+ isClosed: true,
45
+ }),
46
+ )
47
+ }
48
+ }
package/lib/index.ts CHANGED
@@ -24,6 +24,7 @@ export interface ConvertCircuitJsonToLbrnOptions {
24
24
  includeCopper?: boolean
25
25
  includeSoldermask?: boolean
26
26
  globalCopperSoldermaskMarginAdjustment?: number
27
+ solderMaskMarginPercent?: number
27
28
  includeLayers?: Array<"top" | "bottom">
28
29
  traceMargin?: number
29
30
  laserSpotSize?: number
@@ -60,6 +61,7 @@ export const convertCircuitJsonToLbrn = (
60
61
  const includeSoldermask = options.includeSoldermask ?? false
61
62
  const globalCopperSoldermaskMarginAdjustment =
62
63
  options.globalCopperSoldermaskMarginAdjustment ?? 0
64
+ const solderMaskMarginPercent = options.solderMaskMarginPercent ?? 0
63
65
  const laserProfile = options.laserProfile
64
66
 
65
67
  // Default laser settings from GitHub issue
@@ -198,6 +200,7 @@ export const convertCircuitJsonToLbrn = (
198
200
  laserSpotSize,
199
201
  topTraceClearanceAreaCutSetting,
200
202
  bottomTraceClearanceAreaCutSetting,
203
+ solderMaskMarginPercent,
201
204
  }
202
205
 
203
206
  // Initialize net geometry maps
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "circuit-json-to-lbrn",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.39",
4
+ "version": "0.0.41",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "bun run site/index.html",