circuit-json-to-lbrn 0.0.19 → 0.0.21

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 (31) hide show
  1. package/dist/index.js +296 -164
  2. package/lib/element-handlers/addPcbCutout/addCirclePcbCutout.ts +10 -2
  3. package/lib/element-handlers/addPcbCutout/addPolygonPcbCutout.ts +10 -6
  4. package/lib/element-handlers/addPcbCutout/addRectPcbCutout.ts +12 -12
  5. package/lib/element-handlers/addPcbHole/addCirclePcbHole.ts +10 -2
  6. package/lib/element-handlers/addPcbHole/addOvalPcbHole.ts +8 -8
  7. package/lib/element-handlers/addPcbHole/addPillPcbHole.ts +8 -8
  8. package/lib/element-handlers/addPcbHole/addRectPcbHole.ts +10 -10
  9. package/lib/element-handlers/addPcbHole/addRotatedPillPcbHole.ts +8 -8
  10. package/lib/element-handlers/addPcbVia/index.ts +15 -3
  11. package/lib/element-handlers/addPlatedHole/addCirclePlatedHole.ts +15 -3
  12. package/lib/element-handlers/addPlatedHole/addCircularHoleWithRectPad.ts +14 -9
  13. package/lib/element-handlers/addPlatedHole/addHoleWithPolygonPad.ts +17 -7
  14. package/lib/element-handlers/addPlatedHole/addOvalPlatedHole.ts +15 -9
  15. package/lib/element-handlers/addPlatedHole/addPillHoleWithRectPad.ts +14 -14
  16. package/lib/element-handlers/addPlatedHole/addPillPlatedHole.ts +15 -9
  17. package/lib/element-handlers/addPlatedHole/addRotatedPillHoleWithRectPad.ts +19 -19
  18. package/lib/element-handlers/addSmtPad/addCircleSmtPad.ts +10 -2
  19. package/lib/element-handlers/addSmtPad/addPillSmtPad.ts +12 -2
  20. package/lib/element-handlers/addSmtPad/addPolygonSmtPad.ts +5 -1
  21. package/lib/element-handlers/addSmtPad/addRotatedPillSmtPad.ts +10 -10
  22. package/lib/element-handlers/addSmtPad/addRotatedRectSmtPad.ts +11 -11
  23. package/lib/helpers/circleShape.ts +13 -6
  24. package/lib/helpers/ovalShape.ts +17 -8
  25. package/lib/helpers/pathPointUtils.ts +11 -5
  26. package/lib/helpers/pillShape.ts +24 -11
  27. package/lib/helpers/polygonShape.ts +11 -5
  28. package/lib/helpers/roundedRectShape.ts +19 -9
  29. package/package.json +1 -1
  30. package/tests/examples/addSmtPad/__snapshots__/rotatedRectSmtPad.snap.svg +4 -4
  31. package/tests/examples/addSmtPad/rotatedRectSmtPad.test.ts +15 -3
package/dist/index.js CHANGED
@@ -6,7 +6,12 @@ import { cju as cju2 } from "@tscircuit/circuit-json-util";
6
6
  import { ShapePath } from "lbrnts";
7
7
 
8
8
  // lib/helpers/circleShape.ts
9
- var createCirclePath = (centerX, centerY, radius, segments = 64) => {
9
+ var createCirclePath = ({
10
+ centerX,
11
+ centerY,
12
+ radius,
13
+ segments = 64
14
+ }) => {
10
15
  const verts = [];
11
16
  const prims = [];
12
17
  for (let i = 0; i < segments; i++) {
@@ -65,7 +70,11 @@ var addCirclePlatedHole = (platedHole, ctx) => {
65
70
  if (netId) {
66
71
  ctx.netGeoms.get(netId)?.push(polygon);
67
72
  } else {
68
- const outer = createCirclePath(centerX, centerY, outerRadius);
73
+ const outer = createCirclePath({
74
+ centerX,
75
+ centerY,
76
+ radius: outerRadius
77
+ });
69
78
  project.children.push(
70
79
  new ShapePath({
71
80
  cutIndex: copperCutSetting.index,
@@ -78,7 +87,11 @@ var addCirclePlatedHole = (platedHole, ctx) => {
78
87
  }
79
88
  if (platedHole.outer_diameter > 0 && includeSoldermask) {
80
89
  const smRadius = platedHole.outer_diameter / 2 + soldermaskMargin;
81
- const outer = createCirclePath(centerX, centerY, smRadius);
90
+ const outer = createCirclePath({
91
+ centerX,
92
+ centerY,
93
+ radius: smRadius
94
+ });
82
95
  project.children.push(
83
96
  new ShapePath({
84
97
  cutIndex: soldermaskCutSetting.index,
@@ -90,7 +103,11 @@ var addCirclePlatedHole = (platedHole, ctx) => {
90
103
  }
91
104
  if (platedHole.hole_diameter > 0 && includeCopper) {
92
105
  const innerRadius = platedHole.hole_diameter / 2;
93
- const inner = createCirclePath(centerX, centerY, innerRadius);
106
+ const inner = createCirclePath({
107
+ centerX,
108
+ centerY,
109
+ radius: innerRadius
110
+ });
94
111
  project.children.push(
95
112
  new ShapePath({
96
113
  cutIndex: throughBoardCutSetting.index,
@@ -106,7 +123,14 @@ var addCirclePlatedHole = (platedHole, ctx) => {
106
123
  import { ShapePath as ShapePath2 } from "lbrnts";
107
124
 
108
125
  // lib/helpers/ovalShape.ts
109
- var createOvalPath = (centerX, centerY, width, height, rotation = 0, segments = 64) => {
126
+ var createOvalPath = ({
127
+ centerX,
128
+ centerY,
129
+ width,
130
+ height,
131
+ rotation = 0,
132
+ segments = 64
133
+ }) => {
110
134
  const verts = [];
111
135
  const prims = [];
112
136
  const radiusX = width / 2;
@@ -151,13 +175,13 @@ var addOvalPlatedHole = (platedHole, ctx) => {
151
175
  const centerY = platedHole.y + origin.y;
152
176
  const rotation = (platedHole.ccw_rotation ?? 0) * (Math.PI / 180);
153
177
  if (platedHole.outer_width > 0 && platedHole.outer_height > 0 && includeCopper) {
154
- const outer = createOvalPath(
178
+ const outer = createOvalPath({
155
179
  centerX,
156
180
  centerY,
157
- platedHole.outer_width,
158
- platedHole.outer_height,
181
+ width: platedHole.outer_width,
182
+ height: platedHole.outer_height,
159
183
  rotation
160
- );
184
+ });
161
185
  project.children.push(
162
186
  new ShapePath2({
163
187
  cutIndex: copperCutSetting.index,
@@ -170,7 +194,13 @@ var addOvalPlatedHole = (platedHole, ctx) => {
170
194
  if (platedHole.outer_width > 0 && platedHole.outer_height > 0 && includeSoldermask) {
171
195
  const smWidth = platedHole.outer_width + 2 * soldermaskMargin;
172
196
  const smHeight = platedHole.outer_height + 2 * soldermaskMargin;
173
- const outer = createOvalPath(centerX, centerY, smWidth, smHeight, rotation);
197
+ const outer = createOvalPath({
198
+ centerX,
199
+ centerY,
200
+ width: smWidth,
201
+ height: smHeight,
202
+ rotation
203
+ });
174
204
  project.children.push(
175
205
  new ShapePath2({
176
206
  cutIndex: soldermaskCutSetting.index,
@@ -181,13 +211,13 @@ var addOvalPlatedHole = (platedHole, ctx) => {
181
211
  );
182
212
  }
183
213
  if (platedHole.hole_width > 0 && platedHole.hole_height > 0 && includeCopper) {
184
- const inner = createOvalPath(
214
+ const inner = createOvalPath({
185
215
  centerX,
186
216
  centerY,
187
- platedHole.hole_width,
188
- platedHole.hole_height,
217
+ width: platedHole.hole_width,
218
+ height: platedHole.hole_height,
189
219
  rotation
190
- );
220
+ });
191
221
  project.children.push(
192
222
  new ShapePath2({
193
223
  cutIndex: throughBoardCutSetting.index,
@@ -203,7 +233,15 @@ var addOvalPlatedHole = (platedHole, ctx) => {
203
233
  import { ShapePath as ShapePath3 } from "lbrnts";
204
234
 
205
235
  // lib/helpers/roundedRectShape.ts
206
- var createRoundedRectPath = (centerX, centerY, width, height, borderRadius = 0, segments = 4, rotation = 0) => {
236
+ var createRoundedRectPath = ({
237
+ centerX,
238
+ centerY,
239
+ width,
240
+ height,
241
+ borderRadius = 0,
242
+ segments = 4,
243
+ rotation = 0
244
+ }) => {
207
245
  const verts = [];
208
246
  const prims = [];
209
247
  const halfWidth = width / 2;
@@ -301,13 +339,13 @@ var addCircularHoleWithRectPad = (platedHole, ctx) => {
301
339
  const padWidth = platedHole.rect_pad_width;
302
340
  const padHeight = platedHole.rect_pad_height;
303
341
  const borderRadius = platedHole.rect_border_radius ?? 0;
304
- const padPath = createRoundedRectPath(
342
+ const padPath = createRoundedRectPath({
305
343
  centerX,
306
344
  centerY,
307
- padWidth,
308
- padHeight,
345
+ width: padWidth,
346
+ height: padHeight,
309
347
  borderRadius
310
- );
348
+ });
311
349
  if (includeCopper) {
312
350
  project.children.push(
313
351
  new ShapePath3({
@@ -321,13 +359,13 @@ var addCircularHoleWithRectPad = (platedHole, ctx) => {
321
359
  if (includeSoldermask) {
322
360
  const smPadWidth = padWidth + 2 * soldermaskMargin;
323
361
  const smPadHeight = padHeight + 2 * soldermaskMargin;
324
- const smPadPath = createRoundedRectPath(
362
+ const smPadPath = createRoundedRectPath({
325
363
  centerX,
326
364
  centerY,
327
- smPadWidth,
328
- smPadHeight,
365
+ width: smPadWidth,
366
+ height: smPadHeight,
329
367
  borderRadius
330
- );
368
+ });
331
369
  project.children.push(
332
370
  new ShapePath3({
333
371
  cutIndex: soldermaskCutSetting.index,
@@ -340,7 +378,12 @@ var addCircularHoleWithRectPad = (platedHole, ctx) => {
340
378
  if (holeRadius > 0 && includeCopper) {
341
379
  const holeCenterX = centerX + platedHole.hole_offset_x;
342
380
  const holeCenterY = centerY + platedHole.hole_offset_y;
343
- const holePath = createCirclePath(holeCenterX, holeCenterY, holeRadius, 32);
381
+ const holePath = createCirclePath({
382
+ centerX: holeCenterX,
383
+ centerY: holeCenterY,
384
+ radius: holeRadius,
385
+ segments: 32
386
+ });
344
387
  project.children.push(
345
388
  new ShapePath3({
346
389
  cutIndex: throughBoardCutSetting.index,
@@ -356,7 +399,11 @@ var addCircularHoleWithRectPad = (platedHole, ctx) => {
356
399
  import { ShapePath as ShapePath4 } from "lbrnts";
357
400
 
358
401
  // lib/helpers/pathPointUtils.ts
359
- var createPointAdder = (verts, prims, options = {}) => {
402
+ var createPointAdder = ({
403
+ verts,
404
+ prims,
405
+ options = {}
406
+ }) => {
360
407
  const { rotation = 0, rotationCenter, translation } = options;
361
408
  const cos = Math.cos(rotation);
362
409
  const sin = Math.sin(rotation);
@@ -380,16 +427,27 @@ var createPointAdder = (verts, prims, options = {}) => {
380
427
  };
381
428
 
382
429
  // lib/helpers/pillShape.ts
383
- var createPillPath = (centerX, centerY, width, height, rotation = 0, segments = 32) => {
430
+ var createPillPath = ({
431
+ centerX,
432
+ centerY,
433
+ width,
434
+ height,
435
+ rotation = 0,
436
+ segments = 32
437
+ }) => {
384
438
  const verts = [];
385
439
  const prims = [];
386
440
  const halfWidth = width / 2;
387
441
  const halfHeight = height / 2;
388
442
  const radius = Math.min(halfWidth, halfHeight);
389
443
  const isVertical = height > width;
390
- const addPoint = createPointAdder(verts, prims, {
391
- rotation,
392
- rotationCenter: { x: centerX, y: centerY }
444
+ const addPoint = createPointAdder({
445
+ verts,
446
+ prims,
447
+ options: {
448
+ rotation,
449
+ rotationCenter: { x: centerX, y: centerY }
450
+ }
393
451
  });
394
452
  if (isVertical) {
395
453
  const capOffset = halfHeight - radius;
@@ -452,13 +510,13 @@ var addPillHoleWithRectPad = (platedHole, ctx) => {
452
510
  const padHeight = platedHole.rect_pad_height;
453
511
  const borderRadius = platedHole.rect_border_radius ?? 0;
454
512
  if (padWidth > 0 && padHeight > 0) {
455
- const padPath = createRoundedRectPath(
513
+ const padPath = createRoundedRectPath({
456
514
  centerX,
457
515
  centerY,
458
- padWidth,
459
- padHeight,
516
+ width: padWidth,
517
+ height: padHeight,
460
518
  borderRadius
461
- );
519
+ });
462
520
  if (includeCopper) {
463
521
  project.children.push(
464
522
  new ShapePath4({
@@ -472,13 +530,13 @@ var addPillHoleWithRectPad = (platedHole, ctx) => {
472
530
  if (includeSoldermask) {
473
531
  const smPadWidth = padWidth + 2 * soldermaskMargin;
474
532
  const smPadHeight = padHeight + 2 * soldermaskMargin;
475
- const smPadPath = createRoundedRectPath(
533
+ const smPadPath = createRoundedRectPath({
476
534
  centerX,
477
535
  centerY,
478
- smPadWidth,
479
- smPadHeight,
536
+ width: smPadWidth,
537
+ height: smPadHeight,
480
538
  borderRadius
481
- );
539
+ });
482
540
  project.children.push(
483
541
  new ShapePath4({
484
542
  cutIndex: soldermaskCutSetting.index,
@@ -494,12 +552,12 @@ var addPillHoleWithRectPad = (platedHole, ctx) => {
494
552
  if (holeWidth > 0 && holeHeight > 0 && includeCopper) {
495
553
  const holeCenterX = centerX + platedHole.hole_offset_x;
496
554
  const holeCenterY = centerY + platedHole.hole_offset_y;
497
- const holePath = createPillPath(
498
- holeCenterX,
499
- holeCenterY,
500
- holeWidth,
501
- holeHeight
502
- );
555
+ const holePath = createPillPath({
556
+ centerX: holeCenterX,
557
+ centerY: holeCenterY,
558
+ width: holeWidth,
559
+ height: holeHeight
560
+ });
503
561
  project.children.push(
504
562
  new ShapePath4({
505
563
  cutIndex: throughBoardCutSetting.index,
@@ -531,15 +589,15 @@ var addRotatedPillHoleWithRectPad = (platedHole, ctx) => {
531
589
  const borderRadius = platedHole.rect_border_radius ?? 0;
532
590
  const padRotation = (platedHole.rect_ccw_rotation ?? 0) * (Math.PI / 180);
533
591
  if (padWidth > 0 && padHeight > 0) {
534
- const padPath = createRoundedRectPath(
592
+ const padPath = createRoundedRectPath({
535
593
  centerX,
536
594
  centerY,
537
- padWidth,
538
- padHeight,
595
+ width: padWidth,
596
+ height: padHeight,
539
597
  borderRadius,
540
- 4,
541
- padRotation
542
- );
598
+ segments: 4,
599
+ rotation: padRotation
600
+ });
543
601
  if (includeCopper) {
544
602
  project.children.push(
545
603
  new ShapePath5({
@@ -553,15 +611,15 @@ var addRotatedPillHoleWithRectPad = (platedHole, ctx) => {
553
611
  if (includeSoldermask) {
554
612
  const smPadWidth = padWidth + 2 * soldermaskMargin;
555
613
  const smPadHeight = padHeight + 2 * soldermaskMargin;
556
- const smPadPath = createRoundedRectPath(
614
+ const smPadPath = createRoundedRectPath({
557
615
  centerX,
558
616
  centerY,
559
- smPadWidth,
560
- smPadHeight,
617
+ width: smPadWidth,
618
+ height: smPadHeight,
561
619
  borderRadius,
562
- 4,
563
- padRotation
564
- );
620
+ segments: 4,
621
+ rotation: padRotation
622
+ });
565
623
  project.children.push(
566
624
  new ShapePath5({
567
625
  cutIndex: soldermaskCutSetting.index,
@@ -578,13 +636,13 @@ var addRotatedPillHoleWithRectPad = (platedHole, ctx) => {
578
636
  if (holeWidth > 0 && holeHeight > 0 && includeCopper) {
579
637
  const holeCenterX = centerX + platedHole.hole_offset_x;
580
638
  const holeCenterY = centerY + platedHole.hole_offset_y;
581
- const holePath = createPillPath(
582
- holeCenterX,
583
- holeCenterY,
584
- holeWidth,
585
- holeHeight,
586
- holeRotation
587
- );
639
+ const holePath = createPillPath({
640
+ centerX: holeCenterX,
641
+ centerY: holeCenterY,
642
+ width: holeWidth,
643
+ height: holeHeight,
644
+ rotation: holeRotation
645
+ });
588
646
  project.children.push(
589
647
  new ShapePath5({
590
648
  cutIndex: throughBoardCutSetting.index,
@@ -600,7 +658,11 @@ var addRotatedPillHoleWithRectPad = (platedHole, ctx) => {
600
658
  import { ShapePath as ShapePath6 } from "lbrnts";
601
659
 
602
660
  // lib/helpers/polygonShape.ts
603
- var createPolygonPathFromOutline = (outline, offsetX, offsetY) => {
661
+ var createPolygonPathFromOutline = ({
662
+ outline,
663
+ offsetX,
664
+ offsetY
665
+ }) => {
604
666
  const verts = [];
605
667
  for (const point6 of outline) {
606
668
  const x = (point6.x ?? 0) + offsetX;
@@ -629,11 +691,11 @@ var addHoleWithPolygonPad = (platedHole, ctx) => {
629
691
  soldermaskMargin
630
692
  } = ctx;
631
693
  if (platedHole.pad_outline.length >= 3 && includeCopper) {
632
- const pad = createPolygonPathFromOutline(
633
- platedHole.pad_outline,
634
- platedHole.x + origin.x,
635
- platedHole.y + origin.y
636
- );
694
+ const pad = createPolygonPathFromOutline({
695
+ outline: platedHole.pad_outline,
696
+ offsetX: platedHole.x + origin.x,
697
+ offsetY: platedHole.y + origin.y
698
+ });
637
699
  if (includeCopper) {
638
700
  project.children.push(
639
701
  new ShapePath6({
@@ -659,7 +721,12 @@ var addHoleWithPolygonPad = (platedHole, ctx) => {
659
721
  const centerX = platedHole.x + platedHole.hole_offset_x + origin.x;
660
722
  const centerY = platedHole.y + platedHole.hole_offset_y + origin.y;
661
723
  const radius = platedHole.hole_diameter / 2;
662
- const hole = createCirclePath(centerX, centerY, radius, 64);
724
+ const hole = createCirclePath({
725
+ centerX,
726
+ centerY,
727
+ radius,
728
+ segments: 64
729
+ });
663
730
  project.children.push(
664
731
  new ShapePath6({
665
732
  cutIndex: throughBoardCutSetting.index,
@@ -673,7 +740,12 @@ var addHoleWithPolygonPad = (platedHole, ctx) => {
673
740
  const centerX = platedHole.x + platedHole.hole_offset_x + origin.x;
674
741
  const centerY = platedHole.y + platedHole.hole_offset_y + origin.y;
675
742
  const radius = platedHole.hole_diameter / 2;
676
- const hole = createCirclePath(centerX, centerY, radius, 64);
743
+ const hole = createCirclePath({
744
+ centerX,
745
+ centerY,
746
+ radius,
747
+ segments: 64
748
+ });
677
749
  project.children.push(
678
750
  new ShapePath6({
679
751
  cutIndex: throughBoardCutSetting.index,
@@ -702,13 +774,13 @@ var addPcbPlatedHolePill = (platedHole, ctx) => {
702
774
  const centerY = platedHole.y + origin.y;
703
775
  const rotation = (platedHole.ccw_rotation || 0) * (Math.PI / 180);
704
776
  if (platedHole.outer_width > 0 && platedHole.outer_height > 0 && includeCopper) {
705
- const outer = createPillPath(
777
+ const outer = createPillPath({
706
778
  centerX,
707
779
  centerY,
708
- platedHole.outer_width,
709
- platedHole.outer_height,
780
+ width: platedHole.outer_width,
781
+ height: platedHole.outer_height,
710
782
  rotation
711
- );
783
+ });
712
784
  project.children.push(
713
785
  new ShapePath7({
714
786
  cutIndex: copperCutSetting.index,
@@ -721,7 +793,13 @@ var addPcbPlatedHolePill = (platedHole, ctx) => {
721
793
  if (platedHole.outer_width > 0 && platedHole.outer_height > 0 && includeSoldermask) {
722
794
  const smWidth = platedHole.outer_width + 2 * soldermaskMargin;
723
795
  const smHeight = platedHole.outer_height + 2 * soldermaskMargin;
724
- const outer = createPillPath(centerX, centerY, smWidth, smHeight, rotation);
796
+ const outer = createPillPath({
797
+ centerX,
798
+ centerY,
799
+ width: smWidth,
800
+ height: smHeight,
801
+ rotation
802
+ });
725
803
  project.children.push(
726
804
  new ShapePath7({
727
805
  cutIndex: soldermaskCutSetting.index,
@@ -732,13 +810,13 @@ var addPcbPlatedHolePill = (platedHole, ctx) => {
732
810
  );
733
811
  }
734
812
  if (platedHole.hole_width > 0 && platedHole.hole_height > 0 && includeCopper) {
735
- const inner = createPillPath(
813
+ const inner = createPillPath({
736
814
  centerX,
737
815
  centerY,
738
- platedHole.hole_width,
739
- platedHole.hole_height,
816
+ width: platedHole.hole_width,
817
+ height: platedHole.hole_height,
740
818
  rotation
741
- );
819
+ });
742
820
  project.children.push(
743
821
  new ShapePath7({
744
822
  cutIndex: throughBoardCutSetting.index,
@@ -883,7 +961,11 @@ var addCircleSmtPad = (smtPad, ctx) => {
883
961
  if (netId) {
884
962
  ctx.netGeoms.get(netId)?.push(polygon);
885
963
  } else {
886
- const outer = createCirclePath(centerX, centerY, outerRadius);
964
+ const outer = createCirclePath({
965
+ centerX,
966
+ centerY,
967
+ radius: outerRadius
968
+ });
887
969
  project.children.push(
888
970
  new ShapePath9({
889
971
  cutIndex: copperCutSetting.index,
@@ -896,7 +978,11 @@ var addCircleSmtPad = (smtPad, ctx) => {
896
978
  }
897
979
  if (includeSoldermask) {
898
980
  const smRadius = outerRadius + soldermaskMargin;
899
- const outer = createCirclePath(centerX, centerY, smRadius);
981
+ const outer = createCirclePath({
982
+ centerX,
983
+ centerY,
984
+ radius: smRadius
985
+ });
900
986
  project.children.push(
901
987
  new ShapePath9({
902
988
  cutIndex: soldermaskCutSetting.index,
@@ -934,7 +1020,12 @@ var addPillSmtPad = (smtPad, ctx) => {
934
1020
  const centerX = smtPad.x + origin.x;
935
1021
  const centerY = smtPad.y + origin.y;
936
1022
  if (smtPad.width > 0 && smtPad.height > 0) {
937
- const outer = createPillPath(centerX, centerY, smtPad.width, smtPad.height);
1023
+ const outer = createPillPath({
1024
+ centerX,
1025
+ centerY,
1026
+ width: smtPad.width,
1027
+ height: smtPad.height
1028
+ });
938
1029
  if (includeCopper) {
939
1030
  const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id);
940
1031
  const polygon = pathToPolygon(outer.verts);
@@ -954,7 +1045,12 @@ var addPillSmtPad = (smtPad, ctx) => {
954
1045
  if (includeSoldermask) {
955
1046
  const smWidth = smtPad.width + 2 * soldermaskMargin;
956
1047
  const smHeight = smtPad.height + 2 * soldermaskMargin;
957
- const smOuter = createPillPath(centerX, centerY, smWidth, smHeight);
1048
+ const smOuter = createPillPath({
1049
+ centerX,
1050
+ centerY,
1051
+ width: smWidth,
1052
+ height: smHeight
1053
+ });
958
1054
  project.children.push(
959
1055
  new ShapePath10({
960
1056
  cutIndex: soldermaskCutSetting.index,
@@ -983,13 +1079,13 @@ var addRotatedPillSmtPad = (smtPad, ctx) => {
983
1079
  const centerX = smtPad.x + origin.x;
984
1080
  const centerY = smtPad.y + origin.y;
985
1081
  if (smtPad.width > 0 && smtPad.height > 0) {
986
- const outer = createPillPath(
1082
+ const outer = createPillPath({
987
1083
  centerX,
988
1084
  centerY,
989
- smtPad.width,
990
- smtPad.height,
991
- (smtPad.ccw_rotation ?? 0) * (Math.PI / 180)
992
- );
1085
+ width: smtPad.width,
1086
+ height: smtPad.height,
1087
+ rotation: (smtPad.ccw_rotation ?? 0) * (Math.PI / 180)
1088
+ });
993
1089
  if (includeCopper) {
994
1090
  const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id);
995
1091
  const polygon = pathToPolygon(outer.verts);
@@ -1009,13 +1105,13 @@ var addRotatedPillSmtPad = (smtPad, ctx) => {
1009
1105
  if (includeSoldermask) {
1010
1106
  const smWidth = smtPad.width + 2 * soldermaskMargin;
1011
1107
  const smHeight = smtPad.height + 2 * soldermaskMargin;
1012
- const smOuter = createPillPath(
1108
+ const smOuter = createPillPath({
1013
1109
  centerX,
1014
1110
  centerY,
1015
- smWidth,
1016
- smHeight,
1017
- (smtPad.ccw_rotation ?? 0) * (Math.PI / 180)
1018
- );
1111
+ width: smWidth,
1112
+ height: smHeight,
1113
+ rotation: (smtPad.ccw_rotation ?? 0) * (Math.PI / 180)
1114
+ });
1019
1115
  project.children.push(
1020
1116
  new ShapePath11({
1021
1117
  cutIndex: soldermaskCutSetting.index,
@@ -1071,7 +1167,11 @@ var addPolygonSmtPad = (smtPad, ctx) => {
1071
1167
  soldermaskMargin
1072
1168
  } = ctx;
1073
1169
  if (smtPad.points.length >= 3) {
1074
- const pad = createPolygonPathFromOutline(smtPad.points, origin.x, origin.y);
1170
+ const pad = createPolygonPathFromOutline({
1171
+ outline: smtPad.points,
1172
+ offsetX: origin.x,
1173
+ offsetY: origin.y
1174
+ });
1075
1175
  if (includeCopper) {
1076
1176
  const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id);
1077
1177
  const polygon = pathToPolygon(pad.verts);
@@ -1116,18 +1216,18 @@ var addRotatedRectSmtPad = (smtPad, ctx) => {
1116
1216
  } = ctx;
1117
1217
  const centerX = smtPad.x + origin.x;
1118
1218
  const centerY = smtPad.y + origin.y;
1119
- const rotation = smtPad.ccw_rotation ?? 0;
1219
+ const rotation = (smtPad.ccw_rotation ?? 0) * (Math.PI / 180);
1120
1220
  const borderRadius = smtPad.rect_border_radius ?? 0;
1121
1221
  if (smtPad.width > 0 && smtPad.height > 0) {
1122
- const outer = createRoundedRectPath(
1222
+ const outer = createRoundedRectPath({
1123
1223
  centerX,
1124
1224
  centerY,
1125
- smtPad.width,
1126
- smtPad.height,
1225
+ width: smtPad.width,
1226
+ height: smtPad.height,
1127
1227
  borderRadius,
1128
- 4,
1228
+ segments: 4,
1129
1229
  rotation
1130
- );
1230
+ });
1131
1231
  if (includeCopper) {
1132
1232
  const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id);
1133
1233
  const polygon = pathToPolygon(outer.verts);
@@ -1147,15 +1247,15 @@ var addRotatedRectSmtPad = (smtPad, ctx) => {
1147
1247
  if (includeSoldermask) {
1148
1248
  const smWidth = smtPad.width + 2 * soldermaskMargin;
1149
1249
  const smHeight = smtPad.height + 2 * soldermaskMargin;
1150
- const smOuter = createRoundedRectPath(
1250
+ const smOuter = createRoundedRectPath({
1151
1251
  centerX,
1152
1252
  centerY,
1153
- smWidth,
1154
- smHeight,
1253
+ width: smWidth,
1254
+ height: smHeight,
1155
1255
  borderRadius,
1156
- 4,
1256
+ segments: 4,
1157
1257
  rotation
1158
- );
1258
+ });
1159
1259
  project.children.push(
1160
1260
  new ShapePath13({
1161
1261
  cutIndex: soldermaskCutSetting.index,
@@ -1399,7 +1499,11 @@ var addPcbVia = (via, ctx) => {
1399
1499
  if (netId) {
1400
1500
  ctx.netGeoms.get(netId)?.push(polygon);
1401
1501
  } else {
1402
- const outer = createCirclePath(centerX, centerY, outerRadius);
1502
+ const outer = createCirclePath({
1503
+ centerX,
1504
+ centerY,
1505
+ radius: outerRadius
1506
+ });
1403
1507
  project.children.push(
1404
1508
  new ShapePath15({
1405
1509
  cutIndex: copperCutSetting.index,
@@ -1412,7 +1516,11 @@ var addPcbVia = (via, ctx) => {
1412
1516
  }
1413
1517
  if (via.outer_diameter > 0 && includeSoldermask) {
1414
1518
  const smRadius = via.outer_diameter / 2 + soldermaskMargin;
1415
- const outer = createCirclePath(centerX, centerY, smRadius);
1519
+ const outer = createCirclePath({
1520
+ centerX,
1521
+ centerY,
1522
+ radius: smRadius
1523
+ });
1416
1524
  project.children.push(
1417
1525
  new ShapePath15({
1418
1526
  cutIndex: soldermaskCutSetting.index,
@@ -1424,7 +1532,11 @@ var addPcbVia = (via, ctx) => {
1424
1532
  }
1425
1533
  if (via.hole_diameter > 0 && includeCopper) {
1426
1534
  const innerRadius = via.hole_diameter / 2;
1427
- const inner = createCirclePath(centerX, centerY, innerRadius);
1535
+ const inner = createCirclePath({
1536
+ centerX,
1537
+ centerY,
1538
+ radius: innerRadius
1539
+ });
1428
1540
  project.children.push(
1429
1541
  new ShapePath15({
1430
1542
  cutIndex: throughBoardCutSetting.index,
@@ -1452,7 +1564,11 @@ var addCirclePcbHole = (hole, ctx) => {
1452
1564
  const centerY = hole.y + origin.y;
1453
1565
  if (hole.hole_diameter > 0 && includeSoldermask) {
1454
1566
  const smRadius = hole.hole_diameter / 2 + soldermaskMargin;
1455
- const soldermaskPath = createCirclePath(centerX, centerY, smRadius);
1567
+ const soldermaskPath = createCirclePath({
1568
+ centerX,
1569
+ centerY,
1570
+ radius: smRadius
1571
+ });
1456
1572
  project.children.push(
1457
1573
  new ShapePath16({
1458
1574
  cutIndex: soldermaskCutSetting.index,
@@ -1464,7 +1580,11 @@ var addCirclePcbHole = (hole, ctx) => {
1464
1580
  }
1465
1581
  if (hole.hole_diameter > 0 && includeCopper) {
1466
1582
  const radius = hole.hole_diameter / 2;
1467
- const circlePath = createCirclePath(centerX, centerY, radius);
1583
+ const circlePath = createCirclePath({
1584
+ centerX,
1585
+ centerY,
1586
+ radius
1587
+ });
1468
1588
  project.children.push(
1469
1589
  new ShapePath16({
1470
1590
  cutIndex: throughBoardCutSetting.index,
@@ -1491,14 +1611,14 @@ var addRectPcbHole = (hole, ctx) => {
1491
1611
  const centerX = hole.x + origin.x;
1492
1612
  const centerY = hole.y + origin.y;
1493
1613
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
1494
- const soldermaskPath = createRoundedRectPath(
1614
+ const soldermaskPath = createRoundedRectPath({
1495
1615
  centerX,
1496
1616
  centerY,
1497
- hole.hole_width + soldermaskMargin * 2,
1498
- hole.hole_height + soldermaskMargin * 2,
1499
- 0
1617
+ width: hole.hole_width + soldermaskMargin * 2,
1618
+ height: hole.hole_height + soldermaskMargin * 2,
1619
+ borderRadius: 0
1500
1620
  // no border radius for rect holes
1501
- );
1621
+ });
1502
1622
  project.children.push(
1503
1623
  new ShapePath17({
1504
1624
  cutIndex: soldermaskCutSetting.index,
@@ -1509,14 +1629,14 @@ var addRectPcbHole = (hole, ctx) => {
1509
1629
  );
1510
1630
  }
1511
1631
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
1512
- const rectPath = createRoundedRectPath(
1632
+ const rectPath = createRoundedRectPath({
1513
1633
  centerX,
1514
1634
  centerY,
1515
- hole.hole_width,
1516
- hole.hole_height,
1517
- 0
1635
+ width: hole.hole_width,
1636
+ height: hole.hole_height,
1637
+ borderRadius: 0
1518
1638
  // no border radius for rect holes
1519
- );
1639
+ });
1520
1640
  project.children.push(
1521
1641
  new ShapePath17({
1522
1642
  cutIndex: throughBoardCutSetting.index,
@@ -1543,12 +1663,12 @@ var addOvalPcbHole = (hole, ctx) => {
1543
1663
  const centerX = hole.x + origin.x;
1544
1664
  const centerY = hole.y + origin.y;
1545
1665
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
1546
- const soldermaskPath = createOvalPath(
1666
+ const soldermaskPath = createOvalPath({
1547
1667
  centerX,
1548
1668
  centerY,
1549
- hole.hole_width + soldermaskMargin * 2,
1550
- hole.hole_height + soldermaskMargin * 2
1551
- );
1669
+ width: hole.hole_width + soldermaskMargin * 2,
1670
+ height: hole.hole_height + soldermaskMargin * 2
1671
+ });
1552
1672
  project.children.push(
1553
1673
  new ShapePath18({
1554
1674
  cutIndex: soldermaskCutSetting.index,
@@ -1559,12 +1679,12 @@ var addOvalPcbHole = (hole, ctx) => {
1559
1679
  );
1560
1680
  }
1561
1681
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
1562
- const ovalPath = createOvalPath(
1682
+ const ovalPath = createOvalPath({
1563
1683
  centerX,
1564
1684
  centerY,
1565
- hole.hole_width,
1566
- hole.hole_height
1567
- );
1685
+ width: hole.hole_width,
1686
+ height: hole.hole_height
1687
+ });
1568
1688
  project.children.push(
1569
1689
  new ShapePath18({
1570
1690
  cutIndex: throughBoardCutSetting.index,
@@ -1591,12 +1711,12 @@ var addPillPcbHole = (hole, ctx) => {
1591
1711
  const centerX = hole.x + origin.x;
1592
1712
  const centerY = hole.y + origin.y;
1593
1713
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
1594
- const soldermaskPath = createPillPath(
1714
+ const soldermaskPath = createPillPath({
1595
1715
  centerX,
1596
1716
  centerY,
1597
- hole.hole_width + soldermaskMargin * 2,
1598
- hole.hole_height + soldermaskMargin * 2
1599
- );
1717
+ width: hole.hole_width + soldermaskMargin * 2,
1718
+ height: hole.hole_height + soldermaskMargin * 2
1719
+ });
1600
1720
  project.children.push(
1601
1721
  new ShapePath19({
1602
1722
  cutIndex: soldermaskCutSetting.index,
@@ -1607,12 +1727,12 @@ var addPillPcbHole = (hole, ctx) => {
1607
1727
  );
1608
1728
  }
1609
1729
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
1610
- const pillPath = createPillPath(
1730
+ const pillPath = createPillPath({
1611
1731
  centerX,
1612
1732
  centerY,
1613
- hole.hole_width,
1614
- hole.hole_height
1615
- );
1733
+ width: hole.hole_width,
1734
+ height: hole.hole_height
1735
+ });
1616
1736
  project.children.push(
1617
1737
  new ShapePath19({
1618
1738
  cutIndex: throughBoardCutSetting.index,
@@ -1640,13 +1760,13 @@ var addRotatedPillPcbHole = (hole, ctx) => {
1640
1760
  const centerY = hole.y + origin.y;
1641
1761
  const rotation = (hole.ccw_rotation || 0) * (Math.PI / 180);
1642
1762
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
1643
- const soldermaskPath = createPillPath(
1763
+ const soldermaskPath = createPillPath({
1644
1764
  centerX,
1645
1765
  centerY,
1646
- hole.hole_width + soldermaskMargin * 2,
1647
- hole.hole_height + soldermaskMargin * 2,
1766
+ width: hole.hole_width + soldermaskMargin * 2,
1767
+ height: hole.hole_height + soldermaskMargin * 2,
1648
1768
  rotation
1649
- );
1769
+ });
1650
1770
  project.children.push(
1651
1771
  new ShapePath20({
1652
1772
  cutIndex: soldermaskCutSetting.index,
@@ -1657,13 +1777,13 @@ var addRotatedPillPcbHole = (hole, ctx) => {
1657
1777
  );
1658
1778
  }
1659
1779
  if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
1660
- const pillPath = createPillPath(
1780
+ const pillPath = createPillPath({
1661
1781
  centerX,
1662
1782
  centerY,
1663
- hole.hole_width,
1664
- hole.hole_height,
1783
+ width: hole.hole_width,
1784
+ height: hole.hole_height,
1665
1785
  rotation
1666
- );
1786
+ });
1667
1787
  project.children.push(
1668
1788
  new ShapePath20({
1669
1789
  cutIndex: throughBoardCutSetting.index,
@@ -1710,7 +1830,11 @@ var addCirclePcbCutout = (cutout, ctx) => {
1710
1830
  const centerX = cutout.center.x + origin.x;
1711
1831
  const centerY = cutout.center.y + origin.y;
1712
1832
  if (cutout.radius > 0 && includeCopper) {
1713
- const circlePath = createCirclePath(centerX, centerY, cutout.radius);
1833
+ const circlePath = createCirclePath({
1834
+ centerX,
1835
+ centerY,
1836
+ radius: cutout.radius
1837
+ });
1714
1838
  project.children.push(
1715
1839
  new ShapePath21({
1716
1840
  cutIndex: throughBoardCutSetting.index,
@@ -1722,7 +1846,11 @@ var addCirclePcbCutout = (cutout, ctx) => {
1722
1846
  }
1723
1847
  if (cutout.radius > 0 && includeSoldermask) {
1724
1848
  const smRadius = cutout.radius + soldermaskMargin;
1725
- const outer = createCirclePath(centerX, centerY, smRadius);
1849
+ const outer = createCirclePath({
1850
+ centerX,
1851
+ centerY,
1852
+ radius: smRadius
1853
+ });
1726
1854
  project.children.push(
1727
1855
  new ShapePath21({
1728
1856
  cutIndex: soldermaskCutSetting.index,
@@ -1750,17 +1878,17 @@ var addRectPcbCutout = (cutout, ctx) => {
1750
1878
  const centerY = cutout.center.y + origin.y;
1751
1879
  if (cutout.width > 0 && cutout.height > 0 && includeCopper) {
1752
1880
  const rotation = (cutout.rotation ?? 0) * (Math.PI / 180);
1753
- const rectPath = createRoundedRectPath(
1881
+ const rectPath = createRoundedRectPath({
1754
1882
  centerX,
1755
1883
  centerY,
1756
- cutout.width,
1757
- cutout.height,
1758
- 0,
1884
+ width: cutout.width,
1885
+ height: cutout.height,
1886
+ borderRadius: 0,
1759
1887
  // no border radius for cutouts
1760
- 4,
1888
+ segments: 4,
1761
1889
  // segments
1762
1890
  rotation
1763
- );
1891
+ });
1764
1892
  project.children.push(
1765
1893
  new ShapePath22({
1766
1894
  cutIndex: throughBoardCutSetting.index,
@@ -1774,17 +1902,17 @@ var addRectPcbCutout = (cutout, ctx) => {
1774
1902
  const rotation = (cutout.rotation ?? 0) * (Math.PI / 180);
1775
1903
  const smWidth = cutout.width + 2 * soldermaskMargin;
1776
1904
  const smHeight = cutout.height + 2 * soldermaskMargin;
1777
- const rectPath = createRoundedRectPath(
1905
+ const rectPath = createRoundedRectPath({
1778
1906
  centerX,
1779
1907
  centerY,
1780
- smWidth,
1781
- smHeight,
1782
- 0,
1908
+ width: smWidth,
1909
+ height: smHeight,
1910
+ borderRadius: 0,
1783
1911
  // no border radius for cutouts
1784
- 4,
1912
+ segments: 4,
1785
1913
  // segments
1786
1914
  rotation
1787
- );
1915
+ });
1788
1916
  project.children.push(
1789
1917
  new ShapePath22({
1790
1918
  cutIndex: soldermaskCutSetting.index,
@@ -1809,11 +1937,11 @@ var addPolygonPcbCutout = (cutout, ctx) => {
1809
1937
  soldermaskMargin
1810
1938
  } = ctx;
1811
1939
  if (cutout.points.length >= 3 && includeCopper) {
1812
- const polygonPath = createPolygonPathFromOutline(
1813
- cutout.points,
1814
- origin.x,
1815
- origin.y
1816
- );
1940
+ const polygonPath = createPolygonPathFromOutline({
1941
+ outline: cutout.points,
1942
+ offsetX: origin.x,
1943
+ offsetY: origin.y
1944
+ });
1817
1945
  project.children.push(
1818
1946
  new ShapePath23({
1819
1947
  cutIndex: throughBoardCutSetting.index,
@@ -1828,7 +1956,11 @@ var addPolygonPcbCutout = (cutout, ctx) => {
1828
1956
  x: (p.x ?? 0) + (p.x ?? 0) > 0 ? soldermaskMargin : -soldermaskMargin,
1829
1957
  y: (p.y ?? 0) + (p.y ?? 0) > 0 ? soldermaskMargin : -soldermaskMargin
1830
1958
  })) : cutout.points;
1831
- const polygonPath = createPolygonPathFromOutline(points, origin.x, origin.y);
1959
+ const polygonPath = createPolygonPathFromOutline({
1960
+ outline: points,
1961
+ offsetX: origin.x,
1962
+ offsetY: origin.y
1963
+ });
1832
1964
  project.children.push(
1833
1965
  new ShapePath23({
1834
1966
  cutIndex: soldermaskCutSetting.index,