@tscircuit/footprinter 0.0.120 → 0.0.121
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 +81 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1004,6 +1004,7 @@ type Footprinter = {
|
|
|
1004
1004
|
to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
|
|
1005
1005
|
minimelf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
|
|
1006
1006
|
lqfp: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
|
|
1007
|
+
smb: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1007
1008
|
sod923: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1008
1009
|
pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
|
|
1009
1010
|
stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ __export(fn_exports, {
|
|
|
30
30
|
qfp: () => qfp,
|
|
31
31
|
quad: () => quad,
|
|
32
32
|
res: () => res,
|
|
33
|
+
smb: () => smb,
|
|
33
34
|
sod123: () => sod123,
|
|
34
35
|
sod123f: () => sod123f,
|
|
35
36
|
sod128: () => sod128,
|
|
@@ -3651,6 +3652,86 @@ var microMelfWithoutParsing = (parameters) => {
|
|
|
3651
3652
|
return pads;
|
|
3652
3653
|
};
|
|
3653
3654
|
|
|
3655
|
+
// src/fn/smb.ts
|
|
3656
|
+
import { z as z35 } from "zod";
|
|
3657
|
+
import { length as length29 } from "circuit-json";
|
|
3658
|
+
var smb_def = z35.object({
|
|
3659
|
+
fn: z35.string(),
|
|
3660
|
+
num_pins: z35.literal(2).default(2),
|
|
3661
|
+
w: z35.string().default("7.30mm"),
|
|
3662
|
+
h: z35.string().default("4.40mm"),
|
|
3663
|
+
pl: z35.string().default("2.50mm"),
|
|
3664
|
+
pw: z35.string().default("2.30mm"),
|
|
3665
|
+
p: z35.string().default("4.30mm")
|
|
3666
|
+
});
|
|
3667
|
+
var smb = (raw_params) => {
|
|
3668
|
+
const parameters = smb_def.parse(raw_params);
|
|
3669
|
+
const silkscreenRefText = silkscreenRef(
|
|
3670
|
+
0,
|
|
3671
|
+
length29.parse(parameters.h) / 2 + 0.5,
|
|
3672
|
+
0.3
|
|
3673
|
+
);
|
|
3674
|
+
const silkscreenLine = {
|
|
3675
|
+
type: "pcb_silkscreen_path",
|
|
3676
|
+
layer: "top",
|
|
3677
|
+
pcb_component_id: "",
|
|
3678
|
+
route: [
|
|
3679
|
+
{
|
|
3680
|
+
x: length29.parse(parameters.p) / 2,
|
|
3681
|
+
y: length29.parse(parameters.h) / 2
|
|
3682
|
+
},
|
|
3683
|
+
{
|
|
3684
|
+
x: -length29.parse(parameters.w) / 2 - 0.1,
|
|
3685
|
+
y: length29.parse(parameters.h) / 2
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
x: -length29.parse(parameters.w) / 2 - 0.1,
|
|
3689
|
+
y: -length29.parse(parameters.h) / 2
|
|
3690
|
+
},
|
|
3691
|
+
{
|
|
3692
|
+
x: length29.parse(parameters.p) / 2,
|
|
3693
|
+
y: -length29.parse(parameters.h) / 2
|
|
3694
|
+
}
|
|
3695
|
+
],
|
|
3696
|
+
stroke_width: 0.1,
|
|
3697
|
+
pcb_silkscreen_path_id: ""
|
|
3698
|
+
};
|
|
3699
|
+
return {
|
|
3700
|
+
circuitJson: smbWithoutParsing(parameters).concat(
|
|
3701
|
+
silkscreenLine,
|
|
3702
|
+
silkscreenRefText
|
|
3703
|
+
),
|
|
3704
|
+
parameters
|
|
3705
|
+
};
|
|
3706
|
+
};
|
|
3707
|
+
var getSmbCoords = (parameters) => {
|
|
3708
|
+
const { pn, p } = parameters;
|
|
3709
|
+
if (pn === 1) {
|
|
3710
|
+
return { x: -p / 2, y: 0 };
|
|
3711
|
+
} else {
|
|
3712
|
+
return { x: p / 2, y: 0 };
|
|
3713
|
+
}
|
|
3714
|
+
};
|
|
3715
|
+
var smbWithoutParsing = (parameters) => {
|
|
3716
|
+
const pads = [];
|
|
3717
|
+
for (let i = 1; i <= parameters.num_pins; i++) {
|
|
3718
|
+
const { x, y } = getSmbCoords({
|
|
3719
|
+
pn: i,
|
|
3720
|
+
p: Number.parseFloat(parameters.p)
|
|
3721
|
+
});
|
|
3722
|
+
pads.push(
|
|
3723
|
+
rectpad(
|
|
3724
|
+
i,
|
|
3725
|
+
x,
|
|
3726
|
+
y,
|
|
3727
|
+
Number.parseFloat(parameters.pl),
|
|
3728
|
+
Number.parseFloat(parameters.pw)
|
|
3729
|
+
)
|
|
3730
|
+
);
|
|
3731
|
+
}
|
|
3732
|
+
return pads;
|
|
3733
|
+
};
|
|
3734
|
+
|
|
3654
3735
|
// src/helpers/is-not-null.ts
|
|
3655
3736
|
function isNotNull(value) {
|
|
3656
3737
|
return value !== null;
|