@tscircuit/footprinter 0.0.167 → 0.0.169
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 +45 -1
- package/dist/index.js +117 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -364,6 +364,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
364
364
|
od: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
365
365
|
male: z.ZodOptional<z.ZodBoolean>;
|
|
366
366
|
female: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
+
pinlabeltop: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
368
|
+
pinlabelbottom: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
369
|
+
pinlabelleft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
370
|
+
pinlabelright: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
371
|
+
pinlabelparallel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
372
|
+
pinlabelorthogonal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
367
373
|
nosquareplating: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
368
374
|
}, "strip", z.ZodTypeAny, {
|
|
369
375
|
fn: string;
|
|
@@ -371,7 +377,13 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
371
377
|
p: number;
|
|
372
378
|
id: number;
|
|
373
379
|
od: number;
|
|
380
|
+
pinlabelparallel: boolean;
|
|
381
|
+
pinlabelorthogonal: boolean;
|
|
374
382
|
rows: number;
|
|
383
|
+
pinlabeltop: boolean;
|
|
384
|
+
pinlabelbottom: boolean;
|
|
385
|
+
pinlabelleft: boolean;
|
|
386
|
+
pinlabelright: boolean;
|
|
375
387
|
nosquareplating: boolean;
|
|
376
388
|
male?: boolean | undefined;
|
|
377
389
|
female?: boolean | undefined;
|
|
@@ -383,9 +395,16 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
383
395
|
od?: string | number | undefined;
|
|
384
396
|
male?: boolean | undefined;
|
|
385
397
|
female?: boolean | undefined;
|
|
398
|
+
pinlabelparallel?: boolean | undefined;
|
|
399
|
+
pinlabelorthogonal?: boolean | undefined;
|
|
386
400
|
rows?: string | number | undefined;
|
|
401
|
+
pinlabeltop?: boolean | undefined;
|
|
402
|
+
pinlabelbottom?: boolean | undefined;
|
|
403
|
+
pinlabelleft?: boolean | undefined;
|
|
404
|
+
pinlabelright?: boolean | undefined;
|
|
387
405
|
nosquareplating?: boolean | undefined;
|
|
388
406
|
}>, {
|
|
407
|
+
resolvedPinLabelPosition: "top" | "bottom" | "left" | "right";
|
|
389
408
|
male: boolean;
|
|
390
409
|
female: boolean;
|
|
391
410
|
fn: string;
|
|
@@ -393,7 +412,13 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
393
412
|
p: number;
|
|
394
413
|
id: number;
|
|
395
414
|
od: number;
|
|
415
|
+
pinlabelparallel: boolean;
|
|
416
|
+
pinlabelorthogonal: boolean;
|
|
396
417
|
rows: number;
|
|
418
|
+
pinlabeltop: boolean;
|
|
419
|
+
pinlabelbottom: boolean;
|
|
420
|
+
pinlabelleft: boolean;
|
|
421
|
+
pinlabelright: boolean;
|
|
397
422
|
nosquareplating: boolean;
|
|
398
423
|
}, {
|
|
399
424
|
fn: string;
|
|
@@ -403,9 +428,16 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
403
428
|
od?: string | number | undefined;
|
|
404
429
|
male?: boolean | undefined;
|
|
405
430
|
female?: boolean | undefined;
|
|
431
|
+
pinlabelparallel?: boolean | undefined;
|
|
432
|
+
pinlabelorthogonal?: boolean | undefined;
|
|
406
433
|
rows?: string | number | undefined;
|
|
434
|
+
pinlabeltop?: boolean | undefined;
|
|
435
|
+
pinlabelbottom?: boolean | undefined;
|
|
436
|
+
pinlabelleft?: boolean | undefined;
|
|
437
|
+
pinlabelright?: boolean | undefined;
|
|
407
438
|
nosquareplating?: boolean | undefined;
|
|
408
439
|
}>, {
|
|
440
|
+
resolvedPinLabelPosition: "top" | "bottom" | "left" | "right";
|
|
409
441
|
male: boolean;
|
|
410
442
|
female: boolean;
|
|
411
443
|
fn: string;
|
|
@@ -413,7 +445,13 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
413
445
|
p: number;
|
|
414
446
|
id: number;
|
|
415
447
|
od: number;
|
|
448
|
+
pinlabelparallel: boolean;
|
|
449
|
+
pinlabelorthogonal: boolean;
|
|
416
450
|
rows: number;
|
|
451
|
+
pinlabeltop: boolean;
|
|
452
|
+
pinlabelbottom: boolean;
|
|
453
|
+
pinlabelleft: boolean;
|
|
454
|
+
pinlabelright: boolean;
|
|
417
455
|
nosquareplating: boolean;
|
|
418
456
|
}, {
|
|
419
457
|
fn: string;
|
|
@@ -423,7 +461,13 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
423
461
|
od?: string | number | undefined;
|
|
424
462
|
male?: boolean | undefined;
|
|
425
463
|
female?: boolean | undefined;
|
|
464
|
+
pinlabelparallel?: boolean | undefined;
|
|
465
|
+
pinlabelorthogonal?: boolean | undefined;
|
|
426
466
|
rows?: string | number | undefined;
|
|
467
|
+
pinlabeltop?: boolean | undefined;
|
|
468
|
+
pinlabelbottom?: boolean | undefined;
|
|
469
|
+
pinlabelleft?: boolean | undefined;
|
|
470
|
+
pinlabelright?: boolean | undefined;
|
|
427
471
|
nosquareplating?: boolean | undefined;
|
|
428
472
|
}>, z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
|
|
429
473
|
fn: z.ZodString;
|
|
@@ -1014,7 +1058,7 @@ type Footprinter = {
|
|
|
1014
1058
|
ssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1015
1059
|
tssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1016
1060
|
dfn: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1017
|
-
pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female" | "rows" | "nosquareplating">;
|
|
1061
|
+
pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female" | "rows" | "pinlabeltop" | "pinlabelbottom" | "pinlabelleft" | "pinlabelright" | "pinlabelparallel" | "pinlabelorthogonal" | "nosquareplating">;
|
|
1018
1062
|
axial: () => FootprinterParamsBuilder<"p" | "id" | "od">;
|
|
1019
1063
|
hc49: () => FootprinterParamsBuilder<"p" | "id" | "od" | "w" | "h">;
|
|
1020
1064
|
to220: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
|
package/dist/index.js
CHANGED
|
@@ -1217,8 +1217,10 @@ var ssop = (raw_params) => {
|
|
|
1217
1217
|
|
|
1218
1218
|
// src/fn/tssop.ts
|
|
1219
1219
|
var tssop_def = extendSoicDef({
|
|
1220
|
-
w: "
|
|
1220
|
+
w: "7.1mm",
|
|
1221
1221
|
p: "0.65mm",
|
|
1222
|
+
pl: "1.35mm",
|
|
1223
|
+
pw: "0.40mm",
|
|
1222
1224
|
legsoutside: true
|
|
1223
1225
|
});
|
|
1224
1226
|
var tssop = (raw_params) => {
|
|
@@ -1556,23 +1558,48 @@ var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight
|
|
|
1556
1558
|
};
|
|
1557
1559
|
|
|
1558
1560
|
// src/helpers/silkscreenPin.ts
|
|
1561
|
+
var fullyExplicitAlignmentMap = {
|
|
1562
|
+
top: { 0: "center", 90: "center_right", 180: "center", 270: "center_left" },
|
|
1563
|
+
bottom: {
|
|
1564
|
+
0: "center",
|
|
1565
|
+
90: "center_left",
|
|
1566
|
+
180: "center",
|
|
1567
|
+
270: "center_right"
|
|
1568
|
+
},
|
|
1569
|
+
left: { 0: "center_right", 90: "center", 180: "center_left", 270: "center" },
|
|
1570
|
+
right: { 0: "center_left", 90: "center", 180: "center_right", 270: "center" }
|
|
1571
|
+
};
|
|
1559
1572
|
var silkscreenPin = ({
|
|
1560
|
-
x,
|
|
1561
|
-
y,
|
|
1562
1573
|
fs,
|
|
1563
|
-
pn
|
|
1574
|
+
pn,
|
|
1575
|
+
anchor_x,
|
|
1576
|
+
anchor_y,
|
|
1577
|
+
pinlabelposition = "top",
|
|
1578
|
+
pinlabelparallel = false,
|
|
1579
|
+
pinlabelorthogonal = false
|
|
1564
1580
|
}) => {
|
|
1581
|
+
let ccw_rotation = 0;
|
|
1582
|
+
if (!pinlabelparallel && !pinlabelorthogonal) {
|
|
1583
|
+
ccw_rotation = 0;
|
|
1584
|
+
} else if (pinlabelparallel && !pinlabelorthogonal) {
|
|
1585
|
+
ccw_rotation = 90;
|
|
1586
|
+
} else if (!pinlabelparallel && pinlabelorthogonal) {
|
|
1587
|
+
ccw_rotation = 180;
|
|
1588
|
+
} else if (pinlabelparallel && pinlabelorthogonal) {
|
|
1589
|
+
ccw_rotation = 270;
|
|
1590
|
+
}
|
|
1591
|
+
const anchor_alignment = fullyExplicitAlignmentMap[pinlabelposition][ccw_rotation];
|
|
1565
1592
|
return {
|
|
1566
1593
|
type: "pcb_silkscreen_text",
|
|
1567
1594
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
1568
1595
|
font: "tscircuit2024",
|
|
1569
1596
|
font_size: fs,
|
|
1570
|
-
stroke_width: fs / 100,
|
|
1571
1597
|
pcb_component_id: "pcb_component_1",
|
|
1572
1598
|
text: `{PIN${pn}}`,
|
|
1573
1599
|
layer: "top",
|
|
1574
|
-
anchor_position: { x, y },
|
|
1575
|
-
anchor_alignment
|
|
1600
|
+
anchor_position: { x: anchor_x, y: anchor_y },
|
|
1601
|
+
anchor_alignment,
|
|
1602
|
+
ccw_rotation
|
|
1576
1603
|
};
|
|
1577
1604
|
};
|
|
1578
1605
|
|
|
@@ -1587,12 +1614,39 @@ var pinrow_def = z11.object({
|
|
|
1587
1614
|
od: length5.default("1.5mm").describe("outer diameter"),
|
|
1588
1615
|
male: z11.boolean().optional().describe("for male pin headers"),
|
|
1589
1616
|
female: z11.boolean().optional().describe("for female pin headers"),
|
|
1617
|
+
pinlabeltop: z11.boolean().optional().default(false),
|
|
1618
|
+
pinlabelbottom: z11.boolean().optional().default(false),
|
|
1619
|
+
pinlabelleft: z11.boolean().optional().default(false),
|
|
1620
|
+
pinlabelright: z11.boolean().optional().default(false),
|
|
1621
|
+
pinlabelparallel: z11.boolean().optional().default(false),
|
|
1622
|
+
pinlabelorthogonal: z11.boolean().optional().default(false),
|
|
1590
1623
|
nosquareplating: z11.boolean().optional().default(false).describe("do not use rectangular pad for pin 1")
|
|
1591
|
-
}).transform((data) =>
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1624
|
+
}).transform((data) => {
|
|
1625
|
+
let resolvedPinLabelPosition;
|
|
1626
|
+
const { pinlabeltop, pinlabelbottom, pinlabelleft, pinlabelright } = data;
|
|
1627
|
+
const truePositionFlags = [];
|
|
1628
|
+
if (pinlabeltop)
|
|
1629
|
+
truePositionFlags.push("top");
|
|
1630
|
+
if (pinlabelbottom)
|
|
1631
|
+
truePositionFlags.push("bottom");
|
|
1632
|
+
if (pinlabelleft)
|
|
1633
|
+
truePositionFlags.push("left");
|
|
1634
|
+
if (pinlabelright)
|
|
1635
|
+
truePositionFlags.push("right");
|
|
1636
|
+
if (truePositionFlags.includes("top")) {
|
|
1637
|
+
resolvedPinLabelPosition = "top";
|
|
1638
|
+
} else if (truePositionFlags.length === 1) {
|
|
1639
|
+
resolvedPinLabelPosition = truePositionFlags[0];
|
|
1640
|
+
} else {
|
|
1641
|
+
resolvedPinLabelPosition = "top";
|
|
1642
|
+
}
|
|
1643
|
+
return {
|
|
1644
|
+
...data,
|
|
1645
|
+
resolvedPinLabelPosition,
|
|
1646
|
+
male: data.male ?? (data.female ? false : true),
|
|
1647
|
+
female: data.female ?? false
|
|
1648
|
+
};
|
|
1649
|
+
}).superRefine((data, ctx) => {
|
|
1596
1650
|
if (data.male && data.female) {
|
|
1597
1651
|
ctx.addIssue({
|
|
1598
1652
|
code: z11.ZodIssueCode.custom,
|
|
@@ -1603,18 +1657,67 @@ var pinrow_def = z11.object({
|
|
|
1603
1657
|
});
|
|
1604
1658
|
var pinrow = (raw_params) => {
|
|
1605
1659
|
const parameters = pinrow_def.parse(raw_params);
|
|
1606
|
-
const {
|
|
1660
|
+
const {
|
|
1661
|
+
p,
|
|
1662
|
+
id,
|
|
1663
|
+
od,
|
|
1664
|
+
rows,
|
|
1665
|
+
num_pins,
|
|
1666
|
+
resolvedPinLabelPosition,
|
|
1667
|
+
pinlabelparallel,
|
|
1668
|
+
pinlabelorthogonal
|
|
1669
|
+
} = parameters;
|
|
1607
1670
|
const holes = [];
|
|
1608
1671
|
const numPinsPerRow = Math.ceil(num_pins / rows);
|
|
1609
1672
|
const ySpacing = -p;
|
|
1673
|
+
const calculateAnchorPosition = (xoff, yoff, od2, resolvedPinLabelPosition2) => {
|
|
1674
|
+
let dx = 0, dy = 0;
|
|
1675
|
+
const offset = od2 * 0.75;
|
|
1676
|
+
switch (resolvedPinLabelPosition2) {
|
|
1677
|
+
case "right":
|
|
1678
|
+
dx = offset;
|
|
1679
|
+
dy = 0;
|
|
1680
|
+
break;
|
|
1681
|
+
case "top":
|
|
1682
|
+
dx = 0;
|
|
1683
|
+
dy = offset;
|
|
1684
|
+
break;
|
|
1685
|
+
case "bottom":
|
|
1686
|
+
dx = 0;
|
|
1687
|
+
dy = -offset;
|
|
1688
|
+
break;
|
|
1689
|
+
case "left":
|
|
1690
|
+
dx = -offset;
|
|
1691
|
+
dy = 0;
|
|
1692
|
+
break;
|
|
1693
|
+
default:
|
|
1694
|
+
dx = 0;
|
|
1695
|
+
dy = 0;
|
|
1696
|
+
}
|
|
1697
|
+
return { anchor_x: xoff + dx, anchor_y: yoff + dy };
|
|
1698
|
+
};
|
|
1610
1699
|
const addPin = (pinNumber, xoff, yoff) => {
|
|
1611
1700
|
if (pinNumber === 1 && !parameters.nosquareplating) {
|
|
1612
1701
|
holes.push(platedHoleWithRectPad(pinNumber, xoff, yoff, id, od, od));
|
|
1613
1702
|
} else {
|
|
1614
1703
|
holes.push(platedhole(pinNumber, xoff, yoff, id, od));
|
|
1615
1704
|
}
|
|
1705
|
+
const { anchor_x, anchor_y } = calculateAnchorPosition(
|
|
1706
|
+
xoff,
|
|
1707
|
+
yoff,
|
|
1708
|
+
od,
|
|
1709
|
+
resolvedPinLabelPosition
|
|
1710
|
+
);
|
|
1616
1711
|
holes.push(
|
|
1617
|
-
silkscreenPin({
|
|
1712
|
+
silkscreenPin({
|
|
1713
|
+
fs: od / 5,
|
|
1714
|
+
pn: pinNumber,
|
|
1715
|
+
anchor_x,
|
|
1716
|
+
anchor_y,
|
|
1717
|
+
pinlabelposition: resolvedPinLabelPosition,
|
|
1718
|
+
pinlabelparallel,
|
|
1719
|
+
pinlabelorthogonal
|
|
1720
|
+
})
|
|
1618
1721
|
);
|
|
1619
1722
|
};
|
|
1620
1723
|
const usedPositions = /* @__PURE__ */ new Set();
|