@tscircuit/footprinter 0.0.136 → 0.0.138
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 +256 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1032,6 +1032,7 @@ type Footprinter = {
|
|
|
1032
1032
|
sod123: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1033
1033
|
sod123w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1034
1034
|
to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
|
|
1035
|
+
sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1035
1036
|
pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
|
|
1036
1037
|
stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
|
1037
1038
|
stampreceiver: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ __export(fn_exports, {
|
|
|
47
47
|
sod923: () => sod923,
|
|
48
48
|
soic: () => soic,
|
|
49
49
|
sop8: () => sop8,
|
|
50
|
+
sot223: () => sot223,
|
|
50
51
|
sot23: () => sot23,
|
|
51
52
|
sot363: () => sot363,
|
|
52
53
|
sot563: () => sot563,
|
|
@@ -4310,6 +4311,261 @@ var smcWithoutParsing = (parameters) => {
|
|
|
4310
4311
|
return pads;
|
|
4311
4312
|
};
|
|
4312
4313
|
|
|
4314
|
+
// src/fn/sot223.ts
|
|
4315
|
+
import { z as z41 } from "zod";
|
|
4316
|
+
var sot223_def = z41.object({
|
|
4317
|
+
fn: z41.string(),
|
|
4318
|
+
num_pins: z41.number().default(4),
|
|
4319
|
+
w: z41.string().default("8.50mm"),
|
|
4320
|
+
h: z41.string().default("6.90mm"),
|
|
4321
|
+
pl: z41.string().default("2mm"),
|
|
4322
|
+
pw: z41.string().default("1.5mm"),
|
|
4323
|
+
p: z41.string().default("2.30mm"),
|
|
4324
|
+
string: z41.string().optional()
|
|
4325
|
+
});
|
|
4326
|
+
var sot223 = (raw_params) => {
|
|
4327
|
+
const match = raw_params.string?.match(/^sot223_(\d+)/);
|
|
4328
|
+
const numPins = match ? Number.parseInt(match[1], 10) : 4;
|
|
4329
|
+
if (numPins === 8) {
|
|
4330
|
+
const parameters2 = sot223_8_def.parse({
|
|
4331
|
+
...raw_params,
|
|
4332
|
+
num_pins: numPins
|
|
4333
|
+
});
|
|
4334
|
+
return {
|
|
4335
|
+
circuitJson: soicWithoutParsing(parameters2),
|
|
4336
|
+
parameters: parameters2
|
|
4337
|
+
};
|
|
4338
|
+
}
|
|
4339
|
+
const parameters = sot223_def.parse({
|
|
4340
|
+
...raw_params,
|
|
4341
|
+
num_pins: numPins
|
|
4342
|
+
});
|
|
4343
|
+
if (parameters.num_pins === 4) {
|
|
4344
|
+
return {
|
|
4345
|
+
circuitJson: sot223_4(parameters),
|
|
4346
|
+
parameters
|
|
4347
|
+
};
|
|
4348
|
+
}
|
|
4349
|
+
if (parameters.num_pins === 5) {
|
|
4350
|
+
return {
|
|
4351
|
+
circuitJson: sot223_5(parameters),
|
|
4352
|
+
parameters
|
|
4353
|
+
};
|
|
4354
|
+
}
|
|
4355
|
+
if (parameters.num_pins === 6) {
|
|
4356
|
+
return {
|
|
4357
|
+
circuitJson: sot223_6(parameters),
|
|
4358
|
+
parameters
|
|
4359
|
+
};
|
|
4360
|
+
}
|
|
4361
|
+
throw new Error("Invalid number of pins");
|
|
4362
|
+
};
|
|
4363
|
+
var get2CcwSot223Coords = (parameters) => {
|
|
4364
|
+
const { pn, w, h, pl, p } = parameters;
|
|
4365
|
+
if (pn === 1) {
|
|
4366
|
+
return { x: -w / 2 + 1.1, y: p };
|
|
4367
|
+
}
|
|
4368
|
+
if (pn === 2) {
|
|
4369
|
+
return { x: -w / 2 + 1.1, y: 0 };
|
|
4370
|
+
}
|
|
4371
|
+
if (pn === 3) {
|
|
4372
|
+
return { x: -w / 2 + 1.1, y: -p };
|
|
4373
|
+
}
|
|
4374
|
+
return { x: w / 2 - 1.1, y: 0 };
|
|
4375
|
+
};
|
|
4376
|
+
var sot223_4 = (parameters) => {
|
|
4377
|
+
const pads = [];
|
|
4378
|
+
for (let i = 0; i < parameters.num_pins; i++) {
|
|
4379
|
+
const { x, y } = get2CcwSot223Coords({
|
|
4380
|
+
num_pins: parameters.num_pins,
|
|
4381
|
+
pn: i + 1,
|
|
4382
|
+
w: Number.parseFloat(parameters.w),
|
|
4383
|
+
h: Number.parseFloat(parameters.h),
|
|
4384
|
+
pl: Number.parseFloat(parameters.pl),
|
|
4385
|
+
p: Number.parseFloat(parameters.p)
|
|
4386
|
+
});
|
|
4387
|
+
const pinWidth = i === 3 ? 3.8 : Number.parseFloat(parameters.pw);
|
|
4388
|
+
pads.push(rectpad(i + 1, x, y, Number.parseFloat(parameters.pl), pinWidth));
|
|
4389
|
+
}
|
|
4390
|
+
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
4391
|
+
const width = Number.parseFloat(parameters.w) / 2 - 2.4;
|
|
4392
|
+
const height = Number.parseFloat(parameters.h) / 2;
|
|
4393
|
+
const silkscreenPath1 = {
|
|
4394
|
+
layer: "top",
|
|
4395
|
+
pcb_component_id: "",
|
|
4396
|
+
pcb_silkscreen_path_id: "silkscreen_path_1",
|
|
4397
|
+
route: [
|
|
4398
|
+
{ x: -width, y: height },
|
|
4399
|
+
{ x: width, y: height },
|
|
4400
|
+
{ x: width, y: height / 2 + 0.5 }
|
|
4401
|
+
],
|
|
4402
|
+
type: "pcb_silkscreen_path",
|
|
4403
|
+
stroke_width: 0.1
|
|
4404
|
+
};
|
|
4405
|
+
const silkscreenPath2 = {
|
|
4406
|
+
layer: "top",
|
|
4407
|
+
pcb_component_id: "",
|
|
4408
|
+
pcb_silkscreen_path_id: "silkscreen_path_2",
|
|
4409
|
+
route: [
|
|
4410
|
+
{ x: -width, y: -height },
|
|
4411
|
+
{ x: width, y: -height },
|
|
4412
|
+
{ x: width, y: -height / 2 - 0.5 }
|
|
4413
|
+
],
|
|
4414
|
+
type: "pcb_silkscreen_path",
|
|
4415
|
+
stroke_width: 0.1
|
|
4416
|
+
};
|
|
4417
|
+
return [
|
|
4418
|
+
...pads,
|
|
4419
|
+
silkscreenPath1,
|
|
4420
|
+
silkscreenPath2,
|
|
4421
|
+
silkscreenRefText
|
|
4422
|
+
];
|
|
4423
|
+
};
|
|
4424
|
+
var sot223_8_def = extendSoicDef({
|
|
4425
|
+
p: "0.90mm",
|
|
4426
|
+
w: "2.8mm",
|
|
4427
|
+
legsoutside: true
|
|
4428
|
+
});
|
|
4429
|
+
var get2CcwSot2235Coords = (parameters) => {
|
|
4430
|
+
const { p, h, pn, w } = parameters;
|
|
4431
|
+
if (pn === 1) {
|
|
4432
|
+
return { x: -w / 2 + 1.2, y: p / 2 + p };
|
|
4433
|
+
}
|
|
4434
|
+
if (pn === 2) {
|
|
4435
|
+
return { x: -w / 2 + 1.2, y: p / 2 };
|
|
4436
|
+
}
|
|
4437
|
+
if (pn === 3) {
|
|
4438
|
+
return { x: -w / 2 + 1.2, y: -p / 2 };
|
|
4439
|
+
}
|
|
4440
|
+
if (pn === 4) {
|
|
4441
|
+
return { x: -w / 2 + 1.2, y: -p / 2 - p };
|
|
4442
|
+
}
|
|
4443
|
+
if (pn === 5) {
|
|
4444
|
+
return { x: w / 2 - 1, y: 0 };
|
|
4445
|
+
}
|
|
4446
|
+
throw new Error("Invalid pin number");
|
|
4447
|
+
};
|
|
4448
|
+
var sot223_5 = (parameters) => {
|
|
4449
|
+
const pads = [];
|
|
4450
|
+
for (let i = 1; i <= parameters.num_pins; i++) {
|
|
4451
|
+
const { x, y } = get2CcwSot2235Coords({
|
|
4452
|
+
h: Number.parseFloat(parameters.h),
|
|
4453
|
+
p: 1.5,
|
|
4454
|
+
pn: i,
|
|
4455
|
+
w: Number.parseFloat(parameters.w)
|
|
4456
|
+
});
|
|
4457
|
+
let pinWidth = Number.parseFloat(parameters.pw);
|
|
4458
|
+
let pinLength = Number.parseFloat(parameters.pl);
|
|
4459
|
+
if (i === 5) {
|
|
4460
|
+
pinWidth = 3.4;
|
|
4461
|
+
pinLength = 1.8;
|
|
4462
|
+
} else {
|
|
4463
|
+
pinWidth = 1;
|
|
4464
|
+
pinLength = 2.2;
|
|
4465
|
+
}
|
|
4466
|
+
pads.push(rectpad(i, x, y, pinLength, pinWidth));
|
|
4467
|
+
}
|
|
4468
|
+
const width = Number.parseFloat(parameters.w) / 2 - 2.4;
|
|
4469
|
+
const height = Number.parseFloat(parameters.h) / 2;
|
|
4470
|
+
const silkscreenPath1 = {
|
|
4471
|
+
layer: "top",
|
|
4472
|
+
pcb_component_id: "",
|
|
4473
|
+
pcb_silkscreen_path_id: "silkscreen_path_1",
|
|
4474
|
+
route: [
|
|
4475
|
+
{ x: -width, y: height },
|
|
4476
|
+
{ x: width, y: height },
|
|
4477
|
+
{ x: width, y: height / 2 + 0.5 }
|
|
4478
|
+
],
|
|
4479
|
+
type: "pcb_silkscreen_path",
|
|
4480
|
+
stroke_width: 0.1
|
|
4481
|
+
};
|
|
4482
|
+
const silkscreenPath2 = {
|
|
4483
|
+
layer: "top",
|
|
4484
|
+
pcb_component_id: "",
|
|
4485
|
+
pcb_silkscreen_path_id: "silkscreen_path_2",
|
|
4486
|
+
route: [
|
|
4487
|
+
{ x: -width, y: -height },
|
|
4488
|
+
{ x: width, y: -height },
|
|
4489
|
+
{ x: width, y: -height / 2 - 0.5 }
|
|
4490
|
+
],
|
|
4491
|
+
type: "pcb_silkscreen_path",
|
|
4492
|
+
stroke_width: 0.1
|
|
4493
|
+
};
|
|
4494
|
+
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
4495
|
+
return [...pads, silkscreenPath1, silkscreenPath2, silkscreenRefText];
|
|
4496
|
+
};
|
|
4497
|
+
var get2CcwSot2236Coords = (parameters) => {
|
|
4498
|
+
const { p, h, pn, w } = parameters;
|
|
4499
|
+
if (pn === 1) {
|
|
4500
|
+
return { x: -w / 2 + 1.2, y: 2 * p };
|
|
4501
|
+
}
|
|
4502
|
+
if (pn === 2) {
|
|
4503
|
+
return { x: -w / 2 + 1.2, y: p };
|
|
4504
|
+
}
|
|
4505
|
+
if (pn === 3) {
|
|
4506
|
+
return { x: -w / 2 + 1.2, y: 0 };
|
|
4507
|
+
}
|
|
4508
|
+
if (pn === 4) {
|
|
4509
|
+
return { x: -w / 2 + 1.2, y: -p };
|
|
4510
|
+
}
|
|
4511
|
+
if (pn === 5) {
|
|
4512
|
+
return { x: -w / 2 + 1.2, y: -2 * p };
|
|
4513
|
+
}
|
|
4514
|
+
if (pn === 6) {
|
|
4515
|
+
return { x: w / 2 - 1.175, y: 0 };
|
|
4516
|
+
}
|
|
4517
|
+
throw new Error("Invalid pin number");
|
|
4518
|
+
};
|
|
4519
|
+
var sot223_6 = (parameters) => {
|
|
4520
|
+
const pads = [];
|
|
4521
|
+
for (let i = 1; i <= parameters.num_pins; i++) {
|
|
4522
|
+
const { x, y } = get2CcwSot2236Coords({
|
|
4523
|
+
h: Number.parseFloat(parameters.h),
|
|
4524
|
+
p: 1.3,
|
|
4525
|
+
pn: i,
|
|
4526
|
+
w: 8.7
|
|
4527
|
+
});
|
|
4528
|
+
let pinWidth = Number.parseFloat(parameters.pw);
|
|
4529
|
+
let pinLength = Number.parseFloat(parameters.pl);
|
|
4530
|
+
if (i === 6) {
|
|
4531
|
+
pinWidth = 3.4;
|
|
4532
|
+
pinLength = 2.15;
|
|
4533
|
+
} else {
|
|
4534
|
+
pinWidth = 0.6;
|
|
4535
|
+
pinLength = 2.2;
|
|
4536
|
+
}
|
|
4537
|
+
pads.push(rectpad(i, x, y, pinLength, pinWidth));
|
|
4538
|
+
}
|
|
4539
|
+
const width = Number.parseFloat(parameters.w) / 2 - 2.4;
|
|
4540
|
+
const height = Number.parseFloat(parameters.h) / 2;
|
|
4541
|
+
const silkscreenPath1 = {
|
|
4542
|
+
layer: "top",
|
|
4543
|
+
pcb_component_id: "",
|
|
4544
|
+
pcb_silkscreen_path_id: "silkscreen_path_1",
|
|
4545
|
+
route: [
|
|
4546
|
+
{ x: -width, y: height },
|
|
4547
|
+
{ x: width, y: height },
|
|
4548
|
+
{ x: width, y: height / 2 + 0.5 }
|
|
4549
|
+
],
|
|
4550
|
+
type: "pcb_silkscreen_path",
|
|
4551
|
+
stroke_width: 0.1
|
|
4552
|
+
};
|
|
4553
|
+
const silkscreenPath2 = {
|
|
4554
|
+
layer: "top",
|
|
4555
|
+
pcb_component_id: "",
|
|
4556
|
+
pcb_silkscreen_path_id: "silkscreen_path_2",
|
|
4557
|
+
route: [
|
|
4558
|
+
{ x: -width, y: -height },
|
|
4559
|
+
{ x: width, y: -height },
|
|
4560
|
+
{ x: width, y: -height / 2 - 0.5 }
|
|
4561
|
+
],
|
|
4562
|
+
type: "pcb_silkscreen_path",
|
|
4563
|
+
stroke_width: 0.1
|
|
4564
|
+
};
|
|
4565
|
+
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
4566
|
+
return [...pads, silkscreenPath1, silkscreenPath2, silkscreenRefText];
|
|
4567
|
+
};
|
|
4568
|
+
|
|
4313
4569
|
// src/helpers/is-not-null.ts
|
|
4314
4570
|
function isNotNull(value) {
|
|
4315
4571
|
return value !== null;
|