@tscircuit/footprinter 0.0.78 → 0.0.80
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 +548 -150
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(fn_exports, {
|
|
|
32
32
|
sot723: () => sot723,
|
|
33
33
|
ssop: () => ssop,
|
|
34
34
|
stampboard: () => stampboard,
|
|
35
|
+
stampreceiver: () => stampreceiver,
|
|
35
36
|
tssop: () => tssop
|
|
36
37
|
});
|
|
37
38
|
|
|
@@ -63,6 +64,23 @@ var platedhole = (pn, x, y, id, od) => {
|
|
|
63
64
|
// src/fn/dip.ts
|
|
64
65
|
import { z } from "zod";
|
|
65
66
|
import { length } from "circuit-json";
|
|
67
|
+
|
|
68
|
+
// src/helpers/silkscreenRef.ts
|
|
69
|
+
var silkscreenRef = (x, y, font_size) => {
|
|
70
|
+
return {
|
|
71
|
+
type: "pcb_silkscreen_text",
|
|
72
|
+
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
73
|
+
font: "tscircuit2024",
|
|
74
|
+
font_size,
|
|
75
|
+
pcb_component_id: "pcb_component_1",
|
|
76
|
+
text: "{REF}",
|
|
77
|
+
layer: "top",
|
|
78
|
+
anchor_position: { x, y },
|
|
79
|
+
anchor_alignment: "center"
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/fn/dip.ts
|
|
66
84
|
var extendDipDef = (newDefaults) => z.object({
|
|
67
85
|
fn: z.string(),
|
|
68
86
|
dip: z.literal(true),
|
|
@@ -163,8 +181,14 @@ var dip = (raw_params) => {
|
|
|
163
181
|
};
|
|
164
182
|
silkscreenPins.push(silkscreenPin);
|
|
165
183
|
}
|
|
184
|
+
const silkscreenRefText = silkscreenRef(0, sh / 2 + 0.5, 0.4);
|
|
166
185
|
return {
|
|
167
|
-
circuitJson: [
|
|
186
|
+
circuitJson: [
|
|
187
|
+
...platedHoles,
|
|
188
|
+
silkscreenBorder,
|
|
189
|
+
silkscreenRefText,
|
|
190
|
+
...silkscreenPins
|
|
191
|
+
],
|
|
168
192
|
parameters
|
|
169
193
|
};
|
|
170
194
|
};
|
|
@@ -332,15 +356,18 @@ var passive = (params) => {
|
|
|
332
356
|
throw new Error("could not infer pad width");
|
|
333
357
|
if (ph === void 0)
|
|
334
358
|
throw new Error("could not infer pad width");
|
|
359
|
+
const silkscreenRefText = silkscreenRef(0, h / 2, h / 12);
|
|
335
360
|
if (tht) {
|
|
336
361
|
return [
|
|
337
362
|
platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
|
|
338
|
-
platedhole(2, p / 2, 0, pw, pw * 1 / 0.8)
|
|
363
|
+
platedhole(2, p / 2, 0, pw, pw * 1 / 0.8),
|
|
364
|
+
silkscreenRefText
|
|
339
365
|
];
|
|
340
366
|
} else {
|
|
341
367
|
return [
|
|
342
368
|
rectpad(["1", "left"], -p / 2, 0, pw, ph),
|
|
343
|
-
rectpad(["2", "right"], p / 2, 0, pw, ph)
|
|
369
|
+
rectpad(["2", "right"], p / 2, 0, pw, ph),
|
|
370
|
+
silkscreenRefText
|
|
344
371
|
];
|
|
345
372
|
}
|
|
346
373
|
};
|
|
@@ -439,8 +466,8 @@ var bga_def = z5.object({
|
|
|
439
466
|
const m = s.match(/([A-Z]+)(\d+)/);
|
|
440
467
|
if (!m)
|
|
441
468
|
return s;
|
|
442
|
-
|
|
443
|
-
|
|
469
|
+
const Y = ALPHABET.indexOf(m[1]);
|
|
470
|
+
const X = Number.parseInt(m[2]) - 1;
|
|
444
471
|
return Y * a.grid.x + X + 1;
|
|
445
472
|
});
|
|
446
473
|
}
|
|
@@ -503,7 +530,15 @@ ${JSON.stringify(
|
|
|
503
530
|
);
|
|
504
531
|
}
|
|
505
532
|
}
|
|
506
|
-
|
|
533
|
+
const silkscreenRefText = silkscreenRef(
|
|
534
|
+
0,
|
|
535
|
+
grid.y * p / 2,
|
|
536
|
+
0.2
|
|
537
|
+
);
|
|
538
|
+
return {
|
|
539
|
+
circuitJson: [...pads, silkscreenRefText],
|
|
540
|
+
parameters
|
|
541
|
+
};
|
|
507
542
|
};
|
|
508
543
|
|
|
509
544
|
// src/fn/soic.ts
|
|
@@ -571,6 +606,11 @@ var soicWithoutParsing = (parameters) => {
|
|
|
571
606
|
const m = Math.min(1, parameters.p / 2);
|
|
572
607
|
const sw = parameters.w - (parameters.legsoutside ? 0 : parameters.pl * 2) - 0.2;
|
|
573
608
|
const sh = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw + m;
|
|
609
|
+
const silkscreenRefText = silkscreenRef(
|
|
610
|
+
0,
|
|
611
|
+
sh / 2 + 0.4,
|
|
612
|
+
sh / 12
|
|
613
|
+
);
|
|
574
614
|
const silkscreenBorder = {
|
|
575
615
|
type: "pcb_silkscreen_path",
|
|
576
616
|
layer: "top",
|
|
@@ -590,7 +630,7 @@ var soicWithoutParsing = (parameters) => {
|
|
|
590
630
|
{ x: -sw / 2, y: -sh / 2 }
|
|
591
631
|
]
|
|
592
632
|
};
|
|
593
|
-
return [...pads, silkscreenBorder];
|
|
633
|
+
return [...pads, silkscreenBorder, silkscreenRefText];
|
|
594
634
|
};
|
|
595
635
|
|
|
596
636
|
// src/fn/quad.ts
|
|
@@ -840,7 +880,8 @@ var quad = (raw_params) => {
|
|
|
840
880
|
y: corner_y - csz * dy
|
|
841
881
|
}
|
|
842
882
|
],
|
|
843
|
-
type: "pcb_silkscreen_path"
|
|
883
|
+
type: "pcb_silkscreen_path",
|
|
884
|
+
stroke_width: 0.1
|
|
844
885
|
});
|
|
845
886
|
}
|
|
846
887
|
if ((arrow === "in1" || arrow === "in2") && !parameters.legsoutside) {
|
|
@@ -859,7 +900,8 @@ var quad = (raw_params) => {
|
|
|
859
900
|
y: corner_y
|
|
860
901
|
}
|
|
861
902
|
],
|
|
862
|
-
type: "pcb_silkscreen_path"
|
|
903
|
+
type: "pcb_silkscreen_path",
|
|
904
|
+
stroke_width: 0
|
|
863
905
|
},
|
|
864
906
|
{
|
|
865
907
|
layer: "top",
|
|
@@ -875,7 +917,8 @@ var quad = (raw_params) => {
|
|
|
875
917
|
y: corner_y - csz * dy
|
|
876
918
|
}
|
|
877
919
|
],
|
|
878
|
-
type: "pcb_silkscreen_path"
|
|
920
|
+
type: "pcb_silkscreen_path",
|
|
921
|
+
stroke_width: 0.1
|
|
879
922
|
}
|
|
880
923
|
);
|
|
881
924
|
}
|
|
@@ -902,12 +945,22 @@ var quad = (raw_params) => {
|
|
|
902
945
|
y: arrow_y + 0.2 * rotate_arrow
|
|
903
946
|
}
|
|
904
947
|
],
|
|
905
|
-
type: "pcb_silkscreen_path"
|
|
948
|
+
type: "pcb_silkscreen_path",
|
|
949
|
+
stroke_width: 0.1
|
|
906
950
|
});
|
|
907
951
|
}
|
|
908
952
|
}
|
|
953
|
+
const silkscreenRefText = silkscreenRef(
|
|
954
|
+
0,
|
|
955
|
+
parameters.h / 2 + (parameters.legsoutside ? parameters.pl * 1.2 : 0.5),
|
|
956
|
+
0.3
|
|
957
|
+
);
|
|
909
958
|
return {
|
|
910
|
-
circuitJson: [
|
|
959
|
+
circuitJson: [
|
|
960
|
+
...pads,
|
|
961
|
+
...silkscreen_corners,
|
|
962
|
+
silkscreenRefText
|
|
963
|
+
],
|
|
911
964
|
parameters
|
|
912
965
|
};
|
|
913
966
|
};
|
|
@@ -1080,21 +1133,26 @@ var sot23WithoutParsing = (parameters) => {
|
|
|
1080
1133
|
const { x, y } = getCcwSot23Coords({
|
|
1081
1134
|
num_pins: parameters.num_pins,
|
|
1082
1135
|
pn: i + 1,
|
|
1083
|
-
w: parseFloat(parameters.w),
|
|
1084
|
-
h: parseFloat(parameters.h),
|
|
1085
|
-
pl: parseFloat(parameters.pl)
|
|
1136
|
+
w: Number.parseFloat(parameters.w),
|
|
1137
|
+
h: Number.parseFloat(parameters.h),
|
|
1138
|
+
pl: Number.parseFloat(parameters.pl)
|
|
1086
1139
|
});
|
|
1087
1140
|
pads.push(
|
|
1088
1141
|
rectpad(
|
|
1089
1142
|
i + 1,
|
|
1090
1143
|
x,
|
|
1091
1144
|
y,
|
|
1092
|
-
parseFloat(parameters.pl),
|
|
1093
|
-
parseFloat(parameters.pw)
|
|
1145
|
+
Number.parseFloat(parameters.pl),
|
|
1146
|
+
Number.parseFloat(parameters.pw)
|
|
1094
1147
|
)
|
|
1095
1148
|
);
|
|
1096
1149
|
}
|
|
1097
|
-
|
|
1150
|
+
const silkscreenRefText = silkscreenRef(
|
|
1151
|
+
0,
|
|
1152
|
+
Number(parameters.h),
|
|
1153
|
+
0.3
|
|
1154
|
+
);
|
|
1155
|
+
return [...pads, silkscreenRefText];
|
|
1098
1156
|
};
|
|
1099
1157
|
|
|
1100
1158
|
// src/fn/dfn.ts
|
|
@@ -1141,7 +1199,8 @@ var dfn = (raw_params) => {
|
|
|
1141
1199
|
{ x: dx * sw / 2, y: dy * sh / 2 },
|
|
1142
1200
|
{ x: dx * sw / 2, y: dy * sh / 2 - dy * parameters.p }
|
|
1143
1201
|
],
|
|
1144
|
-
type: "pcb_silkscreen_path"
|
|
1202
|
+
type: "pcb_silkscreen_path",
|
|
1203
|
+
stroke_width: 0.1
|
|
1145
1204
|
});
|
|
1146
1205
|
}
|
|
1147
1206
|
const as = parameters.p / 4;
|
|
@@ -1169,10 +1228,20 @@ var dfn = (raw_params) => {
|
|
|
1169
1228
|
x: atx,
|
|
1170
1229
|
y: aty
|
|
1171
1230
|
}
|
|
1172
|
-
]
|
|
1231
|
+
],
|
|
1232
|
+
stroke_width: 0.1
|
|
1173
1233
|
});
|
|
1234
|
+
const silkscreenRefText = silkscreenRef(
|
|
1235
|
+
0,
|
|
1236
|
+
sh / 2 + 0.4,
|
|
1237
|
+
sh / 12
|
|
1238
|
+
);
|
|
1174
1239
|
return {
|
|
1175
|
-
circuitJson: [
|
|
1240
|
+
circuitJson: [
|
|
1241
|
+
...pads,
|
|
1242
|
+
silkscreenRefText,
|
|
1243
|
+
...silkscreenPaths
|
|
1244
|
+
],
|
|
1176
1245
|
parameters
|
|
1177
1246
|
};
|
|
1178
1247
|
};
|
|
@@ -1196,7 +1265,11 @@ var pinrow = (raw_params) => {
|
|
|
1196
1265
|
for (let i = 0; i < parameters.num_pins; i++) {
|
|
1197
1266
|
holes.push(platedhole(i + 1, xoff + i * p, 0, id, od));
|
|
1198
1267
|
}
|
|
1199
|
-
|
|
1268
|
+
const silkscreenRefText = silkscreenRef(0, p / 2, 0.5);
|
|
1269
|
+
return {
|
|
1270
|
+
circuitJson: [...holes, silkscreenRefText],
|
|
1271
|
+
parameters
|
|
1272
|
+
};
|
|
1200
1273
|
};
|
|
1201
1274
|
|
|
1202
1275
|
// src/fn/sot563.ts
|
|
@@ -1257,8 +1330,14 @@ var sot723_def = z12.object({
|
|
|
1257
1330
|
});
|
|
1258
1331
|
var sot723 = (raw_params) => {
|
|
1259
1332
|
const parameters = sot723_def.parse(raw_params);
|
|
1333
|
+
const pad = sot723WithoutParsing(parameters);
|
|
1334
|
+
const silkscreenRefText = silkscreenRef(
|
|
1335
|
+
0,
|
|
1336
|
+
Number(parameters.h),
|
|
1337
|
+
0.3
|
|
1338
|
+
);
|
|
1260
1339
|
return {
|
|
1261
|
-
circuitJson:
|
|
1340
|
+
circuitJson: [...pad, silkscreenRefText],
|
|
1262
1341
|
parameters
|
|
1263
1342
|
};
|
|
1264
1343
|
};
|
|
@@ -1297,6 +1376,7 @@ var sot723WithoutParsing = (parameters) => {
|
|
|
1297
1376
|
|
|
1298
1377
|
// src/fn/sod123.ts
|
|
1299
1378
|
import { z as z13 } from "zod";
|
|
1379
|
+
import "circuit-json";
|
|
1300
1380
|
var sod_def = z13.object({
|
|
1301
1381
|
fn: z13.string(),
|
|
1302
1382
|
w: z13.string().default("2.36mm"),
|
|
@@ -1307,8 +1387,15 @@ var sod_def = z13.object({
|
|
|
1307
1387
|
});
|
|
1308
1388
|
var sod123 = (raw_params) => {
|
|
1309
1389
|
const parameters = sod_def.parse(raw_params);
|
|
1390
|
+
const silkscreenRefText = silkscreenRef(
|
|
1391
|
+
0,
|
|
1392
|
+
Number(parameters.h) / 4 + 0.4,
|
|
1393
|
+
0.3
|
|
1394
|
+
);
|
|
1310
1395
|
return {
|
|
1311
|
-
circuitJson: sodWithoutParsing(parameters)
|
|
1396
|
+
circuitJson: sodWithoutParsing(parameters).concat(
|
|
1397
|
+
silkscreenRefText
|
|
1398
|
+
),
|
|
1312
1399
|
parameters
|
|
1313
1400
|
};
|
|
1314
1401
|
};
|
|
@@ -1325,15 +1412,15 @@ var sodWithoutParsing = (parameters) => {
|
|
|
1325
1412
|
for (let i = 0; i < 2; i++) {
|
|
1326
1413
|
const { x, y } = getSodCoords({
|
|
1327
1414
|
pn: i + 1,
|
|
1328
|
-
pad_spacing: parseFloat(parameters.pad_spacing)
|
|
1415
|
+
pad_spacing: Number.parseFloat(parameters.pad_spacing)
|
|
1329
1416
|
});
|
|
1330
1417
|
pads.push(
|
|
1331
1418
|
rectpad(
|
|
1332
1419
|
i + 1,
|
|
1333
1420
|
x,
|
|
1334
1421
|
y,
|
|
1335
|
-
parseFloat(parameters.pl),
|
|
1336
|
-
parseFloat(parameters.pw)
|
|
1422
|
+
Number.parseFloat(parameters.pl),
|
|
1423
|
+
Number.parseFloat(parameters.pw)
|
|
1337
1424
|
)
|
|
1338
1425
|
);
|
|
1339
1426
|
}
|
|
@@ -1342,15 +1429,15 @@ var sodWithoutParsing = (parameters) => {
|
|
|
1342
1429
|
|
|
1343
1430
|
// src/fn/axial.ts
|
|
1344
1431
|
import {
|
|
1345
|
-
length as
|
|
1432
|
+
length as length8
|
|
1346
1433
|
} from "@tscircuit/soup";
|
|
1347
1434
|
import { z as z14 } from "zod";
|
|
1348
1435
|
var axial_def = z14.object({
|
|
1349
1436
|
fn: z14.string(),
|
|
1350
1437
|
num_pins: z14.any().transform(() => 2),
|
|
1351
|
-
p:
|
|
1352
|
-
id:
|
|
1353
|
-
od:
|
|
1438
|
+
p: length8.optional().default("2.54mm"),
|
|
1439
|
+
id: length8.optional().default("0.7mm"),
|
|
1440
|
+
od: length8.optional().default("1mm")
|
|
1354
1441
|
});
|
|
1355
1442
|
var axial = (raw_params) => {
|
|
1356
1443
|
const parameters = axial_def.parse(raw_params);
|
|
@@ -1370,7 +1457,15 @@ var axial = (raw_params) => {
|
|
|
1370
1457
|
stroke_width: 0.1,
|
|
1371
1458
|
pcb_silkscreen_path_id: ""
|
|
1372
1459
|
};
|
|
1373
|
-
|
|
1460
|
+
const silkscreenRefText = silkscreenRef(0, p / 4, 0.5);
|
|
1461
|
+
return {
|
|
1462
|
+
circuitJson: [
|
|
1463
|
+
...plated_holes,
|
|
1464
|
+
silkscreenLine,
|
|
1465
|
+
silkscreenRefText
|
|
1466
|
+
],
|
|
1467
|
+
parameters
|
|
1468
|
+
};
|
|
1374
1469
|
};
|
|
1375
1470
|
|
|
1376
1471
|
// src/fn/pushbutton.ts
|
|
@@ -1424,27 +1519,32 @@ var pushbutton = (raw_params) => {
|
|
|
1424
1519
|
{ x: width / 5, y: 0 }
|
|
1425
1520
|
])
|
|
1426
1521
|
];
|
|
1522
|
+
const silkscreenRefText = silkscreenRef(
|
|
1523
|
+
0,
|
|
1524
|
+
height / 2 + 0.4,
|
|
1525
|
+
0.5
|
|
1526
|
+
);
|
|
1427
1527
|
return {
|
|
1428
|
-
circuitJson: [...holes, ...silkscreenLines],
|
|
1528
|
+
circuitJson: [...holes, ...silkscreenLines, silkscreenRefText],
|
|
1429
1529
|
parameters
|
|
1430
1530
|
};
|
|
1431
1531
|
};
|
|
1432
1532
|
|
|
1433
1533
|
// src/fn/stampboard.ts
|
|
1434
1534
|
import {
|
|
1435
|
-
length as
|
|
1535
|
+
length as length9
|
|
1436
1536
|
} from "circuit-json";
|
|
1437
1537
|
import { z as z16 } from "zod";
|
|
1438
1538
|
var stampboard_def = z16.object({
|
|
1439
1539
|
fn: z16.string(),
|
|
1440
|
-
w:
|
|
1441
|
-
left:
|
|
1442
|
-
right:
|
|
1443
|
-
top:
|
|
1444
|
-
bottom:
|
|
1445
|
-
p:
|
|
1446
|
-
pw:
|
|
1447
|
-
pl:
|
|
1540
|
+
w: length9.default("22.58mm"),
|
|
1541
|
+
left: length9.optional(),
|
|
1542
|
+
right: length9.optional(),
|
|
1543
|
+
top: length9.optional(),
|
|
1544
|
+
bottom: length9.optional(),
|
|
1545
|
+
p: length9.default(length9.parse("2.54mm")),
|
|
1546
|
+
pw: length9.default(length9.parse("1.6mm")),
|
|
1547
|
+
pl: length9.default(length9.parse("2.11mm")),
|
|
1448
1548
|
innerhole: z16.boolean().default(false)
|
|
1449
1549
|
});
|
|
1450
1550
|
var getHeight = (parameters) => {
|
|
@@ -1460,46 +1560,124 @@ var getHeight = (parameters) => {
|
|
|
1460
1560
|
}
|
|
1461
1561
|
return 51;
|
|
1462
1562
|
};
|
|
1563
|
+
var getTriangleDir = (x, y, side) => {
|
|
1564
|
+
let routes = [];
|
|
1565
|
+
const triangleHeight = 1;
|
|
1566
|
+
const triangleWidth = 0.6;
|
|
1567
|
+
if (side === "right") {
|
|
1568
|
+
routes = [
|
|
1569
|
+
{
|
|
1570
|
+
x: x + triangleHeight / 2,
|
|
1571
|
+
y
|
|
1572
|
+
},
|
|
1573
|
+
// Tip of the triangle (pointing right)
|
|
1574
|
+
{
|
|
1575
|
+
x: x - triangleHeight / 2,
|
|
1576
|
+
y: y + triangleWidth / 2
|
|
1577
|
+
},
|
|
1578
|
+
// Bottom corner of the base
|
|
1579
|
+
{
|
|
1580
|
+
x: x - triangleHeight / 2,
|
|
1581
|
+
y: y - triangleWidth / 2
|
|
1582
|
+
},
|
|
1583
|
+
// Top corner of the base
|
|
1584
|
+
{
|
|
1585
|
+
x: x + triangleHeight / 2,
|
|
1586
|
+
y
|
|
1587
|
+
}
|
|
1588
|
+
// Close the path at the tip
|
|
1589
|
+
];
|
|
1590
|
+
}
|
|
1591
|
+
if (side === "left") {
|
|
1592
|
+
routes = [
|
|
1593
|
+
{
|
|
1594
|
+
x: x - triangleHeight / 2,
|
|
1595
|
+
y
|
|
1596
|
+
},
|
|
1597
|
+
// Tip of the triangle (pointing left)
|
|
1598
|
+
{
|
|
1599
|
+
x: x + triangleHeight / 2,
|
|
1600
|
+
y: y + triangleWidth / 2
|
|
1601
|
+
},
|
|
1602
|
+
// Top corner of the base
|
|
1603
|
+
{
|
|
1604
|
+
x: x + triangleHeight / 2,
|
|
1605
|
+
y: y - triangleWidth / 2
|
|
1606
|
+
},
|
|
1607
|
+
// Bottom corner of the base
|
|
1608
|
+
{
|
|
1609
|
+
x: x - triangleHeight / 2,
|
|
1610
|
+
y
|
|
1611
|
+
}
|
|
1612
|
+
// Close the path at the tip
|
|
1613
|
+
];
|
|
1614
|
+
}
|
|
1615
|
+
if (side === "top") {
|
|
1616
|
+
routes = [
|
|
1617
|
+
{
|
|
1618
|
+
x,
|
|
1619
|
+
y: y + triangleHeight / 2
|
|
1620
|
+
},
|
|
1621
|
+
// Tip of the triangle (pointing up)
|
|
1622
|
+
{
|
|
1623
|
+
x: x - triangleWidth / 2,
|
|
1624
|
+
y: y - triangleHeight / 2
|
|
1625
|
+
},
|
|
1626
|
+
// Left corner of the base
|
|
1627
|
+
{
|
|
1628
|
+
x: x + triangleWidth / 2,
|
|
1629
|
+
y: y - triangleHeight / 2
|
|
1630
|
+
},
|
|
1631
|
+
// Right corner of the base
|
|
1632
|
+
{
|
|
1633
|
+
x,
|
|
1634
|
+
y: y + triangleHeight / 2
|
|
1635
|
+
}
|
|
1636
|
+
// Close the path at the tip
|
|
1637
|
+
];
|
|
1638
|
+
}
|
|
1639
|
+
if (side === "bottom") {
|
|
1640
|
+
routes = [
|
|
1641
|
+
{
|
|
1642
|
+
x,
|
|
1643
|
+
y: y - triangleHeight / 2
|
|
1644
|
+
},
|
|
1645
|
+
// Tip of the triangle (pointing down)
|
|
1646
|
+
{
|
|
1647
|
+
x: x - triangleWidth / 2,
|
|
1648
|
+
y: y + triangleHeight / 2
|
|
1649
|
+
},
|
|
1650
|
+
// Left corner of the base
|
|
1651
|
+
{
|
|
1652
|
+
x: x + triangleWidth / 2,
|
|
1653
|
+
y: y + triangleHeight / 2
|
|
1654
|
+
},
|
|
1655
|
+
// Right corner of the base
|
|
1656
|
+
{
|
|
1657
|
+
x,
|
|
1658
|
+
y: y - triangleHeight / 2
|
|
1659
|
+
}
|
|
1660
|
+
// Close the path at the tip
|
|
1661
|
+
];
|
|
1662
|
+
}
|
|
1663
|
+
return routes;
|
|
1664
|
+
};
|
|
1463
1665
|
var stampboard = (raw_params) => {
|
|
1464
1666
|
const params = stampboard_def.parse(raw_params);
|
|
1465
1667
|
const rectpads = [];
|
|
1466
1668
|
const holes = [];
|
|
1467
|
-
let firstPinLocation = { x: 0, y: 0 };
|
|
1468
1669
|
let routes = [];
|
|
1469
1670
|
const innerDiameter = 1;
|
|
1470
1671
|
const outerDiameter = 1.2;
|
|
1471
|
-
const triangleHeight = 1;
|
|
1472
|
-
const triangleWidth = 0.6;
|
|
1473
1672
|
if (params.right) {
|
|
1474
1673
|
const yoff = -((params.right - 1) / 2) * params.p;
|
|
1475
1674
|
for (let i = 0; i < params.right; i++) {
|
|
1476
1675
|
if (i === 0 && !params.left && !params.bottom) {
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
{
|
|
1483
|
-
x: firstPinLocation.x + triangleHeight / 2,
|
|
1484
|
-
y: firstPinLocation.y
|
|
1485
|
-
},
|
|
1486
|
-
// Tip of the triangle (pointing right)
|
|
1487
|
-
{
|
|
1488
|
-
x: firstPinLocation.x - triangleHeight / 2,
|
|
1489
|
-
y: firstPinLocation.y + triangleWidth / 2
|
|
1490
|
-
},
|
|
1491
|
-
// Bottom corner of the base
|
|
1492
|
-
{
|
|
1493
|
-
x: firstPinLocation.x - triangleHeight / 2,
|
|
1494
|
-
y: firstPinLocation.y - triangleWidth / 2
|
|
1495
|
-
},
|
|
1496
|
-
// Top corner of the base
|
|
1497
|
-
{
|
|
1498
|
-
x: firstPinLocation.x + triangleHeight / 2,
|
|
1499
|
-
y: firstPinLocation.y
|
|
1500
|
-
}
|
|
1501
|
-
// Close the path at the tip
|
|
1502
|
-
];
|
|
1676
|
+
routes = getTriangleDir(
|
|
1677
|
+
params.w / 2 - params.pl * 1.4,
|
|
1678
|
+
yoff + i * params.p,
|
|
1679
|
+
"right"
|
|
1680
|
+
);
|
|
1503
1681
|
}
|
|
1504
1682
|
rectpads.push(
|
|
1505
1683
|
rectpad(
|
|
@@ -1536,32 +1714,11 @@ var stampboard = (raw_params) => {
|
|
|
1536
1714
|
const yoff = -((params.left - 1) / 2) * params.p;
|
|
1537
1715
|
for (let i = 0; i < params.left; i++) {
|
|
1538
1716
|
if (i === params.left - 1) {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
{
|
|
1545
|
-
x: firstPinLocation.x - triangleHeight / 2,
|
|
1546
|
-
y: firstPinLocation.y
|
|
1547
|
-
},
|
|
1548
|
-
// Tip of the triangle (pointing left)
|
|
1549
|
-
{
|
|
1550
|
-
x: firstPinLocation.x + triangleHeight / 2,
|
|
1551
|
-
y: firstPinLocation.y + triangleWidth / 2
|
|
1552
|
-
},
|
|
1553
|
-
// Top corner of the base
|
|
1554
|
-
{
|
|
1555
|
-
x: firstPinLocation.x + triangleHeight / 2,
|
|
1556
|
-
y: firstPinLocation.y - triangleWidth / 2
|
|
1557
|
-
},
|
|
1558
|
-
// Bottom corner of the base
|
|
1559
|
-
{
|
|
1560
|
-
x: firstPinLocation.x - triangleHeight / 2,
|
|
1561
|
-
y: firstPinLocation.y
|
|
1562
|
-
}
|
|
1563
|
-
// Close the path at the tip
|
|
1564
|
-
];
|
|
1717
|
+
routes = getTriangleDir(
|
|
1718
|
+
-params.w / 2 + params.pl * 1.4,
|
|
1719
|
+
yoff + i * params.p,
|
|
1720
|
+
"left"
|
|
1721
|
+
);
|
|
1565
1722
|
}
|
|
1566
1723
|
rectpads.push(
|
|
1567
1724
|
rectpad(
|
|
@@ -1598,32 +1755,11 @@ var stampboard = (raw_params) => {
|
|
|
1598
1755
|
const xoff = -((params.top - 1) / 2) * params.p;
|
|
1599
1756
|
for (let i = 0; i < params.top; i++) {
|
|
1600
1757
|
if (i === params.top - 1 && !params.left && !params.bottom && !params.right) {
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
{
|
|
1607
|
-
x: firstPinLocation.x,
|
|
1608
|
-
y: firstPinLocation.y + triangleHeight / 2
|
|
1609
|
-
},
|
|
1610
|
-
// Tip of the triangle (pointing up)
|
|
1611
|
-
{
|
|
1612
|
-
x: firstPinLocation.x - triangleWidth / 2,
|
|
1613
|
-
y: firstPinLocation.y - triangleHeight / 2
|
|
1614
|
-
},
|
|
1615
|
-
// Left corner of the base
|
|
1616
|
-
{
|
|
1617
|
-
x: firstPinLocation.x + triangleWidth / 2,
|
|
1618
|
-
y: firstPinLocation.y - triangleHeight / 2
|
|
1619
|
-
},
|
|
1620
|
-
// Right corner of the base
|
|
1621
|
-
{
|
|
1622
|
-
x: firstPinLocation.x,
|
|
1623
|
-
y: firstPinLocation.y + triangleHeight / 2
|
|
1624
|
-
}
|
|
1625
|
-
// Close the path at the tip
|
|
1626
|
-
];
|
|
1758
|
+
routes = getTriangleDir(
|
|
1759
|
+
xoff + i * params.p,
|
|
1760
|
+
getHeight(params) / 2 - params.pl * 1.4,
|
|
1761
|
+
"top"
|
|
1762
|
+
);
|
|
1627
1763
|
}
|
|
1628
1764
|
rectpads.push(
|
|
1629
1765
|
rectpad(
|
|
@@ -1660,32 +1796,11 @@ var stampboard = (raw_params) => {
|
|
|
1660
1796
|
const xoff = -((params.bottom - 1) / 2) * params.p;
|
|
1661
1797
|
for (let i = 0; i < params.bottom; i++) {
|
|
1662
1798
|
if (i === 0 && !params.left) {
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
{
|
|
1669
|
-
x: firstPinLocation.x,
|
|
1670
|
-
y: firstPinLocation.y - triangleHeight / 2
|
|
1671
|
-
},
|
|
1672
|
-
// Tip of the triangle (pointing down)
|
|
1673
|
-
{
|
|
1674
|
-
x: firstPinLocation.x - triangleWidth / 2,
|
|
1675
|
-
y: firstPinLocation.y + triangleHeight / 2
|
|
1676
|
-
},
|
|
1677
|
-
// Left corner of the base
|
|
1678
|
-
{
|
|
1679
|
-
x: firstPinLocation.x + triangleWidth / 2,
|
|
1680
|
-
y: firstPinLocation.y + triangleHeight / 2
|
|
1681
|
-
},
|
|
1682
|
-
// Right corner of the base
|
|
1683
|
-
{
|
|
1684
|
-
x: firstPinLocation.x,
|
|
1685
|
-
y: firstPinLocation.y - triangleHeight / 2
|
|
1686
|
-
}
|
|
1687
|
-
// Close the path at the tip
|
|
1688
|
-
];
|
|
1799
|
+
routes = getTriangleDir(
|
|
1800
|
+
xoff + i * params.p,
|
|
1801
|
+
-getHeight(params) / 2 + params.pl * 1.4,
|
|
1802
|
+
"bottom"
|
|
1803
|
+
);
|
|
1689
1804
|
}
|
|
1690
1805
|
rectpads.push(
|
|
1691
1806
|
rectpad(
|
|
@@ -1740,8 +1855,291 @@ var stampboard = (raw_params) => {
|
|
|
1740
1855
|
stroke_width: 0.1,
|
|
1741
1856
|
layer: "top"
|
|
1742
1857
|
};
|
|
1858
|
+
const silkscreenRefText = silkscreenRef(
|
|
1859
|
+
0,
|
|
1860
|
+
getHeight(params) / 1.8,
|
|
1861
|
+
getHeight(params) / 25
|
|
1862
|
+
);
|
|
1863
|
+
return {
|
|
1864
|
+
circuitJson: [
|
|
1865
|
+
...rectpads,
|
|
1866
|
+
...holes,
|
|
1867
|
+
silkscreenPath,
|
|
1868
|
+
silkscreenTriangle,
|
|
1869
|
+
silkscreenRefText
|
|
1870
|
+
],
|
|
1871
|
+
parameters: params
|
|
1872
|
+
};
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
// src/fn/stampreceiver.ts
|
|
1876
|
+
import {
|
|
1877
|
+
length as length10
|
|
1878
|
+
} from "circuit-json";
|
|
1879
|
+
import { z as z17 } from "zod";
|
|
1880
|
+
var stampreceiver_def = z17.object({
|
|
1881
|
+
fn: z17.string(),
|
|
1882
|
+
w: length10.default("22.58mm"),
|
|
1883
|
+
left: length10.optional(),
|
|
1884
|
+
right: length10.optional(),
|
|
1885
|
+
top: length10.optional(),
|
|
1886
|
+
bottom: length10.optional(),
|
|
1887
|
+
p: length10.default(length10.parse("2.54mm")),
|
|
1888
|
+
pw: length10.default(length10.parse("1.6mm")),
|
|
1889
|
+
pl: length10.default(length10.parse("3.2mm"))
|
|
1890
|
+
});
|
|
1891
|
+
var getHeight2 = (parameters) => {
|
|
1892
|
+
const params = stampreceiver_def.parse(parameters);
|
|
1893
|
+
if (params.left && params.right) {
|
|
1894
|
+
return Math.max(params.left, params.right) * params.p;
|
|
1895
|
+
}
|
|
1896
|
+
if (params.left) {
|
|
1897
|
+
return params.left * params.p;
|
|
1898
|
+
}
|
|
1899
|
+
if (params.right) {
|
|
1900
|
+
return params.right * params.p;
|
|
1901
|
+
}
|
|
1902
|
+
return 51;
|
|
1903
|
+
};
|
|
1904
|
+
var getTriangleDir2 = (x, y, side) => {
|
|
1905
|
+
let routes = [];
|
|
1906
|
+
const triangleHeight = 1;
|
|
1907
|
+
const triangleWidth = 0.6;
|
|
1908
|
+
if (side === "left") {
|
|
1909
|
+
routes = [
|
|
1910
|
+
{
|
|
1911
|
+
x: x + triangleHeight / 2,
|
|
1912
|
+
y
|
|
1913
|
+
},
|
|
1914
|
+
// Tip of the triangle (pointing right)
|
|
1915
|
+
{
|
|
1916
|
+
x: x - triangleHeight / 2,
|
|
1917
|
+
y: y + triangleWidth / 2
|
|
1918
|
+
},
|
|
1919
|
+
// Bottom corner of the base
|
|
1920
|
+
{
|
|
1921
|
+
x: x - triangleHeight / 2,
|
|
1922
|
+
y: y - triangleWidth / 2
|
|
1923
|
+
},
|
|
1924
|
+
// Top corner of the base
|
|
1925
|
+
{
|
|
1926
|
+
x: x + triangleHeight / 2,
|
|
1927
|
+
y
|
|
1928
|
+
}
|
|
1929
|
+
// Close the path at the tip
|
|
1930
|
+
];
|
|
1931
|
+
}
|
|
1932
|
+
if (side === "right") {
|
|
1933
|
+
routes = [
|
|
1934
|
+
{
|
|
1935
|
+
x: x - triangleHeight / 2,
|
|
1936
|
+
y
|
|
1937
|
+
},
|
|
1938
|
+
// Tip of the triangle (pointing left)
|
|
1939
|
+
{
|
|
1940
|
+
x: x + triangleHeight / 2,
|
|
1941
|
+
y: y + triangleWidth / 2
|
|
1942
|
+
},
|
|
1943
|
+
// Top corner of the base
|
|
1944
|
+
{
|
|
1945
|
+
x: x + triangleHeight / 2,
|
|
1946
|
+
y: y - triangleWidth / 2
|
|
1947
|
+
},
|
|
1948
|
+
// Bottom corner of the base
|
|
1949
|
+
{
|
|
1950
|
+
x: x - triangleHeight / 2,
|
|
1951
|
+
y
|
|
1952
|
+
}
|
|
1953
|
+
// Close the path at the tip
|
|
1954
|
+
];
|
|
1955
|
+
}
|
|
1956
|
+
if (side === "bottom") {
|
|
1957
|
+
routes = [
|
|
1958
|
+
{
|
|
1959
|
+
x,
|
|
1960
|
+
y: y + triangleHeight / 2
|
|
1961
|
+
},
|
|
1962
|
+
// Tip of the triangle (pointing up)
|
|
1963
|
+
{
|
|
1964
|
+
x: x - triangleWidth / 2,
|
|
1965
|
+
y: y - triangleHeight / 2
|
|
1966
|
+
},
|
|
1967
|
+
// Left corner of the base
|
|
1968
|
+
{
|
|
1969
|
+
x: x + triangleWidth / 2,
|
|
1970
|
+
y: y - triangleHeight / 2
|
|
1971
|
+
},
|
|
1972
|
+
// Right corner of the base
|
|
1973
|
+
{
|
|
1974
|
+
x,
|
|
1975
|
+
y: y + triangleHeight / 2
|
|
1976
|
+
}
|
|
1977
|
+
// Close the path at the tip
|
|
1978
|
+
];
|
|
1979
|
+
}
|
|
1980
|
+
if (side === "top") {
|
|
1981
|
+
routes = [
|
|
1982
|
+
{
|
|
1983
|
+
x,
|
|
1984
|
+
y: y - triangleHeight / 2
|
|
1985
|
+
},
|
|
1986
|
+
// Tip of the triangle (pointing down)
|
|
1987
|
+
{
|
|
1988
|
+
x: x - triangleWidth / 2,
|
|
1989
|
+
y: y + triangleHeight / 2
|
|
1990
|
+
},
|
|
1991
|
+
// Left corner of the base
|
|
1992
|
+
{
|
|
1993
|
+
x: x + triangleWidth / 2,
|
|
1994
|
+
y: y + triangleHeight / 2
|
|
1995
|
+
},
|
|
1996
|
+
// Right corner of the base
|
|
1997
|
+
{
|
|
1998
|
+
x,
|
|
1999
|
+
y: y - triangleHeight / 2
|
|
2000
|
+
}
|
|
2001
|
+
// Close the path at the tip
|
|
2002
|
+
];
|
|
2003
|
+
}
|
|
2004
|
+
return routes;
|
|
2005
|
+
};
|
|
2006
|
+
var stampreceiver = (raw_params) => {
|
|
2007
|
+
const params = stampreceiver_def.parse(raw_params);
|
|
2008
|
+
const rectpads = [];
|
|
2009
|
+
let routes = [];
|
|
2010
|
+
if (params.right) {
|
|
2011
|
+
const yoff = -((params.right - 1) / 2) * params.p;
|
|
2012
|
+
for (let i = 0; i < params.right; i++) {
|
|
2013
|
+
if (i === 0 && !params.left && !params.bottom) {
|
|
2014
|
+
routes = getTriangleDir2(
|
|
2015
|
+
params.w / 2 + params.pl * 1.4,
|
|
2016
|
+
yoff + i * params.p,
|
|
2017
|
+
"right"
|
|
2018
|
+
);
|
|
2019
|
+
}
|
|
2020
|
+
rectpads.push(
|
|
2021
|
+
rectpad(
|
|
2022
|
+
i + 1,
|
|
2023
|
+
params.w / 2 - params.pl / 2,
|
|
2024
|
+
yoff + i * params.p,
|
|
2025
|
+
params.pl,
|
|
2026
|
+
params.pw
|
|
2027
|
+
)
|
|
2028
|
+
);
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
if (params.left) {
|
|
2032
|
+
const yoff = -((params.left - 1) / 2) * params.p;
|
|
2033
|
+
for (let i = 0; i < params.left; i++) {
|
|
2034
|
+
if (i === params.left - 1) {
|
|
2035
|
+
routes = getTriangleDir2(
|
|
2036
|
+
-params.w / 2 - params.pl / 3,
|
|
2037
|
+
yoff + i * params.p,
|
|
2038
|
+
"left"
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
rectpads.push(
|
|
2042
|
+
rectpad(
|
|
2043
|
+
i + 1,
|
|
2044
|
+
-params.w / 2 + params.pl / 2,
|
|
2045
|
+
yoff + i * params.p,
|
|
2046
|
+
params.pl,
|
|
2047
|
+
params.pw
|
|
2048
|
+
)
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
if (params.top) {
|
|
2053
|
+
const xoff = -((params.top - 1) / 2) * params.p;
|
|
2054
|
+
for (let i = 0; i < params.top; i++) {
|
|
2055
|
+
if (i === params.top - 1 && !params.left && !params.bottom && !params.right) {
|
|
2056
|
+
routes = getTriangleDir2(
|
|
2057
|
+
xoff + i * params.p,
|
|
2058
|
+
getHeight2(params) / 2 + params.pl * 1.4,
|
|
2059
|
+
"top"
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
2062
|
+
rectpads.push(
|
|
2063
|
+
rectpad(
|
|
2064
|
+
i + 1,
|
|
2065
|
+
xoff + i * params.p,
|
|
2066
|
+
getHeight2(params) / 2 - params.pl / 2,
|
|
2067
|
+
params.pw,
|
|
2068
|
+
params.pl
|
|
2069
|
+
)
|
|
2070
|
+
);
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
if (params.bottom) {
|
|
2074
|
+
const xoff = -((params.bottom - 1) / 2) * params.p;
|
|
2075
|
+
for (let i = 0; i < params.bottom; i++) {
|
|
2076
|
+
if (i === 0 && !params.left) {
|
|
2077
|
+
routes = getTriangleDir2(
|
|
2078
|
+
xoff + i * params.p,
|
|
2079
|
+
-getHeight2(params) / 2 - params.pl * 1.4,
|
|
2080
|
+
"bottom"
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
rectpads.push(
|
|
2084
|
+
rectpad(
|
|
2085
|
+
i + 1,
|
|
2086
|
+
xoff + i * params.p,
|
|
2087
|
+
-getHeight2(params) / 2 + params.pl / 2,
|
|
2088
|
+
params.pw,
|
|
2089
|
+
params.pl
|
|
2090
|
+
)
|
|
2091
|
+
);
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
const silkscreenTriangle = {
|
|
2095
|
+
type: "pcb_silkscreen_path",
|
|
2096
|
+
pcb_silkscreen_path_id: "1",
|
|
2097
|
+
pcb_component_id: "1",
|
|
2098
|
+
layer: "top",
|
|
2099
|
+
route: routes,
|
|
2100
|
+
stroke_width: 0.1
|
|
2101
|
+
};
|
|
2102
|
+
const silkscreenPath = {
|
|
2103
|
+
type: "pcb_silkscreen_path",
|
|
2104
|
+
pcb_silkscreen_path_id: "pcb_silkscreen_path_1",
|
|
2105
|
+
pcb_component_id: "1",
|
|
2106
|
+
route: [
|
|
2107
|
+
{
|
|
2108
|
+
x: -params.w / 2 - params.pl / 3,
|
|
2109
|
+
y: getHeight2(params) / 2 + params.pl / 3
|
|
2110
|
+
},
|
|
2111
|
+
{
|
|
2112
|
+
x: params.w / 2 + params.pl / 3,
|
|
2113
|
+
y: getHeight2(params) / 2 + params.pl / 3
|
|
2114
|
+
},
|
|
2115
|
+
{
|
|
2116
|
+
x: params.w / 2 + params.pl / 3,
|
|
2117
|
+
y: -getHeight2(params) / 2 - params.pl / 3
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
x: -params.w / 2 - params.pl / 3,
|
|
2121
|
+
y: -getHeight2(params) / 2 - params.pl / 3
|
|
2122
|
+
},
|
|
2123
|
+
{
|
|
2124
|
+
x: -params.w / 2 - params.pl / 3,
|
|
2125
|
+
y: getHeight2(params) / 2 + params.pl / 3
|
|
2126
|
+
}
|
|
2127
|
+
],
|
|
2128
|
+
stroke_width: 0.1,
|
|
2129
|
+
layer: "top"
|
|
2130
|
+
};
|
|
2131
|
+
const silkscreenRefText = silkscreenRef(
|
|
2132
|
+
0,
|
|
2133
|
+
getHeight2(params) / 1.8,
|
|
2134
|
+
getHeight2(params) / 25
|
|
2135
|
+
);
|
|
1743
2136
|
return {
|
|
1744
|
-
circuitJson: [
|
|
2137
|
+
circuitJson: [
|
|
2138
|
+
...rectpads,
|
|
2139
|
+
silkscreenPath,
|
|
2140
|
+
silkscreenTriangle,
|
|
2141
|
+
silkscreenRefText
|
|
2142
|
+
],
|
|
1745
2143
|
parameters: params
|
|
1746
2144
|
};
|
|
1747
2145
|
};
|