@tscircuit/footprinter 0.0.238 → 0.0.240
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 +14 -9
- package/dist/index.js +51 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -166,10 +166,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
166
166
|
p: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
167
167
|
id: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
168
168
|
od: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
169
|
+
nosquareplating: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
169
170
|
}, "strip", z.ZodTypeAny, {
|
|
170
171
|
fn: string;
|
|
171
172
|
num_pins: number;
|
|
172
173
|
p: number;
|
|
174
|
+
nosquareplating: boolean;
|
|
173
175
|
wide?: boolean | undefined;
|
|
174
176
|
narrow?: boolean | undefined;
|
|
175
177
|
w?: number | undefined;
|
|
@@ -184,10 +186,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
184
186
|
p?: string | number | undefined;
|
|
185
187
|
id?: string | number | undefined;
|
|
186
188
|
od?: string | number | undefined;
|
|
189
|
+
nosquareplating?: boolean | undefined;
|
|
187
190
|
}>, NowDefined<{
|
|
188
191
|
fn: string;
|
|
189
192
|
num_pins: number;
|
|
190
193
|
p: number;
|
|
194
|
+
nosquareplating: boolean;
|
|
191
195
|
wide?: boolean | undefined;
|
|
192
196
|
narrow?: boolean | undefined;
|
|
193
197
|
w?: number | undefined;
|
|
@@ -202,6 +206,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
202
206
|
p?: string | number | undefined;
|
|
203
207
|
id?: string | number | undefined;
|
|
204
208
|
od?: string | number | undefined;
|
|
209
|
+
nosquareplating?: boolean | undefined;
|
|
205
210
|
}>, z.ZodEffects<z.ZodObject<{
|
|
206
211
|
fn: z.ZodString;
|
|
207
212
|
cc: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
@@ -399,13 +404,13 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
399
404
|
p: number;
|
|
400
405
|
id: number;
|
|
401
406
|
od: number;
|
|
407
|
+
nosquareplating: boolean;
|
|
402
408
|
pinlabeltextalignleft: boolean;
|
|
403
409
|
pinlabeltextalignright: boolean;
|
|
404
410
|
pinlabelorthogonal: boolean;
|
|
405
411
|
rows: number;
|
|
406
412
|
pinlabeltextaligncenter: boolean;
|
|
407
413
|
pinlabelverticallyinverted: boolean;
|
|
408
|
-
nosquareplating: boolean;
|
|
409
414
|
nopinlabels: boolean;
|
|
410
415
|
doublesidedpinlabel: boolean;
|
|
411
416
|
bottomsidepinlabel: boolean;
|
|
@@ -417,6 +422,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
417
422
|
p?: string | number | undefined;
|
|
418
423
|
id?: string | number | undefined;
|
|
419
424
|
od?: string | number | undefined;
|
|
425
|
+
nosquareplating?: boolean | undefined;
|
|
420
426
|
male?: boolean | undefined;
|
|
421
427
|
female?: boolean | undefined;
|
|
422
428
|
pinlabeltextalignleft?: boolean | undefined;
|
|
@@ -425,7 +431,6 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
425
431
|
rows?: string | number | undefined;
|
|
426
432
|
pinlabeltextaligncenter?: boolean | undefined;
|
|
427
433
|
pinlabelverticallyinverted?: boolean | undefined;
|
|
428
|
-
nosquareplating?: boolean | undefined;
|
|
429
434
|
nopinlabels?: boolean | undefined;
|
|
430
435
|
doublesidedpinlabel?: boolean | undefined;
|
|
431
436
|
bottomsidepinlabel?: boolean | undefined;
|
|
@@ -438,13 +443,13 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
438
443
|
p: number;
|
|
439
444
|
id: number;
|
|
440
445
|
od: number;
|
|
446
|
+
nosquareplating: boolean;
|
|
441
447
|
pinlabeltextalignleft: boolean;
|
|
442
448
|
pinlabeltextalignright: boolean;
|
|
443
449
|
pinlabelorthogonal: boolean;
|
|
444
450
|
rows: number;
|
|
445
451
|
pinlabeltextaligncenter: boolean;
|
|
446
452
|
pinlabelverticallyinverted: boolean;
|
|
447
|
-
nosquareplating: boolean;
|
|
448
453
|
nopinlabels: boolean;
|
|
449
454
|
doublesidedpinlabel: boolean;
|
|
450
455
|
bottomsidepinlabel: boolean;
|
|
@@ -454,6 +459,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
454
459
|
p?: string | number | undefined;
|
|
455
460
|
id?: string | number | undefined;
|
|
456
461
|
od?: string | number | undefined;
|
|
462
|
+
nosquareplating?: boolean | undefined;
|
|
457
463
|
male?: boolean | undefined;
|
|
458
464
|
female?: boolean | undefined;
|
|
459
465
|
pinlabeltextalignleft?: boolean | undefined;
|
|
@@ -462,7 +468,6 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
462
468
|
rows?: string | number | undefined;
|
|
463
469
|
pinlabeltextaligncenter?: boolean | undefined;
|
|
464
470
|
pinlabelverticallyinverted?: boolean | undefined;
|
|
465
|
-
nosquareplating?: boolean | undefined;
|
|
466
471
|
nopinlabels?: boolean | undefined;
|
|
467
472
|
doublesidedpinlabel?: boolean | undefined;
|
|
468
473
|
bottomsidepinlabel?: boolean | undefined;
|
|
@@ -475,13 +480,13 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
475
480
|
p: number;
|
|
476
481
|
id: number;
|
|
477
482
|
od: number;
|
|
483
|
+
nosquareplating: boolean;
|
|
478
484
|
pinlabeltextalignleft: boolean;
|
|
479
485
|
pinlabeltextalignright: boolean;
|
|
480
486
|
pinlabelorthogonal: boolean;
|
|
481
487
|
rows: number;
|
|
482
488
|
pinlabeltextaligncenter: boolean;
|
|
483
489
|
pinlabelverticallyinverted: boolean;
|
|
484
|
-
nosquareplating: boolean;
|
|
485
490
|
nopinlabels: boolean;
|
|
486
491
|
doublesidedpinlabel: boolean;
|
|
487
492
|
bottomsidepinlabel: boolean;
|
|
@@ -491,6 +496,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
491
496
|
p?: string | number | undefined;
|
|
492
497
|
id?: string | number | undefined;
|
|
493
498
|
od?: string | number | undefined;
|
|
499
|
+
nosquareplating?: boolean | undefined;
|
|
494
500
|
male?: boolean | undefined;
|
|
495
501
|
female?: boolean | undefined;
|
|
496
502
|
pinlabeltextalignleft?: boolean | undefined;
|
|
@@ -499,7 +505,6 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
499
505
|
rows?: string | number | undefined;
|
|
500
506
|
pinlabeltextaligncenter?: boolean | undefined;
|
|
501
507
|
pinlabelverticallyinverted?: boolean | undefined;
|
|
502
|
-
nosquareplating?: boolean | undefined;
|
|
503
508
|
nopinlabels?: boolean | undefined;
|
|
504
509
|
doublesidedpinlabel?: boolean | undefined;
|
|
505
510
|
bottomsidepinlabel?: boolean | undefined;
|
|
@@ -1114,8 +1119,8 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
1114
1119
|
string?: string | undefined;
|
|
1115
1120
|
circle?: boolean | undefined;
|
|
1116
1121
|
pill?: boolean | undefined;
|
|
1117
|
-
w?: number | undefined;
|
|
1118
1122
|
rect?: boolean | undefined;
|
|
1123
|
+
w?: number | undefined;
|
|
1119
1124
|
width?: number | undefined;
|
|
1120
1125
|
height?: number | undefined;
|
|
1121
1126
|
radius?: number | undefined;
|
|
@@ -1135,8 +1140,8 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
1135
1140
|
string?: string | undefined;
|
|
1136
1141
|
circle?: boolean | undefined;
|
|
1137
1142
|
pill?: boolean | undefined;
|
|
1138
|
-
w?: string | number | undefined;
|
|
1139
1143
|
rect?: boolean | undefined;
|
|
1144
|
+
w?: string | number | undefined;
|
|
1140
1145
|
width?: string | number | undefined;
|
|
1141
1146
|
height?: string | number | undefined;
|
|
1142
1147
|
radius?: string | number | undefined;
|
|
@@ -1162,8 +1167,8 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
1162
1167
|
string?: string | undefined;
|
|
1163
1168
|
circle?: boolean | undefined;
|
|
1164
1169
|
pill?: boolean | undefined;
|
|
1165
|
-
w?: string | number | undefined;
|
|
1166
1170
|
rect?: boolean | undefined;
|
|
1171
|
+
w?: string | number | undefined;
|
|
1167
1172
|
width?: string | number | undefined;
|
|
1168
1173
|
height?: string | number | undefined;
|
|
1169
1174
|
radius?: string | number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -118,6 +118,26 @@ var platedhole = (pn, x, y, id, od) => {
|
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
+
// src/helpers/platedHoleWithRectPad.ts
|
|
122
|
+
import { mm as mm2 } from "@tscircuit/mm";
|
|
123
|
+
var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight) => {
|
|
124
|
+
return {
|
|
125
|
+
pcb_plated_hole_id: "",
|
|
126
|
+
type: "pcb_plated_hole",
|
|
127
|
+
shape: "circular_hole_with_rect_pad",
|
|
128
|
+
x,
|
|
129
|
+
y,
|
|
130
|
+
hole_diameter: mm2(holeDiameter),
|
|
131
|
+
hole_shape: "circle",
|
|
132
|
+
pad_shape: "rect",
|
|
133
|
+
rect_pad_width: mm2(rectPadWidth),
|
|
134
|
+
rect_pad_height: mm2(rectPadHeight),
|
|
135
|
+
pcb_port_id: "",
|
|
136
|
+
layers: ["top", "bottom"],
|
|
137
|
+
port_hints: [pn.toString()]
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|
|
121
141
|
// src/helpers/u-curve.ts
|
|
122
142
|
var u_curve = Array.from(
|
|
123
143
|
{ length: 9 },
|
|
@@ -146,7 +166,8 @@ var extendDipDef = (newDefaults) => z.object({
|
|
|
146
166
|
w: lengthInMm.optional(),
|
|
147
167
|
p: lengthInMm.default(newDefaults.p ?? "2.54mm"),
|
|
148
168
|
id: lengthInMm.optional(),
|
|
149
|
-
od: lengthInMm.optional()
|
|
169
|
+
od: lengthInMm.optional(),
|
|
170
|
+
nosquareplating: z.boolean().optional().default(false).describe("do not use rectangular pad for pin 1")
|
|
150
171
|
}).transform((v) => {
|
|
151
172
|
if (!v.id && !v.od) {
|
|
152
173
|
if (Math.abs(v.p - 1.27) < 0.01) {
|
|
@@ -173,7 +194,7 @@ var extendDipDef = (newDefaults) => z.object({
|
|
|
173
194
|
return v;
|
|
174
195
|
});
|
|
175
196
|
var dip_def = extendDipDef({});
|
|
176
|
-
var getCcwDipCoords = (pinCount, pn, w, p) => {
|
|
197
|
+
var getCcwDipCoords = (pinCount, pn, w, p, nosquareplating) => {
|
|
177
198
|
const ph = pinCount / 2;
|
|
178
199
|
const isLeft = pn <= ph;
|
|
179
200
|
const leftPinGaps = ph - 1;
|
|
@@ -192,8 +213,22 @@ var dip = (raw_params) => {
|
|
|
192
213
|
parameters.num_pins,
|
|
193
214
|
i + 1,
|
|
194
215
|
parameters.w,
|
|
195
|
-
parameters.p ?? 2.54
|
|
216
|
+
parameters.p ?? 2.54,
|
|
217
|
+
parameters.nosquareplating
|
|
196
218
|
);
|
|
219
|
+
if (i === 0 && !parameters.nosquareplating) {
|
|
220
|
+
platedHoles.push(
|
|
221
|
+
platedHoleWithRectPad(
|
|
222
|
+
i + 1,
|
|
223
|
+
x,
|
|
224
|
+
y,
|
|
225
|
+
parameters.id ?? "0.8mm",
|
|
226
|
+
parameters.od ?? "1mm",
|
|
227
|
+
parameters.od ?? "1mm"
|
|
228
|
+
)
|
|
229
|
+
);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
197
232
|
platedHoles.push(
|
|
198
233
|
platedhole(i + 1, x, y, parameters.id ?? "0.8mm", parameters.od ?? "1mm")
|
|
199
234
|
);
|
|
@@ -229,7 +264,8 @@ var dip = (raw_params) => {
|
|
|
229
264
|
parameters.num_pins,
|
|
230
265
|
i + 1,
|
|
231
266
|
parameters.w,
|
|
232
|
-
parameters.p ?? 2.54
|
|
267
|
+
parameters.p ?? 2.54,
|
|
268
|
+
parameters.nosquareplating
|
|
233
269
|
);
|
|
234
270
|
const pinLabelX = isLeft ? -parameters.w / 2 - parameters.od / 2 - clearance : parameters.w / 2 + parameters.od / 2 + clearance;
|
|
235
271
|
const pinLabelY = pinCenterY;
|
|
@@ -273,7 +309,7 @@ var rectpad = (pn, x, y, w, h) => {
|
|
|
273
309
|
};
|
|
274
310
|
|
|
275
311
|
// src/helpers/passive-fn.ts
|
|
276
|
-
import
|
|
312
|
+
import mm3 from "@tscircuit/mm";
|
|
277
313
|
import { z as z2 } from "zod";
|
|
278
314
|
import { length, distance } from "circuit-json";
|
|
279
315
|
var footprintSizes = [
|
|
@@ -394,11 +430,11 @@ var passive_def = z2.object({
|
|
|
394
430
|
});
|
|
395
431
|
var passive = (params) => {
|
|
396
432
|
let { tht, p, pw, ph, metric, imperial, w, h, textbottom } = params;
|
|
397
|
-
if (typeof w === "string") w =
|
|
398
|
-
if (typeof h === "string") h =
|
|
399
|
-
if (typeof p === "string") p =
|
|
400
|
-
if (typeof pw === "string") pw =
|
|
401
|
-
if (typeof ph === "string") ph =
|
|
433
|
+
if (typeof w === "string") w = mm3(w);
|
|
434
|
+
if (typeof h === "string") h = mm3(h);
|
|
435
|
+
if (typeof p === "string") p = mm3(p);
|
|
436
|
+
if (typeof pw === "string") pw = mm3(pw);
|
|
437
|
+
if (typeof ph === "string") ph = mm3(ph);
|
|
402
438
|
if (h !== void 0 && w !== void 0 && h > w) {
|
|
403
439
|
throw new Error(
|
|
404
440
|
"height cannot be greater than width (rotated footprint not yet implemented)"
|
|
@@ -1567,26 +1603,6 @@ var dfn = (raw_params) => {
|
|
|
1567
1603
|
import { z as z12 } from "zod";
|
|
1568
1604
|
import { length as length5 } from "circuit-json";
|
|
1569
1605
|
|
|
1570
|
-
// src/helpers/platedHoleWithRectPad.ts
|
|
1571
|
-
import { mm as mm3 } from "@tscircuit/mm";
|
|
1572
|
-
var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight) => {
|
|
1573
|
-
return {
|
|
1574
|
-
pcb_plated_hole_id: "",
|
|
1575
|
-
type: "pcb_plated_hole",
|
|
1576
|
-
shape: "circular_hole_with_rect_pad",
|
|
1577
|
-
x,
|
|
1578
|
-
y,
|
|
1579
|
-
hole_diameter: mm3(holeDiameter),
|
|
1580
|
-
hole_shape: "circle",
|
|
1581
|
-
pad_shape: "rect",
|
|
1582
|
-
rect_pad_width: mm3(rectPadWidth),
|
|
1583
|
-
rect_pad_height: mm3(rectPadHeight),
|
|
1584
|
-
pcb_port_id: "",
|
|
1585
|
-
layers: ["top", "bottom"],
|
|
1586
|
-
port_hints: [pn.toString()]
|
|
1587
|
-
};
|
|
1588
|
-
};
|
|
1589
|
-
|
|
1590
1606
|
// src/helpers/silkscreenPin.ts
|
|
1591
1607
|
var silkscreenPin = ({
|
|
1592
1608
|
fs,
|
|
@@ -7316,10 +7332,12 @@ var string2 = (def) => {
|
|
|
7316
7332
|
let fp2 = footprinter();
|
|
7317
7333
|
const modifiedDef = def.replace(/^((?:\d{4}|\d{5}))(?=$|_)/, "res$1");
|
|
7318
7334
|
const def_parts = modifiedDef.split(/_(?!metric)/).map((s) => {
|
|
7319
|
-
const m = s.match(/([a-
|
|
7335
|
+
const m = s.match(/([a-zA-Z]+)([\(\d\.\+\?].*)?/);
|
|
7320
7336
|
if (!m) return null;
|
|
7321
|
-
const [,
|
|
7322
|
-
if (!
|
|
7337
|
+
const [, rawFn, v] = m;
|
|
7338
|
+
if (!rawFn) return null;
|
|
7339
|
+
const fn = rawFn.toLowerCase();
|
|
7340
|
+
if (v?.includes("?")) return null;
|
|
7323
7341
|
return { fn, v };
|
|
7324
7342
|
}).filter(isNotNull);
|
|
7325
7343
|
for (const { fn, v } of def_parts) {
|