@tscircuit/footprinter 0.0.286 → 0.0.287
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: padSpacing7, padWidth: padWidth7, padHeight: padHeight7, padPitch: padPitch7, numRows, textbottom } = params;
|
|
523
523
|
const yPositions = [];
|
|
524
|
-
const halfRange = (numRows - 1) * (
|
|
524
|
+
const halfRange = (numRows - 1) * (padPitch7 / 2);
|
|
525
525
|
for (let i = 0; i < numRows; i++) {
|
|
526
|
-
yPositions.push(halfRange - i *
|
|
526
|
+
yPositions.push(halfRange - i * padPitch7);
|
|
527
527
|
}
|
|
528
528
|
const pads = [];
|
|
529
529
|
yPositions.forEach((y, index) => {
|
|
530
|
-
pads.push(rectpad(index + 1, -
|
|
530
|
+
pads.push(rectpad(index + 1, -padSpacing7 / 2, y, padWidth7, padHeight7));
|
|
531
531
|
});
|
|
532
532
|
yPositions.slice().reverse().forEach((y, index) => {
|
|
533
533
|
pads.push(
|
|
534
|
-
rectpad(index + numRows + 1,
|
|
534
|
+
rectpad(index + numRows + 1, padSpacing7 / 2, y, padWidth7, padHeight7)
|
|
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) + padHeight7 / 2 + 0.4;
|
|
538
|
+
const bottom = Math.min(...yPositions) - padHeight7 / 2 - 0.4;
|
|
539
|
+
const left = -padSpacing7 / 2 - padWidth7 / 2 - 0.4;
|
|
540
|
+
const right = padSpacing7 / 2 + padWidth7 / 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 = -padSpacing7 / 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 - padWidth7 / 2 - 0.1;
|
|
567
|
+
const pin1Top = pin1Y + padHeight7 / 2 + 0.1;
|
|
568
568
|
const pin1Marker = {
|
|
569
569
|
type: "pcb_silkscreen_path",
|
|
570
570
|
layer: "top",
|
|
@@ -669,6 +669,22 @@ var res0606Array2 = (params) => {
|
|
|
669
669
|
});
|
|
670
670
|
};
|
|
671
671
|
|
|
672
|
+
// src/helpers/res1206-array4.ts
|
|
673
|
+
var padSpacing6 = 3;
|
|
674
|
+
var padWidth6 = 0.9;
|
|
675
|
+
var padHeight6 = 0.9;
|
|
676
|
+
var padPitch6 = 1.34;
|
|
677
|
+
var res1206Array4 = (params) => {
|
|
678
|
+
return chipArray({
|
|
679
|
+
padSpacing: padSpacing6,
|
|
680
|
+
padWidth: padWidth6,
|
|
681
|
+
padHeight: padHeight6,
|
|
682
|
+
padPitch: padPitch6,
|
|
683
|
+
numRows: 4,
|
|
684
|
+
textbottom: params.textbottom
|
|
685
|
+
});
|
|
686
|
+
};
|
|
687
|
+
|
|
672
688
|
// src/fn/res.ts
|
|
673
689
|
var getArrayCount = (parameters) => {
|
|
674
690
|
const arrayValue = parameters.array ?? parameters.x;
|
|
@@ -726,6 +742,12 @@ var res = (rawParameters) => {
|
|
|
726
742
|
parameters: rawParameters
|
|
727
743
|
};
|
|
728
744
|
}
|
|
745
|
+
if (arrayCount === 4 && imperialBase === "1206") {
|
|
746
|
+
return {
|
|
747
|
+
circuitJson: res1206Array4(rawParameters),
|
|
748
|
+
parameters: rawParameters
|
|
749
|
+
};
|
|
750
|
+
}
|
|
729
751
|
return { circuitJson: passive(rawParameters), parameters: rawParameters };
|
|
730
752
|
};
|
|
731
753
|
|
|
@@ -3872,41 +3894,41 @@ var to92 = (raw_params) => {
|
|
|
3872
3894
|
});
|
|
3873
3895
|
const { p, id, od, w, h, inline } = parameters;
|
|
3874
3896
|
const holeY = Number.parseFloat(h) / 2;
|
|
3875
|
-
const
|
|
3897
|
+
const padSpacing7 = Number.parseFloat(p);
|
|
3876
3898
|
const holeDia = Number.parseFloat(id);
|
|
3877
3899
|
const padDia = Number.parseFloat(od);
|
|
3878
|
-
const
|
|
3879
|
-
const
|
|
3900
|
+
const padWidth7 = padDia;
|
|
3901
|
+
const padHeight7 = padDia * (1.5 / 1.05);
|
|
3880
3902
|
let platedHoles = [];
|
|
3881
3903
|
if (parameters.num_pins === 3) {
|
|
3882
3904
|
if (inline) {
|
|
3883
3905
|
platedHoles = [
|
|
3884
3906
|
platedHoleWithRectPad(
|
|
3885
3907
|
1,
|
|
3886
|
-
-
|
|
3887
|
-
holeY -
|
|
3908
|
+
-padSpacing7,
|
|
3909
|
+
holeY - padSpacing7,
|
|
3888
3910
|
holeDia,
|
|
3889
3911
|
padDia,
|
|
3890
|
-
|
|
3912
|
+
padHeight7,
|
|
3891
3913
|
0,
|
|
3892
3914
|
0
|
|
3893
3915
|
),
|
|
3894
|
-
platedHolePill(2, 0, holeY -
|
|
3916
|
+
platedHolePill(2, 0, holeY - padSpacing7, holeDia, padWidth7, padHeight7),
|
|
3895
3917
|
platedHolePill(
|
|
3896
3918
|
3,
|
|
3897
|
-
|
|
3898
|
-
holeY -
|
|
3919
|
+
padSpacing7,
|
|
3920
|
+
holeY - padSpacing7,
|
|
3899
3921
|
holeDia,
|
|
3900
|
-
|
|
3901
|
-
|
|
3922
|
+
padWidth7,
|
|
3923
|
+
padHeight7
|
|
3902
3924
|
)
|
|
3903
3925
|
];
|
|
3904
3926
|
} else {
|
|
3905
3927
|
platedHoles = [
|
|
3906
3928
|
platedHoleWithRectPad(
|
|
3907
3929
|
1,
|
|
3908
|
-
-
|
|
3909
|
-
holeY -
|
|
3930
|
+
-padSpacing7,
|
|
3931
|
+
holeY - padSpacing7,
|
|
3910
3932
|
holeDia,
|
|
3911
3933
|
padDia,
|
|
3912
3934
|
padDia,
|
|
@@ -3914,28 +3936,28 @@ var to92 = (raw_params) => {
|
|
|
3914
3936
|
0
|
|
3915
3937
|
),
|
|
3916
3938
|
platedhole(2, 0, holeY, holeDia, padDia),
|
|
3917
|
-
platedhole(3,
|
|
3939
|
+
platedhole(3, padSpacing7, holeY - padSpacing7, holeDia, padDia)
|
|
3918
3940
|
];
|
|
3919
3941
|
}
|
|
3920
3942
|
} else if (parameters.num_pins === 2) {
|
|
3921
3943
|
platedHoles = [
|
|
3922
3944
|
platedHoleWithRectPad(
|
|
3923
3945
|
1,
|
|
3924
|
-
-
|
|
3925
|
-
holeY -
|
|
3946
|
+
-padSpacing7,
|
|
3947
|
+
holeY - padSpacing7,
|
|
3926
3948
|
holeDia,
|
|
3927
|
-
|
|
3928
|
-
|
|
3949
|
+
padWidth7,
|
|
3950
|
+
padHeight7,
|
|
3929
3951
|
0,
|
|
3930
3952
|
0
|
|
3931
3953
|
),
|
|
3932
3954
|
platedHolePill(
|
|
3933
3955
|
2,
|
|
3934
|
-
|
|
3935
|
-
holeY -
|
|
3956
|
+
padSpacing7,
|
|
3957
|
+
holeY - padSpacing7,
|
|
3936
3958
|
holeDia,
|
|
3937
|
-
|
|
3938
|
-
|
|
3959
|
+
padWidth7,
|
|
3960
|
+
padHeight7
|
|
3939
3961
|
)
|
|
3940
3962
|
];
|
|
3941
3963
|
} else {
|
|
@@ -4901,15 +4923,15 @@ var sot89_def = base_def.extend({
|
|
|
4901
4923
|
var sot89_3 = (parameters) => {
|
|
4902
4924
|
const pads = [];
|
|
4903
4925
|
const padGap = Number.parseFloat(parameters.p);
|
|
4904
|
-
const
|
|
4926
|
+
const padWidth7 = Number.parseFloat(parameters.pw);
|
|
4905
4927
|
const length51 = Number.parseFloat(parameters.w);
|
|
4906
|
-
const
|
|
4928
|
+
const padHeight7 = Number.parseFloat(parameters.pl);
|
|
4907
4929
|
const centerExtra = 0.175;
|
|
4908
|
-
const outerPadXShift = (
|
|
4930
|
+
const outerPadXShift = (padHeight7 - (padHeight7 + centerExtra)) / 2;
|
|
4909
4931
|
pads.push(
|
|
4910
|
-
rectpad(1, -length51 / 2 + outerPadXShift, padGap,
|
|
4911
|
-
rectpad(2, -length51 / 2, 0,
|
|
4912
|
-
rectpad(3, -length51 / 2 + outerPadXShift, -padGap,
|
|
4932
|
+
rectpad(1, -length51 / 2 + outerPadXShift, padGap, padHeight7, padWidth7),
|
|
4933
|
+
rectpad(2, -length51 / 2, 0, padHeight7 + centerExtra, padWidth7),
|
|
4934
|
+
rectpad(3, -length51 / 2 + outerPadXShift, -padGap, padHeight7, padWidth7)
|
|
4913
4935
|
);
|
|
4914
4936
|
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
4915
4937
|
const width = Number.parseFloat(parameters.w) / 2 - 1;
|
|
@@ -4948,7 +4970,7 @@ var sot89_3 = (parameters) => {
|
|
|
4948
4970
|
var sot89_5 = (parameters) => {
|
|
4949
4971
|
const pads = [];
|
|
4950
4972
|
const padGap = Number.parseFloat(parameters.p);
|
|
4951
|
-
const
|
|
4973
|
+
const padWidth7 = Number.parseFloat(parameters.pw);
|
|
4952
4974
|
const length51 = Number.parseFloat(parameters.w);
|
|
4953
4975
|
pads.push(
|
|
4954
4976
|
rectpad(1, -1.85, -1.5, 1.5, 0.7),
|
|
@@ -6104,20 +6126,20 @@ var to92s_def = base_def.extend({
|
|
|
6104
6126
|
var to92s_3 = (parameters) => {
|
|
6105
6127
|
const { p, id, od, w, h } = parameters;
|
|
6106
6128
|
const holeY = Number.parseFloat(h) / 2;
|
|
6107
|
-
const
|
|
6129
|
+
const padSpacing7 = Number.parseFloat(p);
|
|
6108
6130
|
return [
|
|
6109
|
-
platedhole(1, -
|
|
6110
|
-
platedhole(2, 0, holeY -
|
|
6111
|
-
platedhole(3,
|
|
6131
|
+
platedhole(1, -padSpacing7, holeY - padSpacing7, id, od),
|
|
6132
|
+
platedhole(2, 0, holeY - padSpacing7, id, od),
|
|
6133
|
+
platedhole(3, padSpacing7, holeY - padSpacing7, id, od)
|
|
6112
6134
|
];
|
|
6113
6135
|
};
|
|
6114
6136
|
var to92s_2 = (parameters) => {
|
|
6115
6137
|
const { p, id, od, h } = parameters;
|
|
6116
6138
|
const holeY = Number.parseFloat(h) / 2;
|
|
6117
|
-
const
|
|
6139
|
+
const padSpacing7 = Number.parseFloat(p);
|
|
6118
6140
|
return [
|
|
6119
|
-
platedhole(1, -
|
|
6120
|
-
platedhole(2,
|
|
6141
|
+
platedhole(1, -padSpacing7, holeY - padSpacing7, id, od),
|
|
6142
|
+
platedhole(2, padSpacing7, holeY - padSpacing7, id, od)
|
|
6121
6143
|
];
|
|
6122
6144
|
};
|
|
6123
6145
|
var to92s = (raw_params) => {
|
|
@@ -6136,19 +6158,19 @@ var to92s = (raw_params) => {
|
|
|
6136
6158
|
throw new Error("Invalid number of pins for TO-92");
|
|
6137
6159
|
}
|
|
6138
6160
|
const holeY = Number.parseFloat(parameters.h) / 2;
|
|
6139
|
-
const
|
|
6161
|
+
const padSpacing7 = Number.parseFloat(parameters.p);
|
|
6140
6162
|
const silkscreenBody = {
|
|
6141
6163
|
type: "pcb_silkscreen_path",
|
|
6142
6164
|
layer: "top",
|
|
6143
6165
|
pcb_component_id: "",
|
|
6144
6166
|
route: [
|
|
6145
|
-
{ x: -holeY, y: holeY -
|
|
6167
|
+
{ x: -holeY, y: holeY - padSpacing7 },
|
|
6146
6168
|
{ x: -1.9, y: 0 },
|
|
6147
6169
|
{ x: 1.9, y: 0 },
|
|
6148
|
-
{ x: holeY, y: holeY -
|
|
6170
|
+
{ x: holeY, y: holeY - padSpacing7 },
|
|
6149
6171
|
{ x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
|
|
6150
6172
|
{ x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
|
|
6151
|
-
{ x: -holeY, y: holeY -
|
|
6173
|
+
{ x: -holeY, y: holeY - padSpacing7 }
|
|
6152
6174
|
],
|
|
6153
6175
|
stroke_width: 0.1,
|
|
6154
6176
|
pcb_silkscreen_path_id: ""
|
|
@@ -6927,13 +6949,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
|
|
|
6927
6949
|
import { length as length45 } from "circuit-json";
|
|
6928
6950
|
var solderjumper = (params) => {
|
|
6929
6951
|
const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
|
|
6930
|
-
const
|
|
6931
|
-
const
|
|
6932
|
-
const
|
|
6933
|
-
const traceWidth = Math.min(
|
|
6952
|
+
const padSpacing7 = length45.parse(p);
|
|
6953
|
+
const padWidth7 = length45.parse(pw);
|
|
6954
|
+
const padHeight7 = length45.parse(ph);
|
|
6955
|
+
const traceWidth = Math.min(padHeight7 / 4, 0.5);
|
|
6934
6956
|
const pads = [];
|
|
6935
6957
|
for (let i = 0; i < num_pins; i++) {
|
|
6936
|
-
pads.push(rectpad(i + 1, i *
|
|
6958
|
+
pads.push(rectpad(i + 1, i * padSpacing7, 0, padWidth7, padHeight7));
|
|
6937
6959
|
}
|
|
6938
6960
|
let traces = [];
|
|
6939
6961
|
if (bridged) {
|
|
@@ -6943,11 +6965,11 @@ var solderjumper = (params) => {
|
|
|
6943
6965
|
const from = pins[i];
|
|
6944
6966
|
const to = pins[i + 1];
|
|
6945
6967
|
if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
|
|
6946
|
-
const xCenterFrom = (from - 1) *
|
|
6947
|
-
const xCenterTo = (to - 1) *
|
|
6968
|
+
const xCenterFrom = (from - 1) * padSpacing7;
|
|
6969
|
+
const xCenterTo = (to - 1) * padSpacing7;
|
|
6948
6970
|
const directionMult = Math.sign(xCenterTo - xCenterFrom);
|
|
6949
|
-
const x1 = xCenterFrom + directionMult * (
|
|
6950
|
-
const x2 = xCenterTo - directionMult * (
|
|
6971
|
+
const x1 = xCenterFrom + directionMult * (padWidth7 / 2);
|
|
6972
|
+
const x2 = xCenterTo - directionMult * (padWidth7 / 2);
|
|
6951
6973
|
traces.push({
|
|
6952
6974
|
type: "pcb_trace",
|
|
6953
6975
|
pcb_trace_id: "",
|
|
@@ -6974,9 +6996,9 @@ var solderjumper = (params) => {
|
|
|
6974
6996
|
}
|
|
6975
6997
|
}
|
|
6976
6998
|
}
|
|
6977
|
-
const outlineWidth = (num_pins - 1) *
|
|
6978
|
-
const outlineHeight =
|
|
6979
|
-
const outlineCenterX = (num_pins - 1) *
|
|
6999
|
+
const outlineWidth = (num_pins - 1) * padSpacing7 + padWidth7 + 0.7;
|
|
7000
|
+
const outlineHeight = padHeight7 + 1;
|
|
7001
|
+
const outlineCenterX = (num_pins - 1) * padSpacing7 / 2;
|
|
6980
7002
|
const outlineCenterY = 0;
|
|
6981
7003
|
const silkscreenRect = {
|
|
6982
7004
|
type: "pcb_silkscreen_path",
|
|
@@ -7077,40 +7099,40 @@ var generateSot457Elements = (params) => {
|
|
|
7077
7099
|
const pads = [];
|
|
7078
7100
|
const pitch = parseDimension(params.p);
|
|
7079
7101
|
const padLength = parseDimension(params.pl);
|
|
7080
|
-
const
|
|
7102
|
+
const padWidth7 = parseDimension(params.pw);
|
|
7081
7103
|
const width = parseDimension(params.w);
|
|
7082
7104
|
const height = parseDimension(params.h);
|
|
7083
7105
|
if (params.wave) {
|
|
7084
7106
|
const pinConfigs = {
|
|
7085
|
-
1: ({ padWidth:
|
|
7086
|
-
2: ({ padWidth:
|
|
7087
|
-
3: ({ padWidth:
|
|
7107
|
+
1: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(1, -pitch, pitch, padHeight7, padWidth8),
|
|
7108
|
+
2: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(2, -pitch, -pitch, padHeight7, padWidth8),
|
|
7109
|
+
3: ({ padWidth: padWidth8, padHeight: padHeight7 }) => pillpad(
|
|
7088
7110
|
3,
|
|
7089
7111
|
-pitch,
|
|
7090
7112
|
0,
|
|
7091
7113
|
parseDimension(params.pillw),
|
|
7092
7114
|
parseDimension(params.pillh)
|
|
7093
7115
|
),
|
|
7094
|
-
4: ({ padWidth:
|
|
7116
|
+
4: ({ padWidth: padWidth8, padHeight: padHeight7 }) => pillpad(
|
|
7095
7117
|
4,
|
|
7096
7118
|
pitch,
|
|
7097
7119
|
0,
|
|
7098
7120
|
parseDimension(params.pillw),
|
|
7099
7121
|
parseDimension(params.pillh)
|
|
7100
7122
|
),
|
|
7101
|
-
5: ({ padWidth:
|
|
7102
|
-
6: ({ padWidth:
|
|
7123
|
+
5: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(5, pitch, pitch, padHeight7, padWidth8),
|
|
7124
|
+
6: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(6, pitch, -pitch, padHeight7, padWidth8)
|
|
7103
7125
|
};
|
|
7104
7126
|
for (let i = 1; i <= params.num_pins; i++) {
|
|
7105
7127
|
const config = pinConfigs[i];
|
|
7106
7128
|
if (config) {
|
|
7107
|
-
pads.push(config({ padWidth: padLength, padHeight:
|
|
7129
|
+
pads.push(config({ padWidth: padLength, padHeight: padWidth7 }));
|
|
7108
7130
|
}
|
|
7109
7131
|
}
|
|
7110
7132
|
} else {
|
|
7111
7133
|
for (let i = 1; i <= params.num_pins; i++) {
|
|
7112
7134
|
const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
|
|
7113
|
-
pads.push(rectpad(i, x, y, padLength,
|
|
7135
|
+
pads.push(rectpad(i, x, y, padLength, padWidth7));
|
|
7114
7136
|
}
|
|
7115
7137
|
}
|
|
7116
7138
|
const silkscreenPath1 = {
|
|
@@ -7139,7 +7161,7 @@ var generateSot457Elements = (params) => {
|
|
|
7139
7161
|
const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
|
|
7140
7162
|
const triangleHeight = params.wave ? 1 : 0.5;
|
|
7141
7163
|
const triangleWidth = params.wave ? 0.7 : 0.3;
|
|
7142
|
-
pin1Position.x -= params.wave ?
|
|
7164
|
+
pin1Position.x -= params.wave ? padWidth7 : padWidth7 * 1.7;
|
|
7143
7165
|
const pin1Indicator = {
|
|
7144
7166
|
type: "pcb_silkscreen_path",
|
|
7145
7167
|
layer: "top",
|
|
@@ -8001,7 +8023,7 @@ var m2host_def = base_def.extend({
|
|
|
8001
8023
|
var m2host = (raw_params) => {
|
|
8002
8024
|
const parameters = m2host_def.parse(raw_params);
|
|
8003
8025
|
const pads = [];
|
|
8004
|
-
const
|
|
8026
|
+
const padWidth7 = 0.5 - 0.15;
|
|
8005
8027
|
const padLength = 1.5;
|
|
8006
8028
|
const pitch = 0.5;
|
|
8007
8029
|
const halfPitch = pitch / 2;
|
|
@@ -8016,7 +8038,7 @@ var m2host = (raw_params) => {
|
|
|
8016
8038
|
const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
|
|
8017
8039
|
const rightEdgeOffset = 0.5;
|
|
8018
8040
|
const x = rightEdgeOffset - padLengthWithOffset / 2;
|
|
8019
|
-
const pad2 = rectpad(pn, x, y, padLengthWithOffset,
|
|
8041
|
+
const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth7);
|
|
8020
8042
|
pad2.layer = isBottomLayer ? "bottom" : "top";
|
|
8021
8043
|
pads.push(pad2);
|
|
8022
8044
|
}
|