@tscircuit/footprinter 0.0.228 → 0.0.229

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
@@ -1219,7 +1219,7 @@ type Footprinter = {
1219
1219
  msop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1220
1220
  sot23w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1221
1221
  pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
1222
- stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
1222
+ stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance" | "silkscreenlabels" | "silkscreenlabelmargin">;
1223
1223
  stampreceiver: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
1224
1224
  breakoutheaders: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "id" | "od">;
1225
1225
  smtpad: () => FootprinterParamsBuilder<"circle" | "rect" | "square" | "d" | "pd" | "diameter" | "r" | "pr" | "radius" | "w" | "pw" | "width" | "h" | "ph" | "height" | "s" | "size"> & {
package/dist/index.js CHANGED
@@ -2159,7 +2159,9 @@ var stampboard_def = z17.object({
2159
2159
  pw: length10.default(length10.parse("1.6mm")),
2160
2160
  pl: length10.default(length10.parse("2.4mm")),
2161
2161
  innerhole: z17.boolean().default(false),
2162
- innerholeedgedistance: length10.default(length10.parse("1.61mm"))
2162
+ innerholeedgedistance: length10.default(length10.parse("1.61mm")),
2163
+ silkscreenlabels: z17.boolean().default(false),
2164
+ silkscreenlabelmargin: length10.default(length10.parse("0.1mm"))
2163
2165
  });
2164
2166
  var getHeight = (parameters) => {
2165
2167
  const params = stampboard_def.parse(parameters);
@@ -2281,14 +2283,17 @@ var stampboard = (raw_params) => {
2281
2283
  const height = params.h ?? getHeight(params);
2282
2284
  const rectpads = [];
2283
2285
  const holes = [];
2286
+ const pinLabels = [];
2284
2287
  let routes = [];
2285
2288
  const innerDiameter = 1;
2286
2289
  const outerDiameter = 1.2;
2287
2290
  const totalPadsNumber = params.left + params.right + (params.bottom ?? 0) + (params.top ?? 0);
2291
+ const maxLabelLength = `pin${totalPadsNumber}`.length;
2292
+ const textHalf = maxLabelLength * 0.7 / 2;
2288
2293
  if (params.right) {
2289
2294
  const yoff = -((params.right - 1) / 2) * params.p;
2290
2295
  for (let i = 0; i < params.right; i++) {
2291
- if (i === 0 && !params.left && !params.bottom) {
2296
+ if (i === 0 && !params.left && !params.bottom && !params.silkscreenlabels) {
2292
2297
  routes = getTriangleDir(
2293
2298
  params.w / 2 - params.pl * 1.4,
2294
2299
  yoff + i * params.p,
@@ -2304,6 +2309,24 @@ var stampboard = (raw_params) => {
2304
2309
  params.pw
2305
2310
  )
2306
2311
  );
2312
+ if (params.silkscreenlabels) {
2313
+ const padIndex = i + 1 + params.left + (params.bottom ?? 0);
2314
+ const label = `pin${padIndex}`;
2315
+ pinLabels.push({
2316
+ type: "pcb_silkscreen_text",
2317
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2318
+ pcb_component_id: "1",
2319
+ layer: "top",
2320
+ anchor_position: {
2321
+ x: params.w / 2 - params.pl - (textHalf + params.silkscreenlabelmargin),
2322
+ y: yoff + i * params.p
2323
+ },
2324
+ text: label,
2325
+ font_size: 0.7,
2326
+ font: "tscircuit2024",
2327
+ anchor_alignment: "center"
2328
+ });
2329
+ }
2307
2330
  if (params.innerhole) {
2308
2331
  holes.push(
2309
2332
  platedhole(
@@ -2327,12 +2350,12 @@ var stampboard = (raw_params) => {
2327
2350
  }
2328
2351
  }
2329
2352
  if (params.left) {
2330
- const yoff = -((params.left - 1) / 2) * params.p;
2353
+ const yoff = (params.left - 1) / 2 * params.p;
2331
2354
  for (let i = 0; i < params.left; i++) {
2332
- if (i === params.left - 1) {
2355
+ if (i === 0 && !params.silkscreenlabels) {
2333
2356
  routes = getTriangleDir(
2334
2357
  -params.w / 2 + params.pl * 1.4,
2335
- yoff + i * params.p,
2358
+ yoff - i * params.p,
2336
2359
  "left"
2337
2360
  );
2338
2361
  }
@@ -2340,17 +2363,35 @@ var stampboard = (raw_params) => {
2340
2363
  rectpad(
2341
2364
  i + 1,
2342
2365
  -params.w / 2 + params.pl / 2,
2343
- yoff + i * params.p,
2366
+ yoff - i * params.p,
2344
2367
  params.pl,
2345
2368
  params.pw
2346
2369
  )
2347
2370
  );
2371
+ if (params.silkscreenlabels) {
2372
+ const padIndex = i + 1;
2373
+ const label = `pin${padIndex}`;
2374
+ pinLabels.push({
2375
+ type: "pcb_silkscreen_text",
2376
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2377
+ pcb_component_id: "1",
2378
+ layer: "top",
2379
+ anchor_position: {
2380
+ x: -params.w / 2 + params.pl + (textHalf + params.silkscreenlabelmargin),
2381
+ y: yoff - i * params.p
2382
+ },
2383
+ text: label,
2384
+ font_size: 0.7,
2385
+ font: "tscircuit2024",
2386
+ anchor_alignment: "center"
2387
+ });
2388
+ }
2348
2389
  if (params.innerhole) {
2349
2390
  holes.push(
2350
2391
  platedhole(
2351
2392
  i + 1 + totalPadsNumber,
2352
2393
  -params.w / 2,
2353
- yoff + i * params.p,
2394
+ yoff - i * params.p,
2354
2395
  innerDiameter,
2355
2396
  outerDiameter
2356
2397
  )
@@ -2359,7 +2400,7 @@ var stampboard = (raw_params) => {
2359
2400
  platedhole(
2360
2401
  i + 1 + totalPadsNumber * 2,
2361
2402
  -params.w / 2 + params.innerholeedgedistance,
2362
- yoff + i * params.p,
2403
+ yoff - i * params.p,
2363
2404
  innerDiameter,
2364
2405
  outerDiameter
2365
2406
  )
@@ -2368,11 +2409,11 @@ var stampboard = (raw_params) => {
2368
2409
  }
2369
2410
  }
2370
2411
  if (params.top) {
2371
- const xoff = -((params.top - 1) / 2) * params.p;
2412
+ const xoff = (params.top - 1) / 2 * params.p;
2372
2413
  for (let i = 0; i < params.top; i++) {
2373
- if (i === params.top - 1 && !params.left && !params.bottom && !params.right) {
2414
+ if (i === 0 && !params.left && !params.bottom && !params.right && !params.silkscreenlabels) {
2374
2415
  routes = getTriangleDir(
2375
- xoff + i * params.p,
2416
+ xoff - i * params.p,
2376
2417
  height / 2 - params.pl * 1.4,
2377
2418
  "top"
2378
2419
  );
@@ -2380,17 +2421,36 @@ var stampboard = (raw_params) => {
2380
2421
  rectpads.push(
2381
2422
  rectpad(
2382
2423
  i + 1 + params.left + params.right + (params.bottom ?? 0),
2383
- xoff + i * params.p,
2424
+ xoff - i * params.p,
2384
2425
  height / 2 - params.pl / 2,
2385
2426
  params.pw,
2386
2427
  params.pl
2387
2428
  )
2388
2429
  );
2430
+ if (params.silkscreenlabels) {
2431
+ const padIndex = i + 1 + params.left + params.right + (params.bottom ?? 0);
2432
+ const label = `pin${padIndex}`;
2433
+ pinLabels.push({
2434
+ type: "pcb_silkscreen_text",
2435
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2436
+ pcb_component_id: "1",
2437
+ layer: "top",
2438
+ anchor_position: {
2439
+ x: xoff - i * params.p,
2440
+ y: height / 2 - params.pl - (textHalf + params.silkscreenlabelmargin)
2441
+ },
2442
+ text: label,
2443
+ font_size: 0.7,
2444
+ font: "tscircuit2024",
2445
+ anchor_alignment: "center",
2446
+ ccw_rotation: 270
2447
+ });
2448
+ }
2389
2449
  if (params.innerhole) {
2390
2450
  holes.push(
2391
2451
  platedhole(
2392
2452
  i + 1 + params.left + params.right + (params.bottom ?? 0) + totalPadsNumber,
2393
- xoff + i * params.p,
2453
+ xoff - i * params.p,
2394
2454
  height / 2,
2395
2455
  innerDiameter,
2396
2456
  outerDiameter
@@ -2399,7 +2459,7 @@ var stampboard = (raw_params) => {
2399
2459
  holes.push(
2400
2460
  platedhole(
2401
2461
  i + 1 + params.left + params.right + (params.bottom ?? 0) + totalPadsNumber * 2,
2402
- xoff + i * params.p,
2462
+ xoff - i * params.p,
2403
2463
  height / 2 - params.innerholeedgedistance,
2404
2464
  innerDiameter,
2405
2465
  outerDiameter
@@ -2411,7 +2471,7 @@ var stampboard = (raw_params) => {
2411
2471
  if (params.bottom) {
2412
2472
  const xoff = -((params.bottom - 1) / 2) * params.p;
2413
2473
  for (let i = 0; i < params.bottom; i++) {
2414
- if (i === 0 && !params.left) {
2474
+ if (i === 0 && !params.left && !params.silkscreenlabels) {
2415
2475
  routes = getTriangleDir(
2416
2476
  xoff + i * params.p,
2417
2477
  -height / 2 + params.pl * 1.4,
@@ -2427,6 +2487,25 @@ var stampboard = (raw_params) => {
2427
2487
  params.pl
2428
2488
  )
2429
2489
  );
2490
+ if (params.silkscreenlabels) {
2491
+ const padIndex = i + 1 + params.left;
2492
+ const label = `pin${padIndex}`;
2493
+ pinLabels.push({
2494
+ type: "pcb_silkscreen_text",
2495
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2496
+ pcb_component_id: "1",
2497
+ layer: "top",
2498
+ anchor_position: {
2499
+ x: xoff + i * params.p,
2500
+ y: -height / 2 + params.pl + (textHalf + params.silkscreenlabelmargin)
2501
+ },
2502
+ text: label,
2503
+ font_size: 0.7,
2504
+ font: "tscircuit2024",
2505
+ anchor_alignment: "center",
2506
+ ccw_rotation: 90
2507
+ });
2508
+ }
2430
2509
  if (params.innerhole) {
2431
2510
  holes.push(
2432
2511
  platedhole(
@@ -2480,8 +2559,9 @@ var stampboard = (raw_params) => {
2480
2559
  circuitJson: [
2481
2560
  ...rectpads,
2482
2561
  ...holes,
2562
+ ...pinLabels,
2483
2563
  silkscreenPath,
2484
- silkscreenTriangle,
2564
+ ...params.silkscreenlabels ? [] : [silkscreenTriangle],
2485
2565
  silkscreenRefText
2486
2566
  ],
2487
2567
  parameters: params