@tscircuit/footprinter 0.0.335 → 0.0.336
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/dist/index.d.ts +2 -0
- package/dist/index.js +102 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -369,7 +369,9 @@ var footprintSizes = [
|
|
|
369
369
|
pw_mm_min: 0.4,
|
|
370
370
|
ph_mm_min: 0.3,
|
|
371
371
|
w_mm_min: 0.58,
|
|
372
|
-
h_mm_min: 0.21
|
|
372
|
+
h_mm_min: 0.21,
|
|
373
|
+
courtyard_width_mm: 1.2,
|
|
374
|
+
courtyard_height_mm: 0.6
|
|
373
375
|
},
|
|
374
376
|
{
|
|
375
377
|
imperial: "0504",
|
|
@@ -387,7 +389,9 @@ var footprintSizes = [
|
|
|
387
389
|
pw_mm_min: 1.125,
|
|
388
390
|
ph_mm_min: 3.4,
|
|
389
391
|
w_mm_min: 5.4,
|
|
390
|
-
h_mm_min: 3.4
|
|
392
|
+
h_mm_min: 3.4,
|
|
393
|
+
courtyard_width_mm: 5.9,
|
|
394
|
+
courtyard_height_mm: 3.9
|
|
391
395
|
},
|
|
392
396
|
{
|
|
393
397
|
imperial: "0201",
|
|
@@ -396,7 +400,9 @@ var footprintSizes = [
|
|
|
396
400
|
pw_mm_min: 0.46,
|
|
397
401
|
ph_mm_min: 0.4,
|
|
398
402
|
w_mm_min: 0.9,
|
|
399
|
-
h_mm_min: 0.3
|
|
403
|
+
h_mm_min: 0.3,
|
|
404
|
+
courtyard_width_mm: 1.4,
|
|
405
|
+
courtyard_height_mm: 0.7
|
|
400
406
|
},
|
|
401
407
|
{
|
|
402
408
|
imperial: "0402",
|
|
@@ -405,7 +411,9 @@ var footprintSizes = [
|
|
|
405
411
|
pw_mm_min: 0.54,
|
|
406
412
|
ph_mm_min: 0.64,
|
|
407
413
|
w_mm_min: 1.56,
|
|
408
|
-
h_mm_min: 0.64
|
|
414
|
+
h_mm_min: 0.64,
|
|
415
|
+
courtyard_width_mm: 1.86,
|
|
416
|
+
courtyard_height_mm: 0.94
|
|
409
417
|
},
|
|
410
418
|
{
|
|
411
419
|
imperial: "0603",
|
|
@@ -414,7 +422,9 @@ var footprintSizes = [
|
|
|
414
422
|
pw_mm_min: 0.8,
|
|
415
423
|
ph_mm_min: 0.95,
|
|
416
424
|
w_mm_min: 2.45,
|
|
417
|
-
h_mm_min: 0.95
|
|
425
|
+
h_mm_min: 0.95,
|
|
426
|
+
courtyard_width_mm: 2.96,
|
|
427
|
+
courtyard_height_mm: 1.46
|
|
418
428
|
},
|
|
419
429
|
{
|
|
420
430
|
imperial: "0805",
|
|
@@ -423,7 +433,9 @@ var footprintSizes = [
|
|
|
423
433
|
pw_mm_min: 1.025,
|
|
424
434
|
ph_mm_min: 1.4,
|
|
425
435
|
w_mm_min: 2.8499999999999996,
|
|
426
|
-
h_mm_min: 1.4
|
|
436
|
+
h_mm_min: 1.4,
|
|
437
|
+
courtyard_width_mm: 3.36,
|
|
438
|
+
courtyard_height_mm: 1.9
|
|
427
439
|
},
|
|
428
440
|
{
|
|
429
441
|
imperial: "1206",
|
|
@@ -432,7 +444,9 @@ var footprintSizes = [
|
|
|
432
444
|
pw_mm_min: 1.125,
|
|
433
445
|
ph_mm_min: 1.75,
|
|
434
446
|
w_mm_min: 4.05,
|
|
435
|
-
h_mm_min: 1.75
|
|
447
|
+
h_mm_min: 1.75,
|
|
448
|
+
courtyard_width_mm: 4.56,
|
|
449
|
+
courtyard_height_mm: 2.26
|
|
436
450
|
},
|
|
437
451
|
{
|
|
438
452
|
imperial: "1210",
|
|
@@ -441,7 +455,9 @@ var footprintSizes = [
|
|
|
441
455
|
pw_mm_min: 1.125,
|
|
442
456
|
ph_mm_min: 2.65,
|
|
443
457
|
w_mm_min: 4.05,
|
|
444
|
-
h_mm_min: 2.65
|
|
458
|
+
h_mm_min: 2.65,
|
|
459
|
+
courtyard_width_mm: 4.56,
|
|
460
|
+
courtyard_height_mm: 3.16
|
|
445
461
|
},
|
|
446
462
|
{
|
|
447
463
|
imperial: "2010",
|
|
@@ -450,7 +466,9 @@ var footprintSizes = [
|
|
|
450
466
|
pw_mm_min: 1.225,
|
|
451
467
|
ph_mm_min: 2.65,
|
|
452
468
|
w_mm_min: 5.85,
|
|
453
|
-
h_mm_min: 2.65
|
|
469
|
+
h_mm_min: 2.65,
|
|
470
|
+
courtyard_width_mm: 6.36,
|
|
471
|
+
courtyard_height_mm: 3.16
|
|
454
472
|
},
|
|
455
473
|
{
|
|
456
474
|
imperial: "2512",
|
|
@@ -459,13 +477,24 @@ var footprintSizes = [
|
|
|
459
477
|
pw_mm_min: 1.225,
|
|
460
478
|
ph_mm_min: 3.35,
|
|
461
479
|
w_mm_min: 7.15,
|
|
462
|
-
h_mm_min: 3.35
|
|
480
|
+
h_mm_min: 3.35,
|
|
481
|
+
courtyard_width_mm: 7.66,
|
|
482
|
+
courtyard_height_mm: 3.86
|
|
463
483
|
}
|
|
464
484
|
];
|
|
465
485
|
var metricMap = Object.fromEntries(footprintSizes.map((s) => [s.metric, s]));
|
|
466
486
|
var imperialMap = Object.fromEntries(
|
|
467
487
|
footprintSizes.map((s) => [s.imperial, s])
|
|
468
488
|
);
|
|
489
|
+
var createCourtyardRect = (width, height) => ({
|
|
490
|
+
type: "pcb_courtyard_rect",
|
|
491
|
+
pcb_courtyard_rect_id: "",
|
|
492
|
+
pcb_component_id: "",
|
|
493
|
+
center: { x: 0, y: 0 },
|
|
494
|
+
width,
|
|
495
|
+
height,
|
|
496
|
+
layer: "top"
|
|
497
|
+
});
|
|
469
498
|
var passive_def = base_def.extend({
|
|
470
499
|
tht: z3.boolean(),
|
|
471
500
|
p: length.optional(),
|
|
@@ -517,29 +546,14 @@ var passive = (params) => {
|
|
|
517
546
|
};
|
|
518
547
|
const textY = textbottom ? -ph / 2 - 0.9 : ph / 2 + 0.9;
|
|
519
548
|
const silkscreenRefText = silkscreenRef(0, textY, 0.2);
|
|
520
|
-
const
|
|
521
|
-
const silkXs = silkscreenLine.route.map((pt) => pt.x);
|
|
522
|
-
const silkYs = silkscreenLine.route.map((pt) => pt.y);
|
|
523
|
-
const crtMinX = Math.min(-(w ?? 0) / 2, -(p / 2 + pw / 2), ...silkXs) - excess;
|
|
524
|
-
const crtMaxX = Math.max((w ?? 0) / 2, p / 2 + pw / 2, ...silkXs) + excess;
|
|
525
|
-
const crtMinY = Math.min(-(h ?? 0) / 2, -ph / 2, ...silkYs) - excess;
|
|
526
|
-
const crtMaxY = Math.max((h ?? 0) / 2, ph / 2, ...silkYs) + excess;
|
|
527
|
-
const courtyard = {
|
|
528
|
-
type: "pcb_courtyard_rect",
|
|
529
|
-
pcb_courtyard_rect_id: "",
|
|
530
|
-
pcb_component_id: "",
|
|
531
|
-
center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
|
|
532
|
-
width: crtMaxX - crtMinX,
|
|
533
|
-
height: crtMaxY - crtMinY,
|
|
534
|
-
layer: "top"
|
|
535
|
-
};
|
|
549
|
+
const courtyard = sz?.courtyard_width_mm && sz.courtyard_height_mm ? createCourtyardRect(sz.courtyard_width_mm, sz.courtyard_height_mm) : null;
|
|
536
550
|
if (tht) {
|
|
537
551
|
return [
|
|
538
552
|
platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
|
|
539
553
|
platedhole(2, p / 2, 0, pw, pw * 1 / 0.8),
|
|
540
554
|
silkscreenLine,
|
|
541
555
|
silkscreenRefText,
|
|
542
|
-
courtyard
|
|
556
|
+
...courtyard ? [courtyard] : []
|
|
543
557
|
];
|
|
544
558
|
}
|
|
545
559
|
return [
|
|
@@ -547,7 +561,7 @@ var passive = (params) => {
|
|
|
547
561
|
rectpad(["2", "right"], p / 2, 0, pw, ph),
|
|
548
562
|
silkscreenLine,
|
|
549
563
|
silkscreenRefText,
|
|
550
|
-
courtyard
|
|
564
|
+
...courtyard ? [courtyard] : []
|
|
551
565
|
];
|
|
552
566
|
};
|
|
553
567
|
|
|
@@ -571,7 +585,15 @@ import { length as length2 } from "circuit-json";
|
|
|
571
585
|
|
|
572
586
|
// src/helpers/chipArray.ts
|
|
573
587
|
var chipArray = (params) => {
|
|
574
|
-
const {
|
|
588
|
+
const {
|
|
589
|
+
padSpacing: padSpacing7,
|
|
590
|
+
padWidth,
|
|
591
|
+
padHeight,
|
|
592
|
+
padPitch,
|
|
593
|
+
numRows,
|
|
594
|
+
textbottom,
|
|
595
|
+
courtyardOutline
|
|
596
|
+
} = params;
|
|
575
597
|
const yPositions = [];
|
|
576
598
|
const halfRange = (numRows - 1) * (padPitch / 2);
|
|
577
599
|
for (let i = 0; i < numRows; i++) {
|
|
@@ -632,12 +654,20 @@ var chipArray = (params) => {
|
|
|
632
654
|
};
|
|
633
655
|
const textY = textbottom ? bottom - 0.9 : top + 0.9;
|
|
634
656
|
const silkscreenRefText = silkscreenRef(0, textY, 0.2);
|
|
657
|
+
const courtyard = courtyardOutline ? {
|
|
658
|
+
type: "pcb_courtyard_outline",
|
|
659
|
+
pcb_courtyard_outline_id: "",
|
|
660
|
+
pcb_component_id: "",
|
|
661
|
+
layer: "top",
|
|
662
|
+
outline: courtyardOutline
|
|
663
|
+
} : null;
|
|
635
664
|
return [
|
|
636
665
|
...pads,
|
|
637
666
|
silkscreenTop,
|
|
638
667
|
silkscreenBottom,
|
|
639
668
|
pin1Marker,
|
|
640
|
-
silkscreenRefText
|
|
669
|
+
silkscreenRefText,
|
|
670
|
+
...courtyard ? [courtyard] : []
|
|
641
671
|
];
|
|
642
672
|
};
|
|
643
673
|
|
|
@@ -669,7 +699,13 @@ var res0402Array2 = (rawParams) => {
|
|
|
669
699
|
numRows: 2,
|
|
670
700
|
textbottom: params.textbottom,
|
|
671
701
|
convex: params.convex,
|
|
672
|
-
concave: params.concave
|
|
702
|
+
concave: params.concave,
|
|
703
|
+
courtyardOutline: [
|
|
704
|
+
{ x: -1, y: 0.95 },
|
|
705
|
+
{ x: -1, y: -0.95 },
|
|
706
|
+
{ x: 1, y: -0.95 },
|
|
707
|
+
{ x: 1, y: 0.95 }
|
|
708
|
+
]
|
|
673
709
|
});
|
|
674
710
|
};
|
|
675
711
|
|
|
@@ -699,7 +735,13 @@ var res0402Array4 = (rawParams) => {
|
|
|
699
735
|
numRows: 4,
|
|
700
736
|
textbottom: params.textbottom,
|
|
701
737
|
convex: params.convex,
|
|
702
|
-
concave: params.concave
|
|
738
|
+
concave: params.concave,
|
|
739
|
+
courtyardOutline: [
|
|
740
|
+
{ x: -1, y: 1.25 },
|
|
741
|
+
{ x: -1, y: -1.25 },
|
|
742
|
+
{ x: 1, y: -1.25 },
|
|
743
|
+
{ x: 1, y: 1.25 }
|
|
744
|
+
]
|
|
703
745
|
});
|
|
704
746
|
};
|
|
705
747
|
|
|
@@ -729,7 +771,13 @@ var res0603Array2 = (rawParams) => {
|
|
|
729
771
|
numRows: 2,
|
|
730
772
|
textbottom: params.textbottom,
|
|
731
773
|
convex: params.convex,
|
|
732
|
-
concave: params.concave
|
|
774
|
+
concave: params.concave,
|
|
775
|
+
courtyardOutline: [
|
|
776
|
+
{ x: -1.55, y: 1.05 },
|
|
777
|
+
{ x: -1.55, y: -1.05 },
|
|
778
|
+
{ x: 1.55, y: -1.05 },
|
|
779
|
+
{ x: 1.55, y: 1.05 }
|
|
780
|
+
]
|
|
733
781
|
});
|
|
734
782
|
};
|
|
735
783
|
|
|
@@ -759,7 +807,13 @@ var res0603Array4 = (rawParams) => {
|
|
|
759
807
|
numRows: 4,
|
|
760
808
|
textbottom: params.textbottom,
|
|
761
809
|
convex: params.convex,
|
|
762
|
-
concave: params.concave
|
|
810
|
+
concave: params.concave,
|
|
811
|
+
courtyardOutline: [
|
|
812
|
+
{ x: -1.55, y: 1.88 },
|
|
813
|
+
{ x: -1.55, y: -1.87 },
|
|
814
|
+
{ x: 1.55, y: -1.87 },
|
|
815
|
+
{ x: 1.55, y: 1.88 }
|
|
816
|
+
]
|
|
763
817
|
});
|
|
764
818
|
};
|
|
765
819
|
|
|
@@ -789,7 +843,13 @@ var res0606Array2 = (rawParams) => {
|
|
|
789
843
|
numRows: 2,
|
|
790
844
|
textbottom: params.textbottom,
|
|
791
845
|
convex: params.convex,
|
|
792
|
-
concave: params.concave
|
|
846
|
+
concave: params.concave,
|
|
847
|
+
courtyardOutline: [
|
|
848
|
+
{ x: -1.3, y: 1.05 },
|
|
849
|
+
{ x: -1.3, y: -1.05 },
|
|
850
|
+
{ x: 1.3, y: -1.05 },
|
|
851
|
+
{ x: 1.3, y: 1.05 }
|
|
852
|
+
]
|
|
793
853
|
});
|
|
794
854
|
};
|
|
795
855
|
|
|
@@ -819,7 +879,13 @@ var res1206Array4 = (rawParams) => {
|
|
|
819
879
|
numRows: 4,
|
|
820
880
|
textbottom: params.textbottom,
|
|
821
881
|
convex: params.convex,
|
|
822
|
-
concave: params.concave
|
|
882
|
+
concave: params.concave,
|
|
883
|
+
courtyardOutline: [
|
|
884
|
+
{ x: -2.21, y: 2.85 },
|
|
885
|
+
{ x: -2.21, y: -2.85 },
|
|
886
|
+
{ x: 2.2, y: -2.85 },
|
|
887
|
+
{ x: 2.2, y: 2.85 }
|
|
888
|
+
]
|
|
823
889
|
});
|
|
824
890
|
};
|
|
825
891
|
|