@tscircuit/footprinter 0.0.178 → 0.0.179
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 +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1067,6 +1067,7 @@ type Footprinter = {
|
|
|
1067
1067
|
sot563: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw">;
|
|
1068
1068
|
sot723: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
|
|
1069
1069
|
sot23: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
|
|
1070
|
+
sot: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1070
1071
|
sot323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1071
1072
|
sot89: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw" | "h">;
|
|
1072
1073
|
sod323w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ __export(fn_exports, {
|
|
|
60
60
|
solderjumper: () => solderjumper,
|
|
61
61
|
son: () => son,
|
|
62
62
|
sop8: () => sop8,
|
|
63
|
+
sot: () => sot,
|
|
63
64
|
sot223: () => sot223,
|
|
64
65
|
sot23: () => sot23,
|
|
65
66
|
sot23w: () => sot23w,
|
|
@@ -6693,6 +6694,130 @@ var platedhole3 = (raw_params) => {
|
|
|
6693
6694
|
};
|
|
6694
6695
|
};
|
|
6695
6696
|
|
|
6697
|
+
// src/fn/sot.ts
|
|
6698
|
+
import { z as z59 } from "zod";
|
|
6699
|
+
var sot_def = z59.object({
|
|
6700
|
+
fn: z59.string(),
|
|
6701
|
+
num_pins: z59.literal(6).default(6),
|
|
6702
|
+
h: z59.string().default("1.6mm"),
|
|
6703
|
+
pl: z59.string().default("1mm"),
|
|
6704
|
+
pw: z59.string().default("0.7mm"),
|
|
6705
|
+
p: z59.string().default("0.95mm")
|
|
6706
|
+
});
|
|
6707
|
+
var sot = (raw_params) => {
|
|
6708
|
+
const parameters = sot_def.parse(raw_params);
|
|
6709
|
+
return {
|
|
6710
|
+
circuitJson: sotWithoutParsing(parameters),
|
|
6711
|
+
parameters
|
|
6712
|
+
};
|
|
6713
|
+
};
|
|
6714
|
+
var getCcwSotCoords = (parameters) => {
|
|
6715
|
+
const { p, h, pn } = parameters;
|
|
6716
|
+
if (pn === 1) {
|
|
6717
|
+
return { x: -h / 2 - 0.5, y: p };
|
|
6718
|
+
}
|
|
6719
|
+
if (pn === 2) {
|
|
6720
|
+
return { x: -h / 2 - 0.5, y: 0 };
|
|
6721
|
+
}
|
|
6722
|
+
if (pn === 3) {
|
|
6723
|
+
return { x: -h / 2 - 0.5, y: -p };
|
|
6724
|
+
}
|
|
6725
|
+
if (pn === 4) {
|
|
6726
|
+
return { x: h / 2 + 0.5, y: -p };
|
|
6727
|
+
}
|
|
6728
|
+
if (pn === 5) {
|
|
6729
|
+
return { x: h / 2 + 0.5, y: 0 };
|
|
6730
|
+
}
|
|
6731
|
+
if (pn === 6) {
|
|
6732
|
+
return { x: h / 2 + 0.5, y: p };
|
|
6733
|
+
}
|
|
6734
|
+
throw new Error("Invalid pin number");
|
|
6735
|
+
};
|
|
6736
|
+
var sotWithoutParsing = (parameters) => {
|
|
6737
|
+
const pads = [];
|
|
6738
|
+
for (let i = 1; i <= parameters.num_pins; i++) {
|
|
6739
|
+
const { x, y } = getCcwSotCoords({
|
|
6740
|
+
h: Number.parseFloat(parameters.h),
|
|
6741
|
+
p: Number.parseFloat(parameters.p),
|
|
6742
|
+
pn: i
|
|
6743
|
+
});
|
|
6744
|
+
pads.push(
|
|
6745
|
+
rectpad(
|
|
6746
|
+
i,
|
|
6747
|
+
x,
|
|
6748
|
+
y,
|
|
6749
|
+
Number.parseFloat(parameters.pl),
|
|
6750
|
+
Number.parseFloat(parameters.pw)
|
|
6751
|
+
)
|
|
6752
|
+
);
|
|
6753
|
+
}
|
|
6754
|
+
const width = parameters.num_pins / 2 * Number.parseFloat(parameters.p);
|
|
6755
|
+
const height = Number.parseFloat(parameters.h);
|
|
6756
|
+
const silkscreenPath1 = {
|
|
6757
|
+
layer: "top",
|
|
6758
|
+
pcb_component_id: "",
|
|
6759
|
+
pcb_silkscreen_path_id: "silkscreen_path_1",
|
|
6760
|
+
route: [
|
|
6761
|
+
{ x: -width / 3, y: height / 2 + Number.parseFloat(parameters.p) / 1.3 },
|
|
6762
|
+
{ x: width / 3, y: height / 2 + Number.parseFloat(parameters.p) / 1.3 }
|
|
6763
|
+
],
|
|
6764
|
+
type: "pcb_silkscreen_path",
|
|
6765
|
+
stroke_width: 0.05
|
|
6766
|
+
};
|
|
6767
|
+
const silkscreenPath2 = {
|
|
6768
|
+
layer: "top",
|
|
6769
|
+
pcb_component_id: "",
|
|
6770
|
+
pcb_silkscreen_path_id: "silkscreen_path_2",
|
|
6771
|
+
route: [
|
|
6772
|
+
{ x: -width / 3, y: -height / 2 - Number.parseFloat(parameters.p) / 1.3 },
|
|
6773
|
+
{ x: width / 3, y: -height / 2 - Number.parseFloat(parameters.p) / 1.3 }
|
|
6774
|
+
],
|
|
6775
|
+
type: "pcb_silkscreen_path",
|
|
6776
|
+
stroke_width: 0.05
|
|
6777
|
+
};
|
|
6778
|
+
const silkscreenRefText = silkscreenRef(0, height + 0.3, 0.3);
|
|
6779
|
+
const pin1Position = getCcwSotCoords({
|
|
6780
|
+
h: Number.parseFloat(parameters.h),
|
|
6781
|
+
p: Number.parseFloat(parameters.p),
|
|
6782
|
+
pn: 1
|
|
6783
|
+
});
|
|
6784
|
+
pin1Position.x = pin1Position.x - Number.parseFloat(parameters.pw) * 1.5;
|
|
6785
|
+
const triangleHeight = 0.7;
|
|
6786
|
+
const triangleWidth = 0.3;
|
|
6787
|
+
const pin1Indicator = {
|
|
6788
|
+
type: "pcb_silkscreen_path",
|
|
6789
|
+
layer: "top",
|
|
6790
|
+
pcb_component_id: "",
|
|
6791
|
+
pcb_silkscreen_path_id: "pin1_indicator",
|
|
6792
|
+
route: [
|
|
6793
|
+
{
|
|
6794
|
+
x: pin1Position.x + triangleHeight / 2,
|
|
6795
|
+
y: pin1Position.y
|
|
6796
|
+
},
|
|
6797
|
+
{
|
|
6798
|
+
x: pin1Position.x - triangleHeight / 2,
|
|
6799
|
+
y: pin1Position.y + triangleWidth / 2
|
|
6800
|
+
},
|
|
6801
|
+
{
|
|
6802
|
+
x: pin1Position.x - triangleHeight / 2,
|
|
6803
|
+
y: pin1Position.y - triangleWidth / 2
|
|
6804
|
+
},
|
|
6805
|
+
{
|
|
6806
|
+
x: pin1Position.x + triangleHeight / 2,
|
|
6807
|
+
y: pin1Position.y
|
|
6808
|
+
}
|
|
6809
|
+
],
|
|
6810
|
+
stroke_width: 0.05
|
|
6811
|
+
};
|
|
6812
|
+
return [
|
|
6813
|
+
...pads,
|
|
6814
|
+
silkscreenRefText,
|
|
6815
|
+
silkscreenPath1,
|
|
6816
|
+
silkscreenPath2,
|
|
6817
|
+
pin1Indicator
|
|
6818
|
+
];
|
|
6819
|
+
};
|
|
6820
|
+
|
|
6696
6821
|
// src/helpers/is-not-null.ts
|
|
6697
6822
|
function isNotNull(value) {
|
|
6698
6823
|
return value !== null;
|