@tscircuit/footprinter 0.0.285 → 0.0.286
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.js +98 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -519,25 +519,25 @@ var led = (parameters) => {
|
|
|
519
519
|
|
|
520
520
|
// src/helpers/chipArray.ts
|
|
521
521
|
var chipArray = (params) => {
|
|
522
|
-
const { padSpacing:
|
|
522
|
+
const { padSpacing: padSpacing6, padWidth: padWidth6, padHeight: padHeight6, padPitch: padPitch6, numRows, textbottom } = params;
|
|
523
523
|
const yPositions = [];
|
|
524
|
-
const halfRange = (numRows - 1) * (
|
|
524
|
+
const halfRange = (numRows - 1) * (padPitch6 / 2);
|
|
525
525
|
for (let i = 0; i < numRows; i++) {
|
|
526
|
-
yPositions.push(halfRange - i *
|
|
526
|
+
yPositions.push(halfRange - i * padPitch6);
|
|
527
527
|
}
|
|
528
528
|
const pads = [];
|
|
529
529
|
yPositions.forEach((y, index) => {
|
|
530
|
-
pads.push(rectpad(index + 1, -
|
|
530
|
+
pads.push(rectpad(index + 1, -padSpacing6 / 2, y, padWidth6, padHeight6));
|
|
531
531
|
});
|
|
532
532
|
yPositions.slice().reverse().forEach((y, index) => {
|
|
533
533
|
pads.push(
|
|
534
|
-
rectpad(index + numRows + 1,
|
|
534
|
+
rectpad(index + numRows + 1, padSpacing6 / 2, y, padWidth6, padHeight6)
|
|
535
535
|
);
|
|
536
536
|
});
|
|
537
|
-
const top = Math.max(...yPositions) +
|
|
538
|
-
const bottom = Math.min(...yPositions) -
|
|
539
|
-
const left = -
|
|
540
|
-
const right =
|
|
537
|
+
const top = Math.max(...yPositions) + padHeight6 / 2 + 0.4;
|
|
538
|
+
const bottom = Math.min(...yPositions) - padHeight6 / 2 - 0.4;
|
|
539
|
+
const left = -padSpacing6 / 2 - padWidth6 / 2 - 0.4;
|
|
540
|
+
const right = padSpacing6 / 2 + padWidth6 / 2 + 0.4;
|
|
541
541
|
const silkscreenTop = {
|
|
542
542
|
type: "pcb_silkscreen_path",
|
|
543
543
|
layer: "top",
|
|
@@ -560,11 +560,11 @@ var chipArray = (params) => {
|
|
|
560
560
|
stroke_width: 0.12,
|
|
561
561
|
pcb_silkscreen_path_id: "silkscreen_bottom"
|
|
562
562
|
};
|
|
563
|
-
const pin1X = -
|
|
563
|
+
const pin1X = -padSpacing6 / 2;
|
|
564
564
|
const pin1Y = Math.max(...yPositions);
|
|
565
565
|
const pin1MarkerSize = 0.2;
|
|
566
|
-
const pin1Left = pin1X -
|
|
567
|
-
const pin1Top = pin1Y +
|
|
566
|
+
const pin1Left = pin1X - padWidth6 / 2 - 0.1;
|
|
567
|
+
const pin1Top = pin1Y + padHeight6 / 2 + 0.1;
|
|
568
568
|
const pin1Marker = {
|
|
569
569
|
type: "pcb_silkscreen_path",
|
|
570
570
|
layer: "top",
|
|
@@ -653,6 +653,22 @@ var res0603Array4 = (params) => {
|
|
|
653
653
|
});
|
|
654
654
|
};
|
|
655
655
|
|
|
656
|
+
// src/helpers/res0606-array2.ts
|
|
657
|
+
var padSpacing5 = 1.4;
|
|
658
|
+
var padWidth5 = 0.7;
|
|
659
|
+
var padHeight5 = 0.64;
|
|
660
|
+
var padPitch5 = 0.94;
|
|
661
|
+
var res0606Array2 = (params) => {
|
|
662
|
+
return chipArray({
|
|
663
|
+
padSpacing: padSpacing5,
|
|
664
|
+
padWidth: padWidth5,
|
|
665
|
+
padHeight: padHeight5,
|
|
666
|
+
padPitch: padPitch5,
|
|
667
|
+
numRows: 2,
|
|
668
|
+
textbottom: params.textbottom
|
|
669
|
+
});
|
|
670
|
+
};
|
|
671
|
+
|
|
656
672
|
// src/fn/res.ts
|
|
657
673
|
var getArrayCount = (parameters) => {
|
|
658
674
|
const arrayValue = parameters.array ?? parameters.x;
|
|
@@ -704,6 +720,12 @@ var res = (rawParameters) => {
|
|
|
704
720
|
parameters: rawParameters
|
|
705
721
|
};
|
|
706
722
|
}
|
|
723
|
+
if (arrayCount === 2 && imperialBase === "0606") {
|
|
724
|
+
return {
|
|
725
|
+
circuitJson: res0606Array2(rawParameters),
|
|
726
|
+
parameters: rawParameters
|
|
727
|
+
};
|
|
728
|
+
}
|
|
707
729
|
return { circuitJson: passive(rawParameters), parameters: rawParameters };
|
|
708
730
|
};
|
|
709
731
|
|
|
@@ -3850,41 +3872,41 @@ var to92 = (raw_params) => {
|
|
|
3850
3872
|
});
|
|
3851
3873
|
const { p, id, od, w, h, inline } = parameters;
|
|
3852
3874
|
const holeY = Number.parseFloat(h) / 2;
|
|
3853
|
-
const
|
|
3875
|
+
const padSpacing6 = Number.parseFloat(p);
|
|
3854
3876
|
const holeDia = Number.parseFloat(id);
|
|
3855
3877
|
const padDia = Number.parseFloat(od);
|
|
3856
|
-
const
|
|
3857
|
-
const
|
|
3878
|
+
const padWidth6 = padDia;
|
|
3879
|
+
const padHeight6 = padDia * (1.5 / 1.05);
|
|
3858
3880
|
let platedHoles = [];
|
|
3859
3881
|
if (parameters.num_pins === 3) {
|
|
3860
3882
|
if (inline) {
|
|
3861
3883
|
platedHoles = [
|
|
3862
3884
|
platedHoleWithRectPad(
|
|
3863
3885
|
1,
|
|
3864
|
-
-
|
|
3865
|
-
holeY -
|
|
3886
|
+
-padSpacing6,
|
|
3887
|
+
holeY - padSpacing6,
|
|
3866
3888
|
holeDia,
|
|
3867
3889
|
padDia,
|
|
3868
|
-
|
|
3890
|
+
padHeight6,
|
|
3869
3891
|
0,
|
|
3870
3892
|
0
|
|
3871
3893
|
),
|
|
3872
|
-
platedHolePill(2, 0, holeY -
|
|
3894
|
+
platedHolePill(2, 0, holeY - padSpacing6, holeDia, padWidth6, padHeight6),
|
|
3873
3895
|
platedHolePill(
|
|
3874
3896
|
3,
|
|
3875
|
-
|
|
3876
|
-
holeY -
|
|
3897
|
+
padSpacing6,
|
|
3898
|
+
holeY - padSpacing6,
|
|
3877
3899
|
holeDia,
|
|
3878
|
-
|
|
3879
|
-
|
|
3900
|
+
padWidth6,
|
|
3901
|
+
padHeight6
|
|
3880
3902
|
)
|
|
3881
3903
|
];
|
|
3882
3904
|
} else {
|
|
3883
3905
|
platedHoles = [
|
|
3884
3906
|
platedHoleWithRectPad(
|
|
3885
3907
|
1,
|
|
3886
|
-
-
|
|
3887
|
-
holeY -
|
|
3908
|
+
-padSpacing6,
|
|
3909
|
+
holeY - padSpacing6,
|
|
3888
3910
|
holeDia,
|
|
3889
3911
|
padDia,
|
|
3890
3912
|
padDia,
|
|
@@ -3892,28 +3914,28 @@ var to92 = (raw_params) => {
|
|
|
3892
3914
|
0
|
|
3893
3915
|
),
|
|
3894
3916
|
platedhole(2, 0, holeY, holeDia, padDia),
|
|
3895
|
-
platedhole(3,
|
|
3917
|
+
platedhole(3, padSpacing6, holeY - padSpacing6, holeDia, padDia)
|
|
3896
3918
|
];
|
|
3897
3919
|
}
|
|
3898
3920
|
} else if (parameters.num_pins === 2) {
|
|
3899
3921
|
platedHoles = [
|
|
3900
3922
|
platedHoleWithRectPad(
|
|
3901
3923
|
1,
|
|
3902
|
-
-
|
|
3903
|
-
holeY -
|
|
3924
|
+
-padSpacing6,
|
|
3925
|
+
holeY - padSpacing6,
|
|
3904
3926
|
holeDia,
|
|
3905
|
-
|
|
3906
|
-
|
|
3927
|
+
padWidth6,
|
|
3928
|
+
padHeight6,
|
|
3907
3929
|
0,
|
|
3908
3930
|
0
|
|
3909
3931
|
),
|
|
3910
3932
|
platedHolePill(
|
|
3911
3933
|
2,
|
|
3912
|
-
|
|
3913
|
-
holeY -
|
|
3934
|
+
padSpacing6,
|
|
3935
|
+
holeY - padSpacing6,
|
|
3914
3936
|
holeDia,
|
|
3915
|
-
|
|
3916
|
-
|
|
3937
|
+
padWidth6,
|
|
3938
|
+
padHeight6
|
|
3917
3939
|
)
|
|
3918
3940
|
];
|
|
3919
3941
|
} else {
|
|
@@ -4879,15 +4901,15 @@ var sot89_def = base_def.extend({
|
|
|
4879
4901
|
var sot89_3 = (parameters) => {
|
|
4880
4902
|
const pads = [];
|
|
4881
4903
|
const padGap = Number.parseFloat(parameters.p);
|
|
4882
|
-
const
|
|
4904
|
+
const padWidth6 = Number.parseFloat(parameters.pw);
|
|
4883
4905
|
const length51 = Number.parseFloat(parameters.w);
|
|
4884
|
-
const
|
|
4906
|
+
const padHeight6 = Number.parseFloat(parameters.pl);
|
|
4885
4907
|
const centerExtra = 0.175;
|
|
4886
|
-
const outerPadXShift = (
|
|
4908
|
+
const outerPadXShift = (padHeight6 - (padHeight6 + centerExtra)) / 2;
|
|
4887
4909
|
pads.push(
|
|
4888
|
-
rectpad(1, -length51 / 2 + outerPadXShift, padGap,
|
|
4889
|
-
rectpad(2, -length51 / 2, 0,
|
|
4890
|
-
rectpad(3, -length51 / 2 + outerPadXShift, -padGap,
|
|
4910
|
+
rectpad(1, -length51 / 2 + outerPadXShift, padGap, padHeight6, padWidth6),
|
|
4911
|
+
rectpad(2, -length51 / 2, 0, padHeight6 + centerExtra, padWidth6),
|
|
4912
|
+
rectpad(3, -length51 / 2 + outerPadXShift, -padGap, padHeight6, padWidth6)
|
|
4891
4913
|
);
|
|
4892
4914
|
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
4893
4915
|
const width = Number.parseFloat(parameters.w) / 2 - 1;
|
|
@@ -4926,7 +4948,7 @@ var sot89_3 = (parameters) => {
|
|
|
4926
4948
|
var sot89_5 = (parameters) => {
|
|
4927
4949
|
const pads = [];
|
|
4928
4950
|
const padGap = Number.parseFloat(parameters.p);
|
|
4929
|
-
const
|
|
4951
|
+
const padWidth6 = Number.parseFloat(parameters.pw);
|
|
4930
4952
|
const length51 = Number.parseFloat(parameters.w);
|
|
4931
4953
|
pads.push(
|
|
4932
4954
|
rectpad(1, -1.85, -1.5, 1.5, 0.7),
|
|
@@ -6082,20 +6104,20 @@ var to92s_def = base_def.extend({
|
|
|
6082
6104
|
var to92s_3 = (parameters) => {
|
|
6083
6105
|
const { p, id, od, w, h } = parameters;
|
|
6084
6106
|
const holeY = Number.parseFloat(h) / 2;
|
|
6085
|
-
const
|
|
6107
|
+
const padSpacing6 = Number.parseFloat(p);
|
|
6086
6108
|
return [
|
|
6087
|
-
platedhole(1, -
|
|
6088
|
-
platedhole(2, 0, holeY -
|
|
6089
|
-
platedhole(3,
|
|
6109
|
+
platedhole(1, -padSpacing6, holeY - padSpacing6, id, od),
|
|
6110
|
+
platedhole(2, 0, holeY - padSpacing6, id, od),
|
|
6111
|
+
platedhole(3, padSpacing6, holeY - padSpacing6, id, od)
|
|
6090
6112
|
];
|
|
6091
6113
|
};
|
|
6092
6114
|
var to92s_2 = (parameters) => {
|
|
6093
6115
|
const { p, id, od, h } = parameters;
|
|
6094
6116
|
const holeY = Number.parseFloat(h) / 2;
|
|
6095
|
-
const
|
|
6117
|
+
const padSpacing6 = Number.parseFloat(p);
|
|
6096
6118
|
return [
|
|
6097
|
-
platedhole(1, -
|
|
6098
|
-
platedhole(2,
|
|
6119
|
+
platedhole(1, -padSpacing6, holeY - padSpacing6, id, od),
|
|
6120
|
+
platedhole(2, padSpacing6, holeY - padSpacing6, id, od)
|
|
6099
6121
|
];
|
|
6100
6122
|
};
|
|
6101
6123
|
var to92s = (raw_params) => {
|
|
@@ -6114,19 +6136,19 @@ var to92s = (raw_params) => {
|
|
|
6114
6136
|
throw new Error("Invalid number of pins for TO-92");
|
|
6115
6137
|
}
|
|
6116
6138
|
const holeY = Number.parseFloat(parameters.h) / 2;
|
|
6117
|
-
const
|
|
6139
|
+
const padSpacing6 = Number.parseFloat(parameters.p);
|
|
6118
6140
|
const silkscreenBody = {
|
|
6119
6141
|
type: "pcb_silkscreen_path",
|
|
6120
6142
|
layer: "top",
|
|
6121
6143
|
pcb_component_id: "",
|
|
6122
6144
|
route: [
|
|
6123
|
-
{ x: -holeY, y: holeY -
|
|
6145
|
+
{ x: -holeY, y: holeY - padSpacing6 },
|
|
6124
6146
|
{ x: -1.9, y: 0 },
|
|
6125
6147
|
{ x: 1.9, y: 0 },
|
|
6126
|
-
{ x: holeY, y: holeY -
|
|
6148
|
+
{ x: holeY, y: holeY - padSpacing6 },
|
|
6127
6149
|
{ x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
|
|
6128
6150
|
{ x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
|
|
6129
|
-
{ x: -holeY, y: holeY -
|
|
6151
|
+
{ x: -holeY, y: holeY - padSpacing6 }
|
|
6130
6152
|
],
|
|
6131
6153
|
stroke_width: 0.1,
|
|
6132
6154
|
pcb_silkscreen_path_id: ""
|
|
@@ -6905,13 +6927,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
|
|
|
6905
6927
|
import { length as length45 } from "circuit-json";
|
|
6906
6928
|
var solderjumper = (params) => {
|
|
6907
6929
|
const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
|
|
6908
|
-
const
|
|
6909
|
-
const
|
|
6910
|
-
const
|
|
6911
|
-
const traceWidth = Math.min(
|
|
6930
|
+
const padSpacing6 = length45.parse(p);
|
|
6931
|
+
const padWidth6 = length45.parse(pw);
|
|
6932
|
+
const padHeight6 = length45.parse(ph);
|
|
6933
|
+
const traceWidth = Math.min(padHeight6 / 4, 0.5);
|
|
6912
6934
|
const pads = [];
|
|
6913
6935
|
for (let i = 0; i < num_pins; i++) {
|
|
6914
|
-
pads.push(rectpad(i + 1, i *
|
|
6936
|
+
pads.push(rectpad(i + 1, i * padSpacing6, 0, padWidth6, padHeight6));
|
|
6915
6937
|
}
|
|
6916
6938
|
let traces = [];
|
|
6917
6939
|
if (bridged) {
|
|
@@ -6921,11 +6943,11 @@ var solderjumper = (params) => {
|
|
|
6921
6943
|
const from = pins[i];
|
|
6922
6944
|
const to = pins[i + 1];
|
|
6923
6945
|
if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
|
|
6924
|
-
const xCenterFrom = (from - 1) *
|
|
6925
|
-
const xCenterTo = (to - 1) *
|
|
6946
|
+
const xCenterFrom = (from - 1) * padSpacing6;
|
|
6947
|
+
const xCenterTo = (to - 1) * padSpacing6;
|
|
6926
6948
|
const directionMult = Math.sign(xCenterTo - xCenterFrom);
|
|
6927
|
-
const x1 = xCenterFrom + directionMult * (
|
|
6928
|
-
const x2 = xCenterTo - directionMult * (
|
|
6949
|
+
const x1 = xCenterFrom + directionMult * (padWidth6 / 2);
|
|
6950
|
+
const x2 = xCenterTo - directionMult * (padWidth6 / 2);
|
|
6929
6951
|
traces.push({
|
|
6930
6952
|
type: "pcb_trace",
|
|
6931
6953
|
pcb_trace_id: "",
|
|
@@ -6952,9 +6974,9 @@ var solderjumper = (params) => {
|
|
|
6952
6974
|
}
|
|
6953
6975
|
}
|
|
6954
6976
|
}
|
|
6955
|
-
const outlineWidth = (num_pins - 1) *
|
|
6956
|
-
const outlineHeight =
|
|
6957
|
-
const outlineCenterX = (num_pins - 1) *
|
|
6977
|
+
const outlineWidth = (num_pins - 1) * padSpacing6 + padWidth6 + 0.7;
|
|
6978
|
+
const outlineHeight = padHeight6 + 1;
|
|
6979
|
+
const outlineCenterX = (num_pins - 1) * padSpacing6 / 2;
|
|
6958
6980
|
const outlineCenterY = 0;
|
|
6959
6981
|
const silkscreenRect = {
|
|
6960
6982
|
type: "pcb_silkscreen_path",
|
|
@@ -7055,40 +7077,40 @@ var generateSot457Elements = (params) => {
|
|
|
7055
7077
|
const pads = [];
|
|
7056
7078
|
const pitch = parseDimension(params.p);
|
|
7057
7079
|
const padLength = parseDimension(params.pl);
|
|
7058
|
-
const
|
|
7080
|
+
const padWidth6 = parseDimension(params.pw);
|
|
7059
7081
|
const width = parseDimension(params.w);
|
|
7060
7082
|
const height = parseDimension(params.h);
|
|
7061
7083
|
if (params.wave) {
|
|
7062
7084
|
const pinConfigs = {
|
|
7063
|
-
1: ({ padWidth:
|
|
7064
|
-
2: ({ padWidth:
|
|
7065
|
-
3: ({ padWidth:
|
|
7085
|
+
1: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(1, -pitch, pitch, padHeight6, padWidth7),
|
|
7086
|
+
2: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(2, -pitch, -pitch, padHeight6, padWidth7),
|
|
7087
|
+
3: ({ padWidth: padWidth7, padHeight: padHeight6 }) => pillpad(
|
|
7066
7088
|
3,
|
|
7067
7089
|
-pitch,
|
|
7068
7090
|
0,
|
|
7069
7091
|
parseDimension(params.pillw),
|
|
7070
7092
|
parseDimension(params.pillh)
|
|
7071
7093
|
),
|
|
7072
|
-
4: ({ padWidth:
|
|
7094
|
+
4: ({ padWidth: padWidth7, padHeight: padHeight6 }) => pillpad(
|
|
7073
7095
|
4,
|
|
7074
7096
|
pitch,
|
|
7075
7097
|
0,
|
|
7076
7098
|
parseDimension(params.pillw),
|
|
7077
7099
|
parseDimension(params.pillh)
|
|
7078
7100
|
),
|
|
7079
|
-
5: ({ padWidth:
|
|
7080
|
-
6: ({ padWidth:
|
|
7101
|
+
5: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(5, pitch, pitch, padHeight6, padWidth7),
|
|
7102
|
+
6: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(6, pitch, -pitch, padHeight6, padWidth7)
|
|
7081
7103
|
};
|
|
7082
7104
|
for (let i = 1; i <= params.num_pins; i++) {
|
|
7083
7105
|
const config = pinConfigs[i];
|
|
7084
7106
|
if (config) {
|
|
7085
|
-
pads.push(config({ padWidth: padLength, padHeight:
|
|
7107
|
+
pads.push(config({ padWidth: padLength, padHeight: padWidth6 }));
|
|
7086
7108
|
}
|
|
7087
7109
|
}
|
|
7088
7110
|
} else {
|
|
7089
7111
|
for (let i = 1; i <= params.num_pins; i++) {
|
|
7090
7112
|
const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
|
|
7091
|
-
pads.push(rectpad(i, x, y, padLength,
|
|
7113
|
+
pads.push(rectpad(i, x, y, padLength, padWidth6));
|
|
7092
7114
|
}
|
|
7093
7115
|
}
|
|
7094
7116
|
const silkscreenPath1 = {
|
|
@@ -7117,7 +7139,7 @@ var generateSot457Elements = (params) => {
|
|
|
7117
7139
|
const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
|
|
7118
7140
|
const triangleHeight = params.wave ? 1 : 0.5;
|
|
7119
7141
|
const triangleWidth = params.wave ? 0.7 : 0.3;
|
|
7120
|
-
pin1Position.x -= params.wave ?
|
|
7142
|
+
pin1Position.x -= params.wave ? padWidth6 : padWidth6 * 1.7;
|
|
7121
7143
|
const pin1Indicator = {
|
|
7122
7144
|
type: "pcb_silkscreen_path",
|
|
7123
7145
|
layer: "top",
|
|
@@ -7979,7 +8001,7 @@ var m2host_def = base_def.extend({
|
|
|
7979
8001
|
var m2host = (raw_params) => {
|
|
7980
8002
|
const parameters = m2host_def.parse(raw_params);
|
|
7981
8003
|
const pads = [];
|
|
7982
|
-
const
|
|
8004
|
+
const padWidth6 = 0.5 - 0.15;
|
|
7983
8005
|
const padLength = 1.5;
|
|
7984
8006
|
const pitch = 0.5;
|
|
7985
8007
|
const halfPitch = pitch / 2;
|
|
@@ -7994,7 +8016,7 @@ var m2host = (raw_params) => {
|
|
|
7994
8016
|
const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
|
|
7995
8017
|
const rightEdgeOffset = 0.5;
|
|
7996
8018
|
const x = rightEdgeOffset - padLengthWithOffset / 2;
|
|
7997
|
-
const pad2 = rectpad(pn, x, y, padLengthWithOffset,
|
|
8019
|
+
const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth6);
|
|
7998
8020
|
pad2.layer = isBottomLayer ? "bottom" : "top";
|
|
7999
8021
|
pads.push(pad2);
|
|
8000
8022
|
}
|