@tscircuit/footprinter 0.0.118 → 0.0.119

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 CHANGED
@@ -999,6 +999,7 @@ type Footprinter = {
999
999
  pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od">;
1000
1000
  axial: () => FootprinterParamsBuilder<"p" | "id" | "od">;
1001
1001
  hc49: () => FootprinterParamsBuilder<"p" | "id" | "od" | "w" | "h">;
1002
+ to220: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1002
1003
  sot235: () => FootprinterParamsBuilder<"h" | "p" | "pl" | "pw">;
1003
1004
  to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1004
1005
  minimelf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
package/dist/index.js CHANGED
@@ -49,6 +49,7 @@ __export(fn_exports, {
49
49
  ssop: () => ssop,
50
50
  stampboard: () => stampboard,
51
51
  stampreceiver: () => stampreceiver,
52
+ to220: () => to220,
52
53
  to92: () => to92,
53
54
  tssop: () => tssop
54
55
  });
@@ -3154,23 +3155,122 @@ var sodWithoutParsing7 = (parameters) => {
3154
3155
  return pads;
3155
3156
  };
3156
3157
 
3157
- // src/fn/minimelf.ts
3158
+ // src/fn/to220.ts
3159
+ import {
3160
+ length as length23
3161
+ } from "circuit-json";
3158
3162
  import { z as z29 } from "zod";
3159
- import { length as length23 } from "circuit-json";
3160
- var minimelf_def = z29.object({
3161
- fn: z29.string(),
3162
- num_pins: z29.literal(2).default(2),
3163
- w: z29.string().default("5.40mm"),
3164
- h: z29.string().default("2.30mm"),
3165
- pl: z29.string().default("1.30mm"),
3166
- pw: z29.string().default("1.70mm"),
3167
- p: z29.string().default("3.5mm")
3163
+ var to220_def = z29.object({
3164
+ fn: z29.string().default("to220_3").refine((val) => /^to220_\d+$/.test(val), {
3165
+ message: "Invalid format. Expected 'to220_N' where N is the number of pins."
3166
+ }),
3167
+ p: length23.optional().default("5.0mm"),
3168
+ id: length23.optional().default("1.0mm"),
3169
+ od: length23.optional().default("1.9mm"),
3170
+ w: length23.optional().default("13mm"),
3171
+ h: length23.optional().default("7mm")
3172
+ }).transform((a) => {
3173
+ const match = a.fn.match(/^to220_(\d+)$/);
3174
+ const numPins = match ? parseInt(match[1], 10) : 3;
3175
+ return {
3176
+ ...a,
3177
+ numPins,
3178
+ fn: "to220"
3179
+ };
3180
+ });
3181
+ var to220 = (raw_params) => {
3182
+ const parameters = to220_def.parse(raw_params);
3183
+ const { fn, id, od, w, h, numPins } = parameters;
3184
+ const holeY = -1;
3185
+ const halfWidth = w / 2;
3186
+ const halfHeight = h / 2;
3187
+ const maxHoleWidth = w * 0.6;
3188
+ const minPitch = 1.5;
3189
+ const computedPitch = Math.max(minPitch, maxHoleWidth / (numPins - 1));
3190
+ const plated_holes = Array.from({ length: numPins }, (_, i) => {
3191
+ const x = numPins % 2 === 0 ? (i - numPins / 2 + 0.5) * computedPitch : (i - Math.floor(numPins / 2)) * computedPitch;
3192
+ return platedhole(i + 1, x, holeY, id, od);
3193
+ });
3194
+ const silkscreenBody = {
3195
+ type: "pcb_silkscreen_path",
3196
+ layer: "top",
3197
+ pcb_component_id: "",
3198
+ route: [
3199
+ { x: -halfWidth, y: -halfHeight },
3200
+ { x: halfWidth, y: -halfHeight },
3201
+ { x: halfWidth, y: halfHeight },
3202
+ { x: -halfWidth, y: halfHeight },
3203
+ { x: -halfWidth, y: -halfHeight }
3204
+ ],
3205
+ stroke_width: 0.1,
3206
+ pcb_silkscreen_path_id: ""
3207
+ };
3208
+ const yLine = -halfHeight + 2 * h / 3;
3209
+ const horizontalLine = {
3210
+ type: "pcb_silkscreen_path",
3211
+ layer: "top",
3212
+ pcb_component_id: "",
3213
+ route: [
3214
+ { x: -halfWidth, y: yLine },
3215
+ { x: halfWidth, y: yLine }
3216
+ ],
3217
+ stroke_width: 0.1,
3218
+ pcb_silkscreen_path_id: ""
3219
+ };
3220
+ const verticalLines = [
3221
+ {
3222
+ type: "pcb_silkscreen_path",
3223
+ layer: "top",
3224
+ pcb_component_id: "",
3225
+ route: [
3226
+ { x: -w / 6, y: yLine },
3227
+ { x: -w / 6, y: halfHeight }
3228
+ ],
3229
+ stroke_width: 0.1,
3230
+ pcb_silkscreen_path_id: ""
3231
+ },
3232
+ {
3233
+ type: "pcb_silkscreen_path",
3234
+ layer: "top",
3235
+ pcb_component_id: "",
3236
+ route: [
3237
+ { x: w / 6, y: yLine },
3238
+ { x: w / 6, y: halfHeight }
3239
+ ],
3240
+ stroke_width: 0.1,
3241
+ pcb_silkscreen_path_id: ""
3242
+ }
3243
+ ];
3244
+ const silkscreenRefText = silkscreenRef(0, h / 2 + 0.6, 0.5);
3245
+ return {
3246
+ circuitJson: [
3247
+ ...plated_holes,
3248
+ silkscreenBody,
3249
+ horizontalLine,
3250
+ ...verticalLines,
3251
+ silkscreenRefText
3252
+ ],
3253
+ parameters: { ...parameters, p: computedPitch }
3254
+ };
3255
+ };
3256
+
3257
+ // src/fn/minimelf.ts
3258
+ import { z as z30 } from "zod";
3259
+ import { length as length24 } from "circuit-json";
3260
+ var minimelf_def = z30.object({
3261
+ fn: z30.string(),
3262
+ num_pins: z30.literal(2).default(2),
3263
+ w: z30.string().default("5.40mm"),
3264
+ h: z30.string().default("2.30mm"),
3265
+ pl: z30.string().default("1.30mm"),
3266
+ pw: z30.string().default("1.70mm"),
3267
+ p: z30.string().default("3.5mm")
3168
3268
  });
3169
3269
  var minimelf = (raw_params) => {
3170
3270
  const parameters = minimelf_def.parse(raw_params);
3171
3271
  const silkscreenRefText = silkscreenRef(
3172
3272
  0,
3173
- length23.parse(parameters.h) / 2 + 0.4,
3273
+ length24.parse(parameters.h) / 2 + 0.4,
3174
3274
  0.3
3175
3275
  );
3176
3276
  const silkscreenLine = {
@@ -3179,20 +3279,20 @@ var minimelf = (raw_params) => {
3179
3279
  pcb_component_id: "",
3180
3280
  route: [
3181
3281
  {
3182
- x: length23.parse(parameters.p) / 2,
3183
- y: length23.parse(parameters.h) / 2
3282
+ x: length24.parse(parameters.p) / 2,
3283
+ y: length24.parse(parameters.h) / 2
3184
3284
  },
3185
3285
  {
3186
- x: -length23.parse(parameters.w) / 2,
3187
- y: length23.parse(parameters.h) / 2
3286
+ x: -length24.parse(parameters.w) / 2,
3287
+ y: length24.parse(parameters.h) / 2
3188
3288
  },
3189
3289
  {
3190
- x: -length23.parse(parameters.w) / 2,
3191
- y: -length23.parse(parameters.h) / 2
3290
+ x: -length24.parse(parameters.w) / 2,
3291
+ y: -length24.parse(parameters.h) / 2
3192
3292
  },
3193
3293
  {
3194
- x: length23.parse(parameters.p) / 2,
3195
- y: -length23.parse(parameters.h) / 2
3294
+ x: length24.parse(parameters.p) / 2,
3295
+ y: -length24.parse(parameters.h) / 2
3196
3296
  }
3197
3297
  ],
3198
3298
  stroke_width: 0.1,
@@ -3231,22 +3331,22 @@ var miniMelfWithoutParsing = (parameters) => {
3231
3331
  };
3232
3332
 
3233
3333
  // src/fn/sod882d.ts
3234
- import { z as z30 } from "zod";
3235
- import { length as length24 } from "circuit-json";
3236
- var sod_def8 = z30.object({
3237
- fn: z30.string(),
3238
- num_pins: z30.literal(2).default(2),
3239
- w: z30.string().default("1.90mm"),
3240
- h: z30.string().default("1.33mm"),
3241
- pl: z30.string().default("0.5mm"),
3242
- pw: z30.string().default("0.7mm"),
3243
- pad_spacing: z30.string().default("0.8mm")
3334
+ import { z as z31 } from "zod";
3335
+ import { length as length25 } from "circuit-json";
3336
+ var sod_def8 = z31.object({
3337
+ fn: z31.string(),
3338
+ num_pins: z31.literal(2).default(2),
3339
+ w: z31.string().default("1.90mm"),
3340
+ h: z31.string().default("1.33mm"),
3341
+ pl: z31.string().default("0.5mm"),
3342
+ pw: z31.string().default("0.7mm"),
3343
+ pad_spacing: z31.string().default("0.8mm")
3244
3344
  });
3245
3345
  var sod882d = (raw_params) => {
3246
3346
  const parameters = sod_def8.parse(raw_params);
3247
3347
  const silkscreenRefText = silkscreenRef(
3248
3348
  0,
3249
- length24.parse(parameters.h) + 0.1,
3349
+ length25.parse(parameters.h) + 0.1,
3250
3350
  0.3
3251
3351
  );
3252
3352
  const silkscreenLine = {
@@ -3255,20 +3355,20 @@ var sod882d = (raw_params) => {
3255
3355
  pcb_component_id: "",
3256
3356
  route: [
3257
3357
  {
3258
- x: length24.parse(parameters.pad_spacing) / 2 + 0.1,
3259
- y: length24.parse(parameters.h) / 2
3358
+ x: length25.parse(parameters.pad_spacing) / 2 + 0.1,
3359
+ y: length25.parse(parameters.h) / 2
3260
3360
  },
3261
3361
  {
3262
- x: -length24.parse(parameters.w) / 2,
3263
- y: length24.parse(parameters.h) / 2
3362
+ x: -length25.parse(parameters.w) / 2,
3363
+ y: length25.parse(parameters.h) / 2
3264
3364
  },
3265
3365
  {
3266
- x: -length24.parse(parameters.w) / 2,
3267
- y: -length24.parse(parameters.h) / 2
3366
+ x: -length25.parse(parameters.w) / 2,
3367
+ y: -length25.parse(parameters.h) / 2
3268
3368
  },
3269
3369
  {
3270
- x: length24.parse(parameters.pad_spacing) / 2 + 0.1,
3271
- y: -length24.parse(parameters.h) / 2
3370
+ x: length25.parse(parameters.pad_spacing) / 2 + 0.1,
3371
+ y: -length25.parse(parameters.h) / 2
3272
3372
  }
3273
3373
  ],
3274
3374
  stroke_width: 0.1,
@@ -3311,22 +3411,22 @@ var sodWithoutParsing8 = (parameters) => {
3311
3411
  };
3312
3412
 
3313
3413
  // src/fn/melf.ts
3314
- import { z as z31 } from "zod";
3315
- import { length as length25 } from "circuit-json";
3316
- var melf_def = z31.object({
3317
- fn: z31.string(),
3318
- num_pins: z31.literal(2).default(2),
3319
- w: z31.string().default("7.0mm"),
3320
- h: z31.string().default("3.35mm"),
3321
- pl: z31.string().default("1.50mm"),
3322
- pw: z31.string().default("2.70mm"),
3323
- pad_spacing: z31.string().default("4.8mm")
3414
+ import { z as z32 } from "zod";
3415
+ import { length as length26 } from "circuit-json";
3416
+ var melf_def = z32.object({
3417
+ fn: z32.string(),
3418
+ num_pins: z32.literal(2).default(2),
3419
+ w: z32.string().default("7.0mm"),
3420
+ h: z32.string().default("3.35mm"),
3421
+ pl: z32.string().default("1.50mm"),
3422
+ pw: z32.string().default("2.70mm"),
3423
+ pad_spacing: z32.string().default("4.8mm")
3324
3424
  });
3325
3425
  var melf = (raw_params) => {
3326
3426
  const parameters = melf_def.parse(raw_params);
3327
3427
  const silkscreenRefText = silkscreenRef(
3328
3428
  0,
3329
- length25.parse(parameters.h),
3429
+ length26.parse(parameters.h),
3330
3430
  0.3
3331
3431
  );
3332
3432
  const silkscreenLine = {
@@ -3335,20 +3435,20 @@ var melf = (raw_params) => {
3335
3435
  pcb_component_id: "",
3336
3436
  route: [
3337
3437
  {
3338
- x: length25.parse(parameters.pad_spacing) / 2,
3339
- y: length25.parse(parameters.h) / 2
3438
+ x: length26.parse(parameters.pad_spacing) / 2,
3439
+ y: length26.parse(parameters.h) / 2
3340
3440
  },
3341
3441
  {
3342
- x: -length25.parse(parameters.w) / 2,
3343
- y: length25.parse(parameters.h) / 2
3442
+ x: -length26.parse(parameters.w) / 2,
3443
+ y: length26.parse(parameters.h) / 2
3344
3444
  },
3345
3445
  {
3346
- x: -length25.parse(parameters.w) / 2,
3347
- y: -length25.parse(parameters.h) / 2
3446
+ x: -length26.parse(parameters.w) / 2,
3447
+ y: -length26.parse(parameters.h) / 2
3348
3448
  },
3349
3449
  {
3350
- x: length25.parse(parameters.pad_spacing) / 2,
3351
- y: -length25.parse(parameters.h) / 2
3450
+ x: length26.parse(parameters.pad_spacing) / 2,
3451
+ y: -length26.parse(parameters.h) / 2
3352
3452
  }
3353
3453
  ],
3354
3454
  stroke_width: 0.1,
@@ -3391,22 +3491,22 @@ var melfWithoutParsing = (parameters) => {
3391
3491
  };
3392
3492
 
3393
3493
  // src/fn/micromelf.ts
3394
- import { z as z32 } from "zod";
3395
- import { length as length26 } from "circuit-json";
3396
- var micromelf_def = z32.object({
3397
- fn: z32.string(),
3398
- num_pins: z32.literal(2).default(2),
3399
- w: z32.string().default("3.0mm"),
3400
- h: z32.string().default("1.80mm"),
3401
- pl: z32.string().default("0.80mm"),
3402
- pw: z32.string().default("1.20mm"),
3403
- pad_spacing: z32.string().default("1.6mm")
3494
+ import { z as z33 } from "zod";
3495
+ import { length as length27 } from "circuit-json";
3496
+ var micromelf_def = z33.object({
3497
+ fn: z33.string(),
3498
+ num_pins: z33.literal(2).default(2),
3499
+ w: z33.string().default("3.0mm"),
3500
+ h: z33.string().default("1.80mm"),
3501
+ pl: z33.string().default("0.80mm"),
3502
+ pw: z33.string().default("1.20mm"),
3503
+ pad_spacing: z33.string().default("1.6mm")
3404
3504
  });
3405
3505
  var micromelf = (raw_params) => {
3406
3506
  const parameters = micromelf_def.parse(raw_params);
3407
3507
  const silkscreenRefText = silkscreenRef(
3408
3508
  0,
3409
- length26.parse(parameters.h),
3509
+ length27.parse(parameters.h),
3410
3510
  0.3
3411
3511
  );
3412
3512
  const silkscreenLine = {
@@ -3415,20 +3515,20 @@ var micromelf = (raw_params) => {
3415
3515
  pcb_component_id: "",
3416
3516
  route: [
3417
3517
  {
3418
- x: length26.parse(parameters.pad_spacing) / 2,
3419
- y: length26.parse(parameters.h) / 2
3518
+ x: length27.parse(parameters.pad_spacing) / 2,
3519
+ y: length27.parse(parameters.h) / 2
3420
3520
  },
3421
3521
  {
3422
- x: -length26.parse(parameters.w) / 2 - 0.1,
3423
- y: length26.parse(parameters.h) / 2
3522
+ x: -length27.parse(parameters.w) / 2 - 0.1,
3523
+ y: length27.parse(parameters.h) / 2
3424
3524
  },
3425
3525
  {
3426
- x: -length26.parse(parameters.w) / 2 - 0.1,
3427
- y: -length26.parse(parameters.h) / 2
3526
+ x: -length27.parse(parameters.w) / 2 - 0.1,
3527
+ y: -length27.parse(parameters.h) / 2
3428
3528
  },
3429
3529
  {
3430
- x: length26.parse(parameters.pad_spacing) / 2,
3431
- y: -length26.parse(parameters.h) / 2
3530
+ x: length27.parse(parameters.pad_spacing) / 2,
3531
+ y: -length27.parse(parameters.h) / 2
3432
3532
  }
3433
3533
  ],
3434
3534
  stroke_width: 0.1,