@tscircuit/footprinter 0.0.153 → 0.0.154
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.js +51 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -214,7 +214,7 @@ var dip = (raw_params) => {
|
|
|
214
214
|
const isLeft = i < parameters.num_pins / 2;
|
|
215
215
|
const pinLabelX = isLeft ? -parameters.w / 2 - parameters.p / 2 - 0.2 : parameters.p / 2 + parameters.w / 2 + 0.2;
|
|
216
216
|
const pinLabelY = isLeft ? (-sh + 1.6) / 2 + i * parameters.p : (-sh + 1.6) / 2 + (i - parameters.num_pins / 2) * parameters.p;
|
|
217
|
-
const
|
|
217
|
+
const silkscreenPin2 = {
|
|
218
218
|
type: "pcb_fabrication_note_text",
|
|
219
219
|
layer: "top",
|
|
220
220
|
pcb_component_id: `pin_${i + 1}`,
|
|
@@ -229,7 +229,7 @@ var dip = (raw_params) => {
|
|
|
229
229
|
font: "tscircuit2024",
|
|
230
230
|
anchor_alignment: "top-left"
|
|
231
231
|
};
|
|
232
|
-
silkscreenPins.push(
|
|
232
|
+
silkscreenPins.push(silkscreenPin2);
|
|
233
233
|
}
|
|
234
234
|
const silkscreenRefText = silkscreenRef(0, sh / 2 + 0.5, 0.4);
|
|
235
235
|
return {
|
|
@@ -1533,6 +1533,29 @@ var dfn = (raw_params) => {
|
|
|
1533
1533
|
// src/fn/pinrow.ts
|
|
1534
1534
|
import { z as z11 } from "zod";
|
|
1535
1535
|
import { length as length5 } from "circuit-json";
|
|
1536
|
+
|
|
1537
|
+
// src/helpers/silkscreenPin.ts
|
|
1538
|
+
var silkscreenPin = ({
|
|
1539
|
+
x,
|
|
1540
|
+
y,
|
|
1541
|
+
fs,
|
|
1542
|
+
pn
|
|
1543
|
+
}) => {
|
|
1544
|
+
return {
|
|
1545
|
+
type: "pcb_silkscreen_text",
|
|
1546
|
+
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
1547
|
+
font: "tscircuit2024",
|
|
1548
|
+
font_size: fs,
|
|
1549
|
+
stroke_width: fs / 100,
|
|
1550
|
+
pcb_component_id: "pcb_component_1",
|
|
1551
|
+
text: `{PIN${pn}}`,
|
|
1552
|
+
layer: "top",
|
|
1553
|
+
anchor_position: { x, y },
|
|
1554
|
+
anchor_alignment: "center"
|
|
1555
|
+
};
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
// src/fn/pinrow.ts
|
|
1536
1559
|
var pinrow_def = z11.object({
|
|
1537
1560
|
fn: z11.string(),
|
|
1538
1561
|
num_pins: z11.number().optional().default(6),
|
|
@@ -1558,45 +1581,44 @@ var pinrow_def = z11.object({
|
|
|
1558
1581
|
var pinrow = (raw_params) => {
|
|
1559
1582
|
const parameters = pinrow_def.parse(raw_params);
|
|
1560
1583
|
const { p, id, od, rows } = parameters;
|
|
1584
|
+
const numPins = parameters.num_pins;
|
|
1561
1585
|
const holes = [];
|
|
1562
|
-
const
|
|
1586
|
+
const addPin = (pinNumber, xoff, yoff) => {
|
|
1587
|
+
holes.push(platedhole(pinNumber, xoff, yoff, id, od));
|
|
1588
|
+
holes.push(
|
|
1589
|
+
silkscreenPin({ x: xoff, y: yoff + p / 2, fs: od / 5, pn: pinNumber })
|
|
1590
|
+
);
|
|
1591
|
+
};
|
|
1563
1592
|
if (rows > 1) {
|
|
1564
|
-
const
|
|
1593
|
+
const numPinsPerRow = Math.ceil(numPins / rows);
|
|
1565
1594
|
const ySpacing = p;
|
|
1566
1595
|
for (let row = 0; row < rows; row++) {
|
|
1567
1596
|
const yoff = row * ySpacing;
|
|
1568
|
-
const startPin = row *
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1597
|
+
const startPin = row * numPinsPerRow;
|
|
1598
|
+
const xStart = -((numPinsPerRow - 1) / 2) * p;
|
|
1599
|
+
for (let i = 0; i < numPinsPerRow; i++) {
|
|
1600
|
+
const pinNumber = startPin + i + 1;
|
|
1601
|
+
if (pinNumber > numPins)
|
|
1572
1602
|
break;
|
|
1573
|
-
const xoff =
|
|
1574
|
-
|
|
1603
|
+
const xoff = xStart + i * p;
|
|
1604
|
+
addPin(pinNumber, xoff, yoff);
|
|
1575
1605
|
}
|
|
1576
1606
|
}
|
|
1577
1607
|
} else {
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1608
|
+
const xStart = -((numPins - 1) / 2) * p;
|
|
1609
|
+
for (let i = 0; i < numPins; i++) {
|
|
1610
|
+
const pinNumber = i + 1;
|
|
1611
|
+
const xoff = xStart + i * p;
|
|
1612
|
+
addPin(pinNumber, xoff, 0);
|
|
1582
1613
|
}
|
|
1583
1614
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
};
|
|
1590
|
-
}
|
|
1591
|
-
const silkscreenRefText = silkscreenRef(
|
|
1592
|
-
(num_pins / rows - 1) * p / 2,
|
|
1593
|
-
// Center the silkscreen horizontally
|
|
1594
|
-
rows * p,
|
|
1595
|
-
// Keep it at the top vertically
|
|
1596
|
-
0.5
|
|
1597
|
-
);
|
|
1615
|
+
const perRow = rows > 1 ? Math.ceil(numPins / rows) : numPins;
|
|
1616
|
+
const xStartGroup = -((perRow - 1) / 2) * p;
|
|
1617
|
+
const groupTextX = xStartGroup + (perRow - 1) / 2 * p;
|
|
1618
|
+
const groupTextY = rows * p;
|
|
1619
|
+
const refText = silkscreenRef(groupTextX, groupTextY, 0.5);
|
|
1598
1620
|
return {
|
|
1599
|
-
circuitJson: [...holes,
|
|
1621
|
+
circuitJson: [...holes, refText],
|
|
1600
1622
|
parameters
|
|
1601
1623
|
};
|
|
1602
1624
|
};
|