@tscircuit/footprinter 0.0.171 → 0.0.172
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 +98 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1060,6 +1060,7 @@ type Footprinter = {
|
|
|
1060
1060
|
sot563: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw">;
|
|
1061
1061
|
sot723: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
|
|
1062
1062
|
sot23: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
|
|
1063
|
+
sot323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1063
1064
|
sot89: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw" | "h">;
|
|
1064
1065
|
sod323w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1065
1066
|
smc: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ __export(fn_exports, {
|
|
|
61
61
|
sot223: () => sot223,
|
|
62
62
|
sot23: () => sot23,
|
|
63
63
|
sot23w: () => sot23w,
|
|
64
|
+
sot323: () => sot323,
|
|
64
65
|
sot363: () => sot363,
|
|
65
66
|
sot457: () => sot457,
|
|
66
67
|
sot563: () => sot563,
|
|
@@ -6432,6 +6433,103 @@ var electrolytic = (raw_params) => {
|
|
|
6432
6433
|
};
|
|
6433
6434
|
};
|
|
6434
6435
|
|
|
6436
|
+
// src/fn/sot323.ts
|
|
6437
|
+
import { z as z56 } from "zod";
|
|
6438
|
+
var sot323_def = z56.object({
|
|
6439
|
+
fn: z56.string(),
|
|
6440
|
+
num_pins: z56.number().default(3),
|
|
6441
|
+
w: z56.string().default("2.45mm"),
|
|
6442
|
+
h: z56.string().default("2.40mm"),
|
|
6443
|
+
pl: z56.string().default("0.45mm"),
|
|
6444
|
+
pw: z56.string().default("0.70mm"),
|
|
6445
|
+
p: z56.string().default("1mm"),
|
|
6446
|
+
string: z56.string().optional()
|
|
6447
|
+
});
|
|
6448
|
+
var sot323 = (raw_params) => {
|
|
6449
|
+
const match = raw_params.string?.match(/^sot323_(\d+)/);
|
|
6450
|
+
const numPins = match ? Number.parseInt(match[1], 3) : 3;
|
|
6451
|
+
const parameters = sot323_def.parse({
|
|
6452
|
+
...raw_params,
|
|
6453
|
+
num_pins: numPins
|
|
6454
|
+
});
|
|
6455
|
+
if (parameters.num_pins === 3) {
|
|
6456
|
+
return {
|
|
6457
|
+
circuitJson: sot323_3(parameters),
|
|
6458
|
+
parameters
|
|
6459
|
+
};
|
|
6460
|
+
}
|
|
6461
|
+
throw new Error("Invalid number of pins");
|
|
6462
|
+
};
|
|
6463
|
+
var getCcwSot323Coords = (parameters) => {
|
|
6464
|
+
const { pn, w, h, pl, p } = parameters;
|
|
6465
|
+
if (pn === 1) {
|
|
6466
|
+
return { x: -p, y: 0.65 };
|
|
6467
|
+
}
|
|
6468
|
+
if (pn === 2) {
|
|
6469
|
+
return { x: -p, y: -0.65 };
|
|
6470
|
+
}
|
|
6471
|
+
return { x: p, y: 0 };
|
|
6472
|
+
};
|
|
6473
|
+
var sot323_3 = (parameters) => {
|
|
6474
|
+
const pads = [];
|
|
6475
|
+
for (let i = 0; i < parameters.num_pins; i++) {
|
|
6476
|
+
const { x, y } = getCcwSot323Coords({
|
|
6477
|
+
num_pins: parameters.num_pins,
|
|
6478
|
+
pn: i + 1,
|
|
6479
|
+
w: Number.parseFloat(parameters.w),
|
|
6480
|
+
h: Number.parseFloat(parameters.h),
|
|
6481
|
+
pl: Number.parseFloat(parameters.pl),
|
|
6482
|
+
p: Number.parseFloat(parameters.p)
|
|
6483
|
+
});
|
|
6484
|
+
pads.push(
|
|
6485
|
+
rectpad(
|
|
6486
|
+
i + 1,
|
|
6487
|
+
x,
|
|
6488
|
+
y,
|
|
6489
|
+
Number.parseFloat(parameters.pl),
|
|
6490
|
+
Number.parseFloat(parameters.pw)
|
|
6491
|
+
)
|
|
6492
|
+
);
|
|
6493
|
+
}
|
|
6494
|
+
const silkscreenRefText = silkscreenRef(
|
|
6495
|
+
0,
|
|
6496
|
+
Number.parseInt(parameters.h) / 2 + 1,
|
|
6497
|
+
0.3
|
|
6498
|
+
);
|
|
6499
|
+
const width = Number.parseFloat(parameters.w) / 2 - Number.parseFloat(parameters.pl);
|
|
6500
|
+
const height = Number.parseFloat(parameters.h) / 2;
|
|
6501
|
+
const silkscreenPath1 = {
|
|
6502
|
+
layer: "top",
|
|
6503
|
+
pcb_component_id: "",
|
|
6504
|
+
pcb_silkscreen_path_id: "silkscreen_path_1",
|
|
6505
|
+
route: [
|
|
6506
|
+
{ x: -width, y: height + 0.3 },
|
|
6507
|
+
{ x: width, y: height + 0.3 },
|
|
6508
|
+
{ x: width, y: height / 2 }
|
|
6509
|
+
],
|
|
6510
|
+
type: "pcb_silkscreen_path",
|
|
6511
|
+
stroke_width: 0.1
|
|
6512
|
+
};
|
|
6513
|
+
const silkscreenPath2 = {
|
|
6514
|
+
layer: "top",
|
|
6515
|
+
pcb_component_id: "",
|
|
6516
|
+
pcb_silkscreen_path_id: "silkscreen_path_2",
|
|
6517
|
+
route: [
|
|
6518
|
+
{ x: -width, y: -height - 0.3 },
|
|
6519
|
+
{ x: width, y: -height - 0.3 },
|
|
6520
|
+
{ x: width, y: -height / 2 }
|
|
6521
|
+
],
|
|
6522
|
+
type: "pcb_silkscreen_path",
|
|
6523
|
+
stroke_width: 0.1
|
|
6524
|
+
};
|
|
6525
|
+
return [
|
|
6526
|
+
...pads,
|
|
6527
|
+
silkscreenPath1,
|
|
6528
|
+
silkscreenPath2,
|
|
6529
|
+
silkscreenRefText
|
|
6530
|
+
];
|
|
6531
|
+
};
|
|
6532
|
+
|
|
6435
6533
|
// src/helpers/is-not-null.ts
|
|
6436
6534
|
function isNotNull(value) {
|
|
6437
6535
|
return value !== null;
|