circuit-json-to-lbrn 0.0.30 → 0.0.31

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 (39) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +46 -54
  3. package/lib/ConvertContext.ts +2 -2
  4. package/lib/element-handlers/addPcbCutout/addCirclePcbCutout.ts +0 -1
  5. package/lib/element-handlers/addPcbCutout/addPathPcbCutout.ts +0 -1
  6. package/lib/element-handlers/addPcbCutout/addPolygonPcbCutout.ts +0 -1
  7. package/lib/element-handlers/addPcbCutout/addRectPcbCutout.ts +0 -1
  8. package/lib/element-handlers/addPcbHole/addCirclePcbHole.ts +1 -2
  9. package/lib/element-handlers/addPcbHole/addOvalPcbHole.ts +2 -3
  10. package/lib/element-handlers/addPcbHole/addPillPcbHole.ts +2 -3
  11. package/lib/element-handlers/addPcbHole/addRectPcbHole.ts +2 -3
  12. package/lib/element-handlers/addPcbHole/addRotatedPillPcbHole.ts +2 -3
  13. package/lib/element-handlers/addPcbVia/index.ts +3 -2
  14. package/lib/element-handlers/addPlatedHole/addCirclePlatedHole.ts +5 -2
  15. package/lib/element-handlers/addPlatedHole/addCircularHoleWithRectPad.ts +9 -3
  16. package/lib/element-handlers/addPlatedHole/addHoleWithPolygonPad.ts +1 -1
  17. package/lib/element-handlers/addPlatedHole/addOvalPlatedHole.ts +4 -1
  18. package/lib/element-handlers/addPlatedHole/addPillHoleWithRectPad.ts +9 -3
  19. package/lib/element-handlers/addPlatedHole/addPillPlatedHole.ts +9 -3
  20. package/lib/element-handlers/addPlatedHole/addRotatedPillHoleWithRectPad.ts +9 -3
  21. package/lib/element-handlers/addSmtPad/addCircleSmtPad.ts +5 -2
  22. package/lib/element-handlers/addSmtPad/addPillSmtPad.ts +9 -3
  23. package/lib/element-handlers/addSmtPad/addPolygonSmtPad.ts +1 -1
  24. package/lib/element-handlers/addSmtPad/addRectSmtPad.ts +9 -3
  25. package/lib/element-handlers/addSmtPad/addRotatedPillSmtPad.ts +9 -3
  26. package/lib/element-handlers/addSmtPad/addRotatedRectSmtPad.ts +9 -3
  27. package/lib/index.ts +4 -3
  28. package/package.json +1 -1
  29. package/site/index.html +1 -1
  30. package/site/main.tsx +4 -3
  31. package/tests/basics/__snapshots__/mixed-soldermask-margins.snap.svg +8 -0
  32. package/tests/basics/addPcbCutout/pcb-cutout-circle.test.ts +1 -1
  33. package/tests/basics/addPcbHole/__snapshots__/pcb-hole-soldermask-margin.snap.svg +8 -0
  34. package/tests/basics/addPcbHole/pcb-hole-soldermask-margin.test.ts +63 -0
  35. package/tests/basics/addPcbHole/pcb-hole-with-soldermask.test.ts +1 -1
  36. package/tests/basics/addPcbVia/pcb-via-with-soldermask.test.ts +1 -1
  37. package/tests/basics/mixed-soldermask-margins.test.ts +111 -0
  38. package/tests/basics/soldermask-margin/negative-soldermask-margin.test.ts +1 -1
  39. package/tests/basics/soldermask-margin/positive-soldermask-margin.test.ts +1 -1
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ declare const convertCircuitJsonToLbrn: (circuitJson: CircuitJson, options?: {
10
10
  margin?: number;
11
11
  includeCopper?: boolean;
12
12
  includeSoldermask?: boolean;
13
- soldermaskMargin?: number;
13
+ globalCopperSoldermaskMarginAdjustment?: number;
14
14
  includeLayers?: Array<"top" | "bottom">;
15
15
  traceMargin?: number;
16
16
  laserSpotSize?: number;
package/dist/index.js CHANGED
@@ -61,7 +61,7 @@ var addCirclePlatedHole = (platedHole, ctx) => {
61
61
  includeCopper,
62
62
  includeSoldermask,
63
63
  connMap,
64
- soldermaskMargin,
64
+ globalCopperSoldermaskMarginAdjustment,
65
65
  includeLayers
66
66
  } = ctx;
67
67
  const centerX = platedHole.x + origin.x;
@@ -107,7 +107,7 @@ var addCirclePlatedHole = (platedHole, ctx) => {
107
107
  }
108
108
  }
109
109
  if (platedHole.outer_diameter > 0 && includeSoldermask) {
110
- const smRadius = platedHole.outer_diameter / 2 + soldermaskMargin;
110
+ const smRadius = platedHole.outer_diameter / 2 + globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
111
111
  const outer = createCirclePath({
112
112
  centerX,
113
113
  centerY,
@@ -188,7 +188,7 @@ var addOvalPlatedHole = (platedHole, ctx) => {
188
188
  origin,
189
189
  includeCopper,
190
190
  includeSoldermask,
191
- soldermaskMargin,
191
+ globalCopperSoldermaskMarginAdjustment,
192
192
  includeLayers
193
193
  } = ctx;
194
194
  if (platedHole.outer_width <= 0 || platedHole.outer_height <= 0) {
@@ -227,6 +227,7 @@ var addOvalPlatedHole = (platedHole, ctx) => {
227
227
  }
228
228
  }
229
229
  if (platedHole.outer_width > 0 && platedHole.outer_height > 0 && includeSoldermask) {
230
+ const soldermaskMargin = globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
230
231
  const smWidth = platedHole.outer_width + 2 * soldermaskMargin;
231
232
  const smHeight = platedHole.outer_height + 2 * soldermaskMargin;
232
233
  const outer = createOvalPath({
@@ -367,7 +368,7 @@ var addCircularHoleWithRectPad = (platedHole, ctx) => {
367
368
  origin,
368
369
  includeCopper,
369
370
  includeSoldermask,
370
- soldermaskMargin,
371
+ globalCopperSoldermaskMarginAdjustment,
371
372
  includeLayers
372
373
  } = ctx;
373
374
  const centerX = platedHole.x + origin.x;
@@ -406,8 +407,8 @@ var addCircularHoleWithRectPad = (platedHole, ctx) => {
406
407
  }
407
408
  }
408
409
  if (includeSoldermask) {
409
- const smPadWidth = padWidth + 2 * soldermaskMargin;
410
- const smPadHeight = padHeight + 2 * soldermaskMargin;
410
+ const smPadWidth = padWidth + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
411
+ const smPadHeight = padHeight + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
411
412
  const smPadPath = createRoundedRectPath({
412
413
  centerX,
413
414
  centerY,
@@ -552,7 +553,7 @@ var addPillHoleWithRectPad = (platedHole, ctx) => {
552
553
  origin,
553
554
  includeCopper,
554
555
  includeSoldermask,
555
- soldermaskMargin,
556
+ globalCopperSoldermaskMarginAdjustment,
556
557
  includeLayers
557
558
  } = ctx;
558
559
  const centerX = platedHole.x + origin.x;
@@ -591,8 +592,8 @@ var addPillHoleWithRectPad = (platedHole, ctx) => {
591
592
  }
592
593
  }
593
594
  if (includeSoldermask) {
594
- const smPadWidth = padWidth + 2 * soldermaskMargin;
595
- const smPadHeight = padHeight + 2 * soldermaskMargin;
595
+ const smPadWidth = padWidth + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
596
+ const smPadHeight = padHeight + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
596
597
  const smPadPath = createRoundedRectPath({
597
598
  centerX,
598
599
  centerY,
@@ -644,7 +645,7 @@ var addRotatedPillHoleWithRectPad = (platedHole, ctx) => {
644
645
  origin,
645
646
  includeCopper,
646
647
  includeSoldermask,
647
- soldermaskMargin,
648
+ globalCopperSoldermaskMarginAdjustment,
648
649
  includeLayers
649
650
  } = ctx;
650
651
  const centerX = platedHole.x + origin.x;
@@ -686,8 +687,8 @@ var addRotatedPillHoleWithRectPad = (platedHole, ctx) => {
686
687
  }
687
688
  }
688
689
  if (includeSoldermask) {
689
- const smPadWidth = padWidth + 2 * soldermaskMargin;
690
- const smPadHeight = padHeight + 2 * soldermaskMargin;
690
+ const smPadWidth = padWidth + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
691
+ const smPadHeight = padHeight + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
691
692
  const smPadPath = createRoundedRectPath({
692
693
  centerX,
693
694
  centerY,
@@ -766,7 +767,7 @@ var addHoleWithPolygonPad = (platedHole, ctx) => {
766
767
  origin,
767
768
  includeCopper,
768
769
  includeSoldermask,
769
- soldermaskMargin,
770
+ globalCopperSoldermaskMarginAdjustment,
770
771
  includeLayers
771
772
  } = ctx;
772
773
  if (platedHole.pad_outline.length >= 3 && includeCopper) {
@@ -860,7 +861,7 @@ var addPcbPlatedHolePill = (platedHole, ctx) => {
860
861
  origin,
861
862
  includeCopper,
862
863
  includeSoldermask,
863
- soldermaskMargin,
864
+ globalCopperSoldermaskMarginAdjustment,
864
865
  includeLayers
865
866
  } = ctx;
866
867
  const centerX = platedHole.x + origin.x;
@@ -896,8 +897,8 @@ var addPcbPlatedHolePill = (platedHole, ctx) => {
896
897
  }
897
898
  }
898
899
  if (platedHole.outer_width > 0 && platedHole.outer_height > 0 && includeSoldermask) {
899
- const smWidth = platedHole.outer_width + 2 * soldermaskMargin;
900
- const smHeight = platedHole.outer_height + 2 * soldermaskMargin;
900
+ const smWidth = platedHole.outer_width + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
901
+ const smHeight = platedHole.outer_height + 2 * globalCopperSoldermaskMarginAdjustment + (platedHole.soldermask_margin ?? 0);
901
902
  const outer = createPillPath({
902
903
  centerX,
903
904
  centerY,
@@ -971,7 +972,7 @@ var addRectSmtPad = (smtPad, ctx) => {
971
972
  origin,
972
973
  includeCopper,
973
974
  includeSoldermask,
974
- soldermaskMargin,
975
+ globalCopperSoldermaskMarginAdjustment,
975
976
  includeLayers
976
977
  } = ctx;
977
978
  const padLayer = smtPad.layer || "top";
@@ -1025,8 +1026,8 @@ var addRectSmtPad = (smtPad, ctx) => {
1025
1026
  }
1026
1027
  }
1027
1028
  if (includeSoldermask) {
1028
- const smHalfWidth = halfWidth + soldermaskMargin;
1029
- const smHalfHeight = halfHeight + soldermaskMargin;
1029
+ const smHalfWidth = halfWidth + globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1030
+ const smHalfHeight = halfHeight + globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1030
1031
  const verts = [
1031
1032
  { x: centerX - smHalfWidth, y: centerY - smHalfHeight },
1032
1033
  { x: centerX + smHalfWidth, y: centerY - smHalfHeight },
@@ -1068,7 +1069,7 @@ var addCircleSmtPad = (smtPad, ctx) => {
1068
1069
  includeCopper,
1069
1070
  includeSoldermask,
1070
1071
  connMap,
1071
- soldermaskMargin,
1072
+ globalCopperSoldermaskMarginAdjustment,
1072
1073
  includeLayers
1073
1074
  } = ctx;
1074
1075
  const padLayer = smtPad.layer || "top";
@@ -1107,7 +1108,7 @@ var addCircleSmtPad = (smtPad, ctx) => {
1107
1108
  }
1108
1109
  }
1109
1110
  if (includeSoldermask) {
1110
- const smRadius = outerRadius + soldermaskMargin;
1111
+ const smRadius = outerRadius + globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1111
1112
  const outer = createCirclePath({
1112
1113
  centerX,
1113
1114
  centerY,
@@ -1148,7 +1149,7 @@ var addPillSmtPad = (smtPad, ctx) => {
1148
1149
  includeCopper,
1149
1150
  includeSoldermask,
1150
1151
  connMap,
1151
- soldermaskMargin,
1152
+ globalCopperSoldermaskMarginAdjustment,
1152
1153
  includeLayers
1153
1154
  } = ctx;
1154
1155
  const padLayer = smtPad.layer || "top";
@@ -1186,8 +1187,8 @@ var addPillSmtPad = (smtPad, ctx) => {
1186
1187
  }
1187
1188
  }
1188
1189
  if (includeSoldermask) {
1189
- const smWidth = smtPad.width + 2 * soldermaskMargin;
1190
- const smHeight = smtPad.height + 2 * soldermaskMargin;
1190
+ const smWidth = smtPad.width + 2 * globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1191
+ const smHeight = smtPad.height + 2 * globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1191
1192
  const smOuter = createPillPath({
1192
1193
  centerX,
1193
1194
  centerY,
@@ -1220,7 +1221,7 @@ var addRotatedPillSmtPad = (smtPad, ctx) => {
1220
1221
  includeCopper,
1221
1222
  includeSoldermask,
1222
1223
  connMap,
1223
- soldermaskMargin,
1224
+ globalCopperSoldermaskMarginAdjustment,
1224
1225
  includeLayers
1225
1226
  } = ctx;
1226
1227
  const padLayer = smtPad.layer || "top";
@@ -1259,8 +1260,8 @@ var addRotatedPillSmtPad = (smtPad, ctx) => {
1259
1260
  }
1260
1261
  }
1261
1262
  if (includeSoldermask) {
1262
- const smWidth = smtPad.width + 2 * soldermaskMargin;
1263
- const smHeight = smtPad.height + 2 * soldermaskMargin;
1263
+ const smWidth = smtPad.width + 2 * globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1264
+ const smHeight = smtPad.height + 2 * globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1264
1265
  const smOuter = createPillPath({
1265
1266
  centerX,
1266
1267
  centerY,
@@ -1323,7 +1324,7 @@ var addPolygonSmtPad = (smtPad, ctx) => {
1323
1324
  includeCopper,
1324
1325
  includeSoldermask,
1325
1326
  connMap,
1326
- soldermaskMargin,
1327
+ globalCopperSoldermaskMarginAdjustment,
1327
1328
  includeLayers
1328
1329
  } = ctx;
1329
1330
  const padLayer = smtPad.layer || "top";
@@ -1384,7 +1385,7 @@ var addRotatedRectSmtPad = (smtPad, ctx) => {
1384
1385
  includeCopper,
1385
1386
  includeSoldermask,
1386
1387
  connMap,
1387
- soldermaskMargin,
1388
+ globalCopperSoldermaskMarginAdjustment,
1388
1389
  includeLayers
1389
1390
  } = ctx;
1390
1391
  const padLayer = smtPad.layer || "top";
@@ -1427,8 +1428,8 @@ var addRotatedRectSmtPad = (smtPad, ctx) => {
1427
1428
  }
1428
1429
  }
1429
1430
  if (includeSoldermask) {
1430
- const smWidth = smtPad.width + 2 * soldermaskMargin;
1431
- const smHeight = smtPad.height + 2 * soldermaskMargin;
1431
+ const smWidth = smtPad.width + 2 * globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1432
+ const smHeight = smtPad.height + 2 * globalCopperSoldermaskMarginAdjustment + (smtPad.soldermask_margin ?? 0);
1432
1433
  const smOuter = createRoundedRectPath({
1433
1434
  centerX,
1434
1435
  centerY,
@@ -1913,7 +1914,7 @@ var addPcbVia = (via, ctx) => {
1913
1914
  includeCopper,
1914
1915
  includeSoldermask,
1915
1916
  connMap,
1916
- soldermaskMargin,
1917
+ globalCopperSoldermaskMarginAdjustment,
1917
1918
  includeLayers
1918
1919
  } = ctx;
1919
1920
  const centerX = via.x + origin.x;
@@ -1960,7 +1961,7 @@ var addPcbVia = (via, ctx) => {
1960
1961
  }
1961
1962
  }
1962
1963
  if (via.outer_diameter > 0 && includeSoldermask) {
1963
- const smRadius = via.outer_diameter / 2 + soldermaskMargin;
1964
+ const smRadius = via.outer_diameter / 2 + globalCopperSoldermaskMarginAdjustment;
1964
1965
  const outer = createCirclePath({
1965
1966
  centerX,
1966
1967
  centerY,
@@ -2002,7 +2003,6 @@ var addCirclePcbHole = (hole, ctx) => {
2002
2003
  soldermaskCutSetting,
2003
2004
  origin,
2004
2005
  includeSoldermask,
2005
- soldermaskMargin,
2006
2006
  includeCopper
2007
2007
  } = ctx;
2008
2008
  const centerX = hole.x + origin.x;
@@ -2011,7 +2011,7 @@ var addCirclePcbHole = (hole, ctx) => {
2011
2011
  const soldermaskPath = createCirclePath({
2012
2012
  centerX,
2013
2013
  centerY,
2014
- radius: hole.hole_diameter / 2
2014
+ radius: hole.hole_diameter / 2 + (hole.soldermask_margin ?? 0)
2015
2015
  });
2016
2016
  project.children.push(
2017
2017
  new ShapePath16({
@@ -2049,7 +2049,6 @@ var addRectPcbHole = (hole, ctx) => {
2049
2049
  soldermaskCutSetting,
2050
2050
  origin,
2051
2051
  includeSoldermask,
2052
- soldermaskMargin,
2053
2052
  includeCopper
2054
2053
  } = ctx;
2055
2054
  const centerX = hole.x + origin.x;
@@ -2058,8 +2057,8 @@ var addRectPcbHole = (hole, ctx) => {
2058
2057
  const soldermaskPath = createRoundedRectPath({
2059
2058
  centerX,
2060
2059
  centerY,
2061
- width: hole.hole_width,
2062
- height: hole.hole_height,
2060
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
2061
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
2063
2062
  borderRadius: 0
2064
2063
  // no border radius for rect holes
2065
2064
  });
@@ -2101,7 +2100,6 @@ var addOvalPcbHole = (hole, ctx) => {
2101
2100
  soldermaskCutSetting,
2102
2101
  origin,
2103
2102
  includeSoldermask,
2104
- soldermaskMargin,
2105
2103
  includeCopper
2106
2104
  } = ctx;
2107
2105
  const centerX = hole.x + origin.x;
@@ -2110,8 +2108,8 @@ var addOvalPcbHole = (hole, ctx) => {
2110
2108
  const soldermaskPath = createOvalPath({
2111
2109
  centerX,
2112
2110
  centerY,
2113
- width: hole.hole_width,
2114
- height: hole.hole_height
2111
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
2112
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0)
2115
2113
  });
2116
2114
  project.children.push(
2117
2115
  new ShapePath18({
@@ -2149,7 +2147,6 @@ var addPillPcbHole = (hole, ctx) => {
2149
2147
  soldermaskCutSetting,
2150
2148
  origin,
2151
2149
  includeSoldermask,
2152
- soldermaskMargin,
2153
2150
  includeCopper
2154
2151
  } = ctx;
2155
2152
  const centerX = hole.x + origin.x;
@@ -2158,8 +2155,8 @@ var addPillPcbHole = (hole, ctx) => {
2158
2155
  const soldermaskPath = createPillPath({
2159
2156
  centerX,
2160
2157
  centerY,
2161
- width: hole.hole_width,
2162
- height: hole.hole_height
2158
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
2159
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0)
2163
2160
  });
2164
2161
  project.children.push(
2165
2162
  new ShapePath19({
@@ -2197,7 +2194,6 @@ var addRotatedPillPcbHole = (hole, ctx) => {
2197
2194
  soldermaskCutSetting,
2198
2195
  origin,
2199
2196
  includeSoldermask,
2200
- soldermaskMargin,
2201
2197
  includeCopper
2202
2198
  } = ctx;
2203
2199
  const centerX = hole.x + origin.x;
@@ -2207,8 +2203,8 @@ var addRotatedPillPcbHole = (hole, ctx) => {
2207
2203
  const soldermaskPath = createPillPath({
2208
2204
  centerX,
2209
2205
  centerY,
2210
- width: hole.hole_width,
2211
- height: hole.hole_height,
2206
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
2207
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
2212
2208
  rotation
2213
2209
  });
2214
2210
  project.children.push(
@@ -2268,7 +2264,6 @@ var addCirclePcbCutout = (cutout, ctx) => {
2268
2264
  origin,
2269
2265
  includeCopper,
2270
2266
  includeSoldermask,
2271
- soldermaskMargin,
2272
2267
  soldermaskCutSetting
2273
2268
  } = ctx;
2274
2269
  const centerX = cutout.center.x + origin.x;
@@ -2314,7 +2309,6 @@ var addRectPcbCutout = (cutout, ctx) => {
2314
2309
  origin,
2315
2310
  includeCopper,
2316
2311
  includeSoldermask,
2317
- soldermaskMargin,
2318
2312
  soldermaskCutSetting
2319
2313
  } = ctx;
2320
2314
  const centerX = cutout.center.x + origin.x;
@@ -2374,8 +2368,7 @@ var addPolygonPcbCutout = (cutout, ctx) => {
2374
2368
  origin,
2375
2369
  includeCopper,
2376
2370
  includeSoldermask,
2377
- soldermaskCutSetting,
2378
- soldermaskMargin
2371
+ soldermaskCutSetting
2379
2372
  } = ctx;
2380
2373
  if (cutout.points.length >= 3 && includeCopper) {
2381
2374
  const polygonPath = createPolygonPathFromOutline({
@@ -2418,7 +2411,6 @@ var addPathPcbCutout = (cutout, ctx) => {
2418
2411
  origin,
2419
2412
  includeCopper,
2420
2413
  includeSoldermask,
2421
- soldermaskMargin,
2422
2414
  soldermaskCutSetting
2423
2415
  } = ctx;
2424
2416
  if (cutout.route.length >= 2 && includeCopper) {
@@ -2651,7 +2643,7 @@ var convertCircuitJsonToLbrn = (circuitJson, options = {}) => {
2651
2643
  const laserSpotSize = options.laserSpotSize ?? 5e-3;
2652
2644
  const includeCopper = options.includeCopper ?? true;
2653
2645
  const includeSoldermask = options.includeSoldermask ?? false;
2654
- const soldermaskMargin = options.soldermaskMargin ?? 0;
2646
+ const globalCopperSoldermaskMarginAdjustment = options.globalCopperSoldermaskMarginAdjustment ?? 0;
2655
2647
  const laserProfile = options.laserProfile;
2656
2648
  const defaultCopperSettings = {
2657
2649
  speed: 300,
@@ -2763,7 +2755,7 @@ var convertCircuitJsonToLbrn = (circuitJson, options = {}) => {
2763
2755
  origin,
2764
2756
  includeCopper,
2765
2757
  includeSoldermask,
2766
- soldermaskMargin,
2758
+ globalCopperSoldermaskMarginAdjustment,
2767
2759
  includeLayers,
2768
2760
  traceMargin,
2769
2761
  laserSpotSize,
@@ -33,8 +33,8 @@ export interface ConvertContext {
33
33
  includeSoldermask: boolean
34
34
  includeLayers: Array<"top" | "bottom">
35
35
 
36
- // Soldermask margin (can be negative)
37
- soldermaskMargin: number
36
+ // Global copper soldermask margin adjustment (can be negative)
37
+ globalCopperSoldermaskMarginAdjustment: number
38
38
 
39
39
  // Trace margin for clearance zones
40
40
  traceMargin: number
@@ -17,7 +17,6 @@ export const addCirclePcbCutout = (
17
17
  origin,
18
18
  includeCopper,
19
19
  includeSoldermask,
20
- soldermaskMargin,
21
20
  soldermaskCutSetting,
22
21
  } = ctx
23
22
  const centerX = cutout.center.x + origin.x
@@ -16,7 +16,6 @@ export const addPathPcbCutout = (
16
16
  origin,
17
17
  includeCopper,
18
18
  includeSoldermask,
19
- soldermaskMargin,
20
19
  soldermaskCutSetting,
21
20
  } = ctx
22
21
 
@@ -18,7 +18,6 @@ export const addPolygonPcbCutout = (
18
18
  includeCopper,
19
19
  includeSoldermask,
20
20
  soldermaskCutSetting,
21
- soldermaskMargin,
22
21
  } = ctx
23
22
 
24
23
  // Add the cutout - cut through the board
@@ -17,7 +17,6 @@ export const addRectPcbCutout = (
17
17
  origin,
18
18
  includeCopper,
19
19
  includeSoldermask,
20
- soldermaskMargin,
21
20
  soldermaskCutSetting,
22
21
  } = ctx
23
22
  const centerX = cutout.center.x + origin.x
@@ -16,7 +16,6 @@ export const addCirclePcbHole = (
16
16
  soldermaskCutSetting,
17
17
  origin,
18
18
  includeSoldermask,
19
- soldermaskMargin,
20
19
  includeCopper,
21
20
  } = ctx
22
21
  const centerX = hole.x + origin.x
@@ -27,7 +26,7 @@ export const addCirclePcbHole = (
27
26
  const soldermaskPath = createCirclePath({
28
27
  centerX,
29
28
  centerY,
30
- radius: hole.hole_diameter / 2,
29
+ radius: hole.hole_diameter / 2 + (hole.soldermask_margin ?? 0),
31
30
  })
32
31
  project.children.push(
33
32
  new ShapePath({
@@ -16,7 +16,6 @@ export const addOvalPcbHole = (
16
16
  soldermaskCutSetting,
17
17
  origin,
18
18
  includeSoldermask,
19
- soldermaskMargin,
20
19
  includeCopper,
21
20
  } = ctx
22
21
  const centerX = hole.x + origin.x
@@ -27,8 +26,8 @@ export const addOvalPcbHole = (
27
26
  const soldermaskPath = createOvalPath({
28
27
  centerX,
29
28
  centerY,
30
- width: hole.hole_width,
31
- height: hole.hole_height,
29
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
30
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
32
31
  })
33
32
  project.children.push(
34
33
  new ShapePath({
@@ -16,7 +16,6 @@ export const addPillPcbHole = (
16
16
  soldermaskCutSetting,
17
17
  origin,
18
18
  includeSoldermask,
19
- soldermaskMargin,
20
19
  includeCopper,
21
20
  } = ctx
22
21
  const centerX = hole.x + origin.x
@@ -27,8 +26,8 @@ export const addPillPcbHole = (
27
26
  const soldermaskPath = createPillPath({
28
27
  centerX,
29
28
  centerY,
30
- width: hole.hole_width,
31
- height: hole.hole_height,
29
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
30
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
32
31
  })
33
32
  project.children.push(
34
33
  new ShapePath({
@@ -16,7 +16,6 @@ export const addRectPcbHole = (
16
16
  soldermaskCutSetting,
17
17
  origin,
18
18
  includeSoldermask,
19
- soldermaskMargin,
20
19
  includeCopper,
21
20
  } = ctx
22
21
  const centerX = hole.x + origin.x
@@ -27,8 +26,8 @@ export const addRectPcbHole = (
27
26
  const soldermaskPath = createRoundedRectPath({
28
27
  centerX,
29
28
  centerY,
30
- width: hole.hole_width,
31
- height: hole.hole_height,
29
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
30
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
32
31
  borderRadius: 0, // no border radius for rect holes
33
32
  })
34
33
  project.children.push(
@@ -16,7 +16,6 @@ export const addRotatedPillPcbHole = (
16
16
  soldermaskCutSetting,
17
17
  origin,
18
18
  includeSoldermask,
19
- soldermaskMargin,
20
19
  includeCopper,
21
20
  } = ctx
22
21
  const centerX = hole.x + origin.x
@@ -28,8 +27,8 @@ export const addRotatedPillPcbHole = (
28
27
  const soldermaskPath = createPillPath({
29
28
  centerX,
30
29
  centerY,
31
- width: hole.hole_width,
32
- height: hole.hole_height,
30
+ width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
31
+ height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
33
32
  rotation,
34
33
  })
35
34
  project.children.push(
@@ -19,7 +19,7 @@ export const addPcbVia = (via: PcbVia, ctx: ConvertContext): void => {
19
19
  includeCopper,
20
20
  includeSoldermask,
21
21
  connMap,
22
- soldermaskMargin,
22
+ globalCopperSoldermaskMarginAdjustment,
23
23
  includeLayers,
24
24
  } = ctx
25
25
  const centerX = via.x + origin.x
@@ -82,7 +82,8 @@ export const addPcbVia = (via: PcbVia, ctx: ConvertContext): void => {
82
82
 
83
83
  // Add soldermask opening if drawing soldermask
84
84
  if (via.outer_diameter > 0 && includeSoldermask) {
85
- const smRadius = via.outer_diameter / 2 + soldermaskMargin
85
+ const smRadius =
86
+ via.outer_diameter / 2 + globalCopperSoldermaskMarginAdjustment
86
87
  const outer = createCirclePath({
87
88
  centerX,
88
89
  centerY,
@@ -21,7 +21,7 @@ export const addCirclePlatedHole = (
21
21
  includeCopper,
22
22
  includeSoldermask,
23
23
  connMap,
24
- soldermaskMargin,
24
+ globalCopperSoldermaskMarginAdjustment,
25
25
  includeLayers,
26
26
  } = ctx
27
27
  const centerX = platedHole.x + origin.x
@@ -75,7 +75,10 @@ export const addCirclePlatedHole = (
75
75
 
76
76
  // Add soldermask opening if drawing soldermask
77
77
  if (platedHole.outer_diameter > 0 && includeSoldermask) {
78
- const smRadius = platedHole.outer_diameter / 2 + soldermaskMargin
78
+ const smRadius =
79
+ platedHole.outer_diameter / 2 +
80
+ globalCopperSoldermaskMarginAdjustment +
81
+ (platedHole.soldermask_margin ?? 0)
79
82
  const outer = createCirclePath({
80
83
  centerX,
81
84
  centerY,
@@ -17,7 +17,7 @@ export const addCircularHoleWithRectPad = (
17
17
  origin,
18
18
  includeCopper,
19
19
  includeSoldermask,
20
- soldermaskMargin,
20
+ globalCopperSoldermaskMarginAdjustment,
21
21
  includeLayers,
22
22
  } = ctx
23
23
  const centerX = platedHole.x + origin.x
@@ -63,8 +63,14 @@ export const addCircularHoleWithRectPad = (
63
63
 
64
64
  // Add soldermask opening if drawing soldermask
65
65
  if (includeSoldermask) {
66
- const smPadWidth = padWidth + 2 * soldermaskMargin
67
- const smPadHeight = padHeight + 2 * soldermaskMargin
66
+ const smPadWidth =
67
+ padWidth +
68
+ 2 * globalCopperSoldermaskMarginAdjustment +
69
+ (platedHole.soldermask_margin ?? 0)
70
+ const smPadHeight =
71
+ padHeight +
72
+ 2 * globalCopperSoldermaskMarginAdjustment +
73
+ (platedHole.soldermask_margin ?? 0)
68
74
  const smPadPath = createRoundedRectPath({
69
75
  centerX,
70
76
  centerY,
@@ -17,7 +17,7 @@ export const addHoleWithPolygonPad = (
17
17
  origin,
18
18
  includeCopper,
19
19
  includeSoldermask,
20
- soldermaskMargin,
20
+ globalCopperSoldermaskMarginAdjustment,
21
21
  includeLayers,
22
22
  } = ctx
23
23
 
@@ -16,7 +16,7 @@ export const addOvalPlatedHole = (
16
16
  origin,
17
17
  includeCopper,
18
18
  includeSoldermask,
19
- soldermaskMargin,
19
+ globalCopperSoldermaskMarginAdjustment,
20
20
  includeLayers,
21
21
  } = ctx
22
22
 
@@ -70,6 +70,9 @@ export const addOvalPlatedHole = (
70
70
  platedHole.outer_height > 0 &&
71
71
  includeSoldermask
72
72
  ) {
73
+ const soldermaskMargin =
74
+ globalCopperSoldermaskMarginAdjustment +
75
+ (platedHole.soldermask_margin ?? 0)
73
76
  const smWidth = platedHole.outer_width + 2 * soldermaskMargin
74
77
  const smHeight = platedHole.outer_height + 2 * soldermaskMargin
75
78
  const outer = createOvalPath({
@@ -17,7 +17,7 @@ export const addPillHoleWithRectPad = (
17
17
  origin,
18
18
  includeCopper,
19
19
  includeSoldermask,
20
- soldermaskMargin,
20
+ globalCopperSoldermaskMarginAdjustment,
21
21
  includeLayers,
22
22
  } = ctx
23
23
  const centerX = platedHole.x + origin.x
@@ -63,8 +63,14 @@ export const addPillHoleWithRectPad = (
63
63
 
64
64
  // Add soldermask opening if drawing soldermask
65
65
  if (includeSoldermask) {
66
- const smPadWidth = padWidth + 2 * soldermaskMargin
67
- const smPadHeight = padHeight + 2 * soldermaskMargin
66
+ const smPadWidth =
67
+ padWidth +
68
+ 2 * globalCopperSoldermaskMarginAdjustment +
69
+ (platedHole.soldermask_margin ?? 0)
70
+ const smPadHeight =
71
+ padHeight +
72
+ 2 * globalCopperSoldermaskMarginAdjustment +
73
+ (platedHole.soldermask_margin ?? 0)
68
74
  const smPadPath = createRoundedRectPath({
69
75
  centerX,
70
76
  centerY,