@tscircuit/footprinter 0.0.345 → 0.0.346

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 CHANGED
@@ -3125,17 +3125,29 @@ var pinrow = (raw_params) => {
3125
3125
  }
3126
3126
  }
3127
3127
  const refText = silkscreenRef(0, p, 0.5);
3128
- const halfSpanX = (numPinsPerRow - 1) / 2 * p;
3129
- const padHalfX = parameters.smd ? parameters.pw / 2 : od / 2;
3130
- const padHalfY = parameters.smd ? parameters.pl / 2 : od / 2;
3131
- const courtyardPadding = 0.25;
3128
+ const padHalfWidth = parameters.smd ? parameters.pw / 2 : od / 2;
3129
+ const padHalfHeight = parameters.smd ? parameters.pl / 2 : od / 2;
3130
+ const pinRowSpanX = (numPinsPerRow - 1) * p;
3131
+ const pinRowSpanY = (rows - 1) * p;
3132
+ const padOuterHalfWidth = pinRowSpanX / 2 + padHalfWidth;
3133
+ const padOuterHalfHeight = pinRowSpanY / 2 + padHalfHeight;
3134
+ const bodyHalfWidth = pinRowSpanX / 2 + p / 2;
3135
+ const bodyHalfHeight = pinRowSpanY / 2 + p / 2;
3136
+ const courtyardHalfWidth = Math.max(
3137
+ padOuterHalfWidth + 0.25,
3138
+ bodyHalfWidth + 0.5
3139
+ );
3140
+ const courtyardHalfHeight = Math.max(
3141
+ padOuterHalfHeight + 0.25,
3142
+ bodyHalfHeight + 0.5
3143
+ );
3132
3144
  const courtyard = {
3133
3145
  type: "pcb_courtyard_rect",
3134
3146
  pcb_courtyard_rect_id: "",
3135
3147
  pcb_component_id: "",
3136
3148
  center: { x: 0, y: -((rows - 1) * p) / 2 },
3137
- width: 2 * (halfSpanX + padHalfX + courtyardPadding),
3138
- height: (rows - 1) * p + 2 * (padHalfY + courtyardPadding),
3149
+ width: 2 * courtyardHalfWidth,
3150
+ height: 2 * courtyardHalfHeight,
3139
3151
  layer: "top"
3140
3152
  };
3141
3153
  return {
@@ -3697,15 +3709,20 @@ var pushbutton = (raw_params) => {
3697
3709
  height / 2 + 0.4,
3698
3710
  0.5
3699
3711
  );
3700
- const outerRadius = holeDiameter * 1.5 / 2;
3701
- const courtyardPadding = 0.25;
3712
+ const padOuterRadius = holeDiameter * 1.5 / 2;
3713
+ const pinRowSpanX = width;
3714
+ const pinRowSpanY = height;
3715
+ const padOuterHalfWidth = pinRowSpanX / 2 + padOuterRadius;
3716
+ const padOuterHalfHeight = pinRowSpanY / 2 + padOuterRadius;
3717
+ const courtyardHalfWidth = padOuterHalfWidth + 0.5;
3718
+ const courtyardHalfHeight = padOuterHalfHeight + 0.5;
3702
3719
  const courtyard = {
3703
3720
  type: "pcb_courtyard_rect",
3704
3721
  pcb_courtyard_rect_id: "",
3705
3722
  pcb_component_id: "",
3706
3723
  center: { x: 0, y: 0 },
3707
- width: width + 2 * outerRadius + 2 * courtyardPadding,
3708
- height: height + 2 * outerRadius + 2 * courtyardPadding,
3724
+ width: 2 * courtyardHalfWidth,
3725
+ height: 2 * courtyardHalfHeight,
3709
3726
  layer: "top"
3710
3727
  };
3711
3728
  return {
@@ -4666,6 +4683,79 @@ import {
4666
4683
  length as length25
4667
4684
  } from "circuit-json";
4668
4685
  import { z as z33 } from "zod";
4686
+
4687
+ // src/helpers/capsule-outline.ts
4688
+ var createCapsuleOutline = (options) => {
4689
+ const {
4690
+ centerX,
4691
+ centerY,
4692
+ straightHalfLength,
4693
+ radius,
4694
+ arcSegmentCount = 9,
4695
+ orientation = "horizontal"
4696
+ } = options;
4697
+ if (straightHalfLength < 0) {
4698
+ throw new Error("Capsule straightHalfLength must be non-negative");
4699
+ }
4700
+ if (radius <= 0) {
4701
+ throw new Error("Capsule radius must be positive");
4702
+ }
4703
+ if (arcSegmentCount < 2) {
4704
+ throw new Error("Capsule arcSegmentCount must be at least 2");
4705
+ }
4706
+ if (orientation === "horizontal") {
4707
+ const leftCenterX = centerX - straightHalfLength;
4708
+ const rightCenterX = centerX + straightHalfLength;
4709
+ const rightArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
4710
+ const theta = Math.PI / 2 - i * Math.PI / arcSegmentCount;
4711
+ return {
4712
+ x: rightCenterX + Math.cos(theta) * radius,
4713
+ y: centerY + Math.sin(theta) * radius
4714
+ };
4715
+ });
4716
+ const leftArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
4717
+ const theta = -Math.PI / 2 + i * Math.PI / arcSegmentCount;
4718
+ return {
4719
+ x: leftCenterX - Math.cos(theta) * radius,
4720
+ y: centerY + Math.sin(theta) * radius
4721
+ };
4722
+ });
4723
+ return [
4724
+ { x: leftCenterX, y: centerY + radius },
4725
+ { x: rightCenterX, y: centerY + radius },
4726
+ ...rightArc.slice(1, -1),
4727
+ { x: rightCenterX, y: centerY - radius },
4728
+ { x: leftCenterX, y: centerY - radius },
4729
+ ...leftArc.slice(1, -1)
4730
+ ];
4731
+ }
4732
+ const bottomCenterY = centerY - straightHalfLength;
4733
+ const topCenterY = centerY + straightHalfLength;
4734
+ const topArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
4735
+ const theta = Math.PI - i * Math.PI / arcSegmentCount;
4736
+ return {
4737
+ x: centerX + Math.cos(theta) * radius,
4738
+ y: topCenterY + Math.sin(theta) * radius
4739
+ };
4740
+ });
4741
+ const bottomArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
4742
+ const theta = i * Math.PI / arcSegmentCount;
4743
+ return {
4744
+ x: centerX + Math.cos(theta) * radius,
4745
+ y: bottomCenterY - Math.sin(theta) * radius
4746
+ };
4747
+ });
4748
+ return [
4749
+ { x: centerX - radius, y: bottomCenterY },
4750
+ { x: centerX - radius, y: topCenterY },
4751
+ ...topArc.slice(1, -1),
4752
+ { x: centerX + radius, y: topCenterY },
4753
+ { x: centerX + radius, y: bottomCenterY },
4754
+ ...bottomArc.slice(1, -1)
4755
+ ];
4756
+ };
4757
+
4758
+ // src/fn/hc49.ts
4669
4759
  var generate_u_curve = (centerX, centerY, radius, direction) => {
4670
4760
  return Array.from({ length: 25 }, (_, i) => {
4671
4761
  const theta = i / 24 * Math.PI - Math.PI / 2;
@@ -4710,18 +4800,20 @@ var hc49 = (raw_params) => {
4710
4800
  pcb_silkscreen_path_id: ""
4711
4801
  };
4712
4802
  const silkscreenRefText = silkscreenRef(0, p / 4, 0.5);
4713
- const courtyardPadding = 0.25;
4714
- const crtMinX = -(w / 2 + radius + courtyardPadding);
4715
- const crtMaxX = w / 2 + radius + courtyardPadding;
4716
- const crtMinY = -(radius + courtyardPadding);
4717
- const crtMaxY = radius + courtyardPadding;
4803
+ const padRowHalfWidth = p / 2 + od / 2;
4804
+ const courtyardCapsuleStraightHalfLength = padRowHalfWidth;
4805
+ const courtyardCapsuleRadius = Math.max(h / 2 + 0.25, w / 2 + 0.03);
4718
4806
  const courtyard = {
4719
- type: "pcb_courtyard_rect",
4720
- pcb_courtyard_rect_id: "",
4807
+ type: "pcb_courtyard_outline",
4808
+ pcb_courtyard_outline_id: "",
4721
4809
  pcb_component_id: "",
4722
- center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
4723
- width: crtMaxX - crtMinX,
4724
- height: crtMaxY - crtMinY,
4810
+ outline: createCapsuleOutline({
4811
+ centerX: 0,
4812
+ centerY: 0,
4813
+ straightHalfLength: courtyardCapsuleStraightHalfLength,
4814
+ radius: courtyardCapsuleRadius,
4815
+ arcSegmentCount: 9
4816
+ }),
4725
4817
  layer: "top"
4726
4818
  };
4727
4819
  return {
@@ -7138,6 +7230,8 @@ var get2CcwSot223Coords = (parameters) => {
7138
7230
  };
7139
7231
  var sot223_4 = (parameters) => {
7140
7232
  const pads = [];
7233
+ let padOuterHalfWidth = 0;
7234
+ let padOuterHalfHeight = 0;
7141
7235
  for (let i = 0; i < parameters.num_pins; i++) {
7142
7236
  const { x, y } = get2CcwSot223Coords({
7143
7237
  num_pins: parameters.num_pins,
@@ -7148,7 +7242,13 @@ var sot223_4 = (parameters) => {
7148
7242
  p: Number.parseFloat(parameters.p)
7149
7243
  });
7150
7244
  const pinWidth = i === 3 ? 3.8 : Number.parseFloat(parameters.pw);
7151
- pads.push(rectpad(i + 1, x, y, Number.parseFloat(parameters.pl), pinWidth));
7245
+ const pinLength = Number.parseFloat(parameters.pl);
7246
+ padOuterHalfWidth = Math.max(padOuterHalfWidth, Math.abs(x) + pinLength / 2);
7247
+ padOuterHalfHeight = Math.max(
7248
+ padOuterHalfHeight,
7249
+ Math.abs(y) + pinWidth / 2
7250
+ );
7251
+ pads.push(rectpad(i + 1, x, y, pinLength, pinWidth));
7152
7252
  }
7153
7253
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
7154
7254
  const width = Number.parseFloat(parameters.w) / 2 - 2.4;
@@ -7177,23 +7277,23 @@ var sot223_4 = (parameters) => {
7177
7277
  type: "pcb_silkscreen_path",
7178
7278
  stroke_width: 0.1
7179
7279
  };
7180
- const w = Number.parseFloat(parameters.w);
7181
- const pl = Number.parseFloat(parameters.pl);
7182
- const p = Number.parseFloat(parameters.p);
7183
- const pw = Number.parseFloat(parameters.pw);
7184
- const courtyardPadding = 0.25;
7185
- const padCenterX = w / 2 - 1.1;
7186
- const crtMinX = -(padCenterX + pl / 2 + courtyardPadding);
7187
- const crtMaxX = padCenterX + pl / 2 + courtyardPadding;
7188
- const crtMinY = -(p + pw / 2 + courtyardPadding);
7189
- const crtMaxY = p + pw / 2 + courtyardPadding;
7280
+ const bodyHalfWidth = Number.parseFloat(parameters.w) / 2;
7281
+ const bodyHalfHeight = Number.parseFloat(parameters.h) / 2;
7282
+ const courtyardHalfWidth = Math.max(
7283
+ padOuterHalfWidth + 0.25,
7284
+ bodyHalfWidth + 0.15
7285
+ );
7286
+ const courtyardHalfHeight = Math.max(
7287
+ padOuterHalfHeight + 0.25,
7288
+ bodyHalfHeight + 0.15
7289
+ );
7190
7290
  const courtyard = {
7191
7291
  type: "pcb_courtyard_rect",
7192
7292
  pcb_courtyard_rect_id: "",
7193
7293
  pcb_component_id: "",
7194
- center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
7195
- width: crtMaxX - crtMinX,
7196
- height: crtMaxY - crtMinY,
7294
+ center: { x: 0, y: 0 },
7295
+ width: 2 * courtyardHalfWidth,
7296
+ height: 2 * courtyardHalfHeight,
7197
7297
  layer: "top"
7198
7298
  };
7199
7299
  return [
@@ -7230,8 +7330,8 @@ var get2CcwSot2235Coords = (parameters) => {
7230
7330
  };
7231
7331
  var sot223_5 = (parameters) => {
7232
7332
  const pads = [];
7233
- let padOuterHalfX = 0;
7234
- let padOuterHalfY = 0;
7333
+ let padOuterHalfWidth = 0;
7334
+ let padOuterHalfHeight = 0;
7235
7335
  for (let i = 1; i <= parameters.num_pins; i++) {
7236
7336
  const { x, y } = get2CcwSot2235Coords({
7237
7337
  h: Number.parseFloat(parameters.h),
@@ -7248,8 +7348,11 @@ var sot223_5 = (parameters) => {
7248
7348
  pinWidth = 1;
7249
7349
  pinLength = 2.2;
7250
7350
  }
7251
- padOuterHalfX = Math.max(padOuterHalfX, Math.abs(x) + pinLength / 2);
7252
- padOuterHalfY = Math.max(padOuterHalfY, Math.abs(y) + pinWidth / 2);
7351
+ padOuterHalfWidth = Math.max(padOuterHalfWidth, Math.abs(x) + pinLength / 2);
7352
+ padOuterHalfHeight = Math.max(
7353
+ padOuterHalfHeight,
7354
+ Math.abs(y) + pinWidth / 2
7355
+ );
7253
7356
  pads.push(rectpad(i, x, y, pinLength, pinWidth));
7254
7357
  }
7255
7358
  const width = Number.parseFloat(parameters.w) / 2 - 2.4;
@@ -7279,28 +7382,23 @@ var sot223_5 = (parameters) => {
7279
7382
  stroke_width: 0.1
7280
7383
  };
7281
7384
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
7282
- const courtyardStepOuterHalfWidth = padOuterHalfX + 0.25;
7283
- const courtyardStepInnerHalfWidth = courtyardStepOuterHalfWidth;
7284
- const courtyardStepOuterHalfHeight = padOuterHalfY + 0.85;
7285
- const courtyardStepInnerHalfHeight = courtyardStepOuterHalfHeight;
7385
+ const bodyHalfWidth = Number.parseFloat(parameters.w) / 2;
7386
+ const bodyHalfHeight = Number.parseFloat(parameters.h) / 2;
7387
+ const courtyardHalfWidth = Math.max(
7388
+ padOuterHalfWidth + 0.25,
7389
+ bodyHalfWidth + 0.15
7390
+ );
7391
+ const courtyardHalfHeight = Math.max(
7392
+ padOuterHalfHeight + 0.25,
7393
+ bodyHalfHeight + 0.15
7394
+ );
7286
7395
  const courtyard = {
7287
- type: "pcb_courtyard_outline",
7288
- pcb_courtyard_outline_id: "",
7396
+ type: "pcb_courtyard_rect",
7397
+ pcb_courtyard_rect_id: "",
7289
7398
  pcb_component_id: "",
7290
- outline: createRectUnionOutline([
7291
- {
7292
- minX: -courtyardStepOuterHalfWidth,
7293
- maxX: courtyardStepOuterHalfWidth,
7294
- minY: -courtyardStepInnerHalfHeight,
7295
- maxY: courtyardStepInnerHalfHeight
7296
- },
7297
- {
7298
- minX: -courtyardStepInnerHalfWidth,
7299
- maxX: courtyardStepInnerHalfWidth,
7300
- minY: -courtyardStepOuterHalfHeight,
7301
- maxY: courtyardStepOuterHalfHeight
7302
- }
7303
- ]),
7399
+ center: { x: 0, y: 0 },
7400
+ width: 2 * courtyardHalfWidth,
7401
+ height: 2 * courtyardHalfHeight,
7304
7402
  layer: "top"
7305
7403
  };
7306
7404
  return [
@@ -7335,6 +7433,8 @@ var get2CcwSot2236Coords = (parameters) => {
7335
7433
  };
7336
7434
  var sot223_6 = (parameters) => {
7337
7435
  const pads = [];
7436
+ let padOuterHalfWidth = 0;
7437
+ let padOuterHalfHeight = 0;
7338
7438
  for (let i = 1; i <= parameters.num_pins; i++) {
7339
7439
  const { x, y } = get2CcwSot2236Coords({
7340
7440
  h: Number.parseFloat(parameters.h),
@@ -7351,6 +7451,11 @@ var sot223_6 = (parameters) => {
7351
7451
  pinWidth = 0.6;
7352
7452
  pinLength = 2.2;
7353
7453
  }
7454
+ padOuterHalfWidth = Math.max(padOuterHalfWidth, Math.abs(x) + pinLength / 2);
7455
+ padOuterHalfHeight = Math.max(
7456
+ padOuterHalfHeight,
7457
+ Math.abs(y) + pinWidth / 2
7458
+ );
7354
7459
  pads.push(rectpad(i, x, y, pinLength, pinWidth));
7355
7460
  }
7356
7461
  const width = Number.parseFloat(parameters.w) / 2 - 2.4;
@@ -7380,18 +7485,23 @@ var sot223_6 = (parameters) => {
7380
7485
  stroke_width: 0.1
7381
7486
  };
7382
7487
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
7383
- const courtyardPadding = 0.25;
7384
- const crtMinX = -(4.25 + courtyardPadding);
7385
- const crtMaxX = 4.25 + courtyardPadding;
7386
- const crtMinY = -(2.9 + courtyardPadding);
7387
- const crtMaxY = 2.9 + courtyardPadding;
7488
+ const bodyHalfWidth = Number.parseFloat(parameters.w) / 2;
7489
+ const bodyHalfHeight = Number.parseFloat(parameters.h) / 2;
7490
+ const courtyardHalfWidth = Math.max(
7491
+ padOuterHalfWidth + 0.25,
7492
+ bodyHalfWidth + 0.15
7493
+ );
7494
+ const courtyardHalfHeight = Math.max(
7495
+ padOuterHalfHeight + 0.25,
7496
+ bodyHalfHeight + 0.15
7497
+ );
7388
7498
  const courtyard = {
7389
7499
  type: "pcb_courtyard_rect",
7390
7500
  pcb_courtyard_rect_id: "",
7391
7501
  pcb_component_id: "",
7392
- center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
7393
- width: crtMaxX - crtMinX,
7394
- height: crtMaxY - crtMinY,
7502
+ center: { x: 0, y: 0 },
7503
+ width: 2 * courtyardHalfWidth,
7504
+ height: 2 * courtyardHalfHeight,
7395
7505
  layer: "top"
7396
7506
  };
7397
7507
  return [
@@ -7496,18 +7606,21 @@ var sot23w_3 = (parameters) => {
7496
7606
  const pl = Number.parseFloat(parameters.pl);
7497
7607
  const pw = Number.parseFloat(parameters.pw);
7498
7608
  const h = Number.parseFloat(parameters.h);
7499
- const courtyardPadding = 0.25;
7500
- const crtMinX = -(p + pl / 2 + courtyardPadding);
7501
- const crtMaxX = p + pl / 2 + courtyardPadding;
7502
- const crtMinY = -(Math.max(h / 2, 0.95 + pw / 2) + courtyardPadding);
7503
- const crtMaxY = Math.max(h / 2, 0.95 + pw / 2) + courtyardPadding;
7609
+ const padToeHalfWidth = p + pl / 2;
7610
+ const pinRowHalfHeight = 0.95 + pw / 2;
7611
+ const bodyHalfHeight = h / 2;
7612
+ const courtyardHalfWidth = padToeHalfWidth + 0.25;
7613
+ const courtyardHalfHeight = Math.max(
7614
+ pinRowHalfHeight + 0.25,
7615
+ bodyHalfHeight + 0.09
7616
+ );
7504
7617
  const courtyard = {
7505
7618
  type: "pcb_courtyard_rect",
7506
7619
  pcb_courtyard_rect_id: "",
7507
7620
  pcb_component_id: "",
7508
- center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
7509
- width: crtMaxX - crtMinX,
7510
- height: crtMaxY - crtMinY,
7621
+ center: { x: 0, y: 0 },
7622
+ width: 2 * courtyardHalfWidth,
7623
+ height: 2 * courtyardHalfHeight,
7511
7624
  layer: "top"
7512
7625
  };
7513
7626
  return [
@@ -7584,18 +7697,30 @@ var to92s = (raw_params) => {
7584
7697
  pcb_silkscreen_path_id: ""
7585
7698
  };
7586
7699
  const silkscreenRefText = silkscreenRef(0, holeY + 1, 0.5);
7587
- const od_v = Number.parseFloat(parameters.od);
7588
- const courtyardPadding = 0.25;
7589
- const crtHalfX = Math.max(holeY, padSpacing7 + od_v / 2) + courtyardPadding;
7590
- const crtMinY = -courtyardPadding;
7591
- const crtMaxY = holeY + 0.5 + courtyardPadding;
7700
+ const padOuterDiameter = Number.parseFloat(parameters.od);
7701
+ const padCenterY = holeY - padSpacing7;
7702
+ const padMinX = -padSpacing7 - padOuterDiameter / 2;
7703
+ const padMaxX = padSpacing7 + padOuterDiameter / 2;
7704
+ const padMinY = padCenterY - padOuterDiameter / 2;
7705
+ const padMaxY = padCenterY + padOuterDiameter / 2;
7706
+ const bodyMinX = -holeY;
7707
+ const bodyMaxX = holeY;
7708
+ const bodyMinY = 0;
7709
+ const bodyMaxY = holeY + 0.5;
7710
+ const courtyardMinX = Math.min(padMinX, bodyMinX) - 0.27;
7711
+ const courtyardMaxX = Math.max(padMaxX, bodyMaxX) + 0.13;
7712
+ const courtyardMinY = Math.min(padMinY, bodyMinY) - 0.42;
7713
+ const courtyardMaxY = Math.max(padMaxY, bodyMaxY) + 0.08;
7592
7714
  const courtyard = {
7593
7715
  type: "pcb_courtyard_rect",
7594
7716
  pcb_courtyard_rect_id: "",
7595
7717
  pcb_component_id: "",
7596
- center: { x: 0, y: (crtMinY + crtMaxY) / 2 },
7597
- width: 2 * crtHalfX,
7598
- height: crtMaxY - crtMinY,
7718
+ center: {
7719
+ x: (courtyardMinX + courtyardMaxX) / 2,
7720
+ y: (courtyardMinY + courtyardMaxY) / 2
7721
+ },
7722
+ width: courtyardMaxX - courtyardMinX,
7723
+ height: courtyardMaxY - courtyardMinY,
7599
7724
  layer: "top"
7600
7725
  };
7601
7726
  return {
@@ -8916,18 +9041,18 @@ var solderjumper = (params) => {
8916
9041
  const refOffset = 0.6;
8917
9042
  const refY = outlineCenterY + outlineHeight / 2 + refOffset;
8918
9043
  const silk = silkscreenRef(outlineCenterX, refY, 0.4);
8919
- const courtyardPadding = 0.25;
8920
- const crtMinX = outlineCenterX - outlineWidth / 2 - courtyardPadding;
8921
- const crtMaxX = outlineCenterX + outlineWidth / 2 + courtyardPadding;
8922
- const crtMinY = -(outlineHeight / 2 + courtyardPadding);
8923
- const crtMaxY = outlineHeight / 2 + courtyardPadding;
9044
+ const pinRowSpanX = (num_pins - 1) * padSpacing7;
9045
+ const padOuterHalfWidth = pinRowSpanX / 2 + padWidth / 2;
9046
+ const padOuterHalfHeight = padHeight / 2;
9047
+ const courtyardHalfWidth = padOuterHalfWidth + 0.5;
9048
+ const courtyardHalfHeight = padOuterHalfHeight + 0.5;
8924
9049
  const courtyard = {
8925
9050
  type: "pcb_courtyard_rect",
8926
9051
  pcb_courtyard_rect_id: "",
8927
9052
  pcb_component_id: "",
8928
- center: { x: (crtMinX + crtMaxX) / 2, y: 0 },
8929
- width: crtMaxX - crtMinX,
8930
- height: crtMaxY - crtMinY,
9053
+ center: { x: pinRowSpanX / 2, y: 0 },
9054
+ width: 2 * courtyardHalfWidth,
9055
+ height: 2 * courtyardHalfHeight,
8931
9056
  layer: "top"
8932
9057
  };
8933
9058
  return {
@@ -9079,29 +9204,57 @@ var generateSot457Elements = (params) => {
9079
9204
  ],
9080
9205
  stroke_width: 0.05
9081
9206
  };
9082
- const courtyardPadding = 0.25;
9083
- let crtMinX, crtMaxX, crtMinY, crtMaxY;
9207
+ let courtyard;
9084
9208
  if (params.wave) {
9085
- crtMinX = -(pitch + padWidth / 2 + courtyardPadding);
9086
- crtMaxX = pitch + padWidth / 2 + courtyardPadding;
9087
- crtMinY = -(pitch + padLength / 2 + courtyardPadding);
9088
- crtMaxY = pitch + padLength / 2 + courtyardPadding;
9209
+ const pinRowSpanX = 2 * pitch;
9210
+ const pinRowSpanY = 2 * pitch;
9211
+ const padOuterHalfWidth = pinRowSpanX / 2 + padWidth / 2;
9212
+ const padOuterHalfHeight = pinRowSpanY / 2 + padLength / 2;
9213
+ const courtyardHalfWidth = padOuterHalfWidth + 0.25;
9214
+ const courtyardHalfHeight = padOuterHalfHeight + 0.25;
9215
+ courtyard = {
9216
+ type: "pcb_courtyard_rect",
9217
+ pcb_courtyard_rect_id: "",
9218
+ pcb_component_id: "",
9219
+ center: { x: 0, y: 0 },
9220
+ width: 2 * courtyardHalfWidth,
9221
+ height: 2 * courtyardHalfHeight,
9222
+ layer: "top"
9223
+ };
9089
9224
  } else {
9090
9225
  const padCenterX = width / 2 + 0.1;
9091
- crtMinX = -(padCenterX + padLength / 2 + courtyardPadding);
9092
- crtMaxX = padCenterX + padLength / 2 + courtyardPadding;
9093
- crtMinY = -(pitch + padWidth / 2 + courtyardPadding);
9094
- crtMaxY = pitch + padWidth / 2 + courtyardPadding;
9226
+ const padToeHalfWidth = padCenterX + padLength / 2;
9227
+ const pinRowHalfHeight = pitch + padWidth / 2;
9228
+ const bodyHalfWidth = width / 2;
9229
+ const bodyHalfHeight = height / 2;
9230
+ const courtyardStepOuterHalfWidth = padToeHalfWidth + 0.25;
9231
+ const courtyardStepInnerHalfWidth = bodyHalfWidth + 0.08;
9232
+ const courtyardStepOuterHalfHeight = pinRowHalfHeight + 0.25;
9233
+ const courtyardStepInnerHalfHeight = Math.max(
9234
+ bodyHalfHeight + 0.45,
9235
+ courtyardStepOuterHalfHeight
9236
+ );
9237
+ courtyard = {
9238
+ type: "pcb_courtyard_outline",
9239
+ pcb_courtyard_outline_id: "",
9240
+ pcb_component_id: "",
9241
+ outline: createRectUnionOutline([
9242
+ {
9243
+ minX: -courtyardStepOuterHalfWidth,
9244
+ maxX: courtyardStepOuterHalfWidth,
9245
+ minY: -courtyardStepOuterHalfHeight,
9246
+ maxY: courtyardStepOuterHalfHeight
9247
+ },
9248
+ {
9249
+ minX: -courtyardStepInnerHalfWidth,
9250
+ maxX: courtyardStepInnerHalfWidth,
9251
+ minY: -courtyardStepInnerHalfHeight,
9252
+ maxY: courtyardStepInnerHalfHeight
9253
+ }
9254
+ ]),
9255
+ layer: "top"
9256
+ };
9095
9257
  }
9096
- const courtyard = {
9097
- type: "pcb_courtyard_rect",
9098
- pcb_courtyard_rect_id: "",
9099
- pcb_component_id: "",
9100
- center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
9101
- width: crtMaxX - crtMinX,
9102
- height: crtMaxY - crtMinY,
9103
- layer: "top"
9104
- };
9105
9258
  return [
9106
9259
  silkscreenRefText,
9107
9260
  silkscreenPath1,
@@ -9288,20 +9441,19 @@ var potentiometer = (raw_params) => {
9288
9441
  };
9289
9442
  const W = Number.parseFloat(parameters.w) / 2;
9290
9443
  const silkscreenRefText = silkscreenRef(W, y + 1, 0.5);
9291
- const pad_radius = Number.parseFloat(parameters.od) / 2;
9292
- const h_hole = Number.parseFloat(parameters.h);
9293
- const courtyardPadding = 0.25;
9294
- const crtMinX = -(pad_radius + courtyardPadding);
9295
- const crtMaxX = Math.max(x, h_hole + pad_radius) + courtyardPadding;
9296
- const crtMinY = -(y + courtyardPadding);
9297
- const crtMaxY = y + courtyardPadding;
9444
+ const padRadius = Number.parseFloat(parameters.od) / 2;
9445
+ const pinRowSpanX = Number.parseFloat(parameters.h);
9446
+ const pinRowSpanY = Number.parseFloat(parameters.ca) / 2;
9447
+ const courtyardMinX = -(padRadius + 0.25);
9448
+ const courtyardMaxX = pinRowSpanX + padRadius + 0.25;
9449
+ const courtyardHalfHeight = pinRowSpanY + 0.25;
9298
9450
  const courtyard = {
9299
9451
  type: "pcb_courtyard_rect",
9300
9452
  pcb_courtyard_rect_id: "",
9301
9453
  pcb_component_id: "",
9302
- center: { x: (crtMinX + crtMaxX) / 2, y: 0 },
9303
- width: crtMaxX - crtMinX,
9304
- height: crtMaxY - crtMinY,
9454
+ center: { x: (courtyardMinX + courtyardMaxX) / 2, y: 0 },
9455
+ width: courtyardMaxX - courtyardMinX,
9456
+ height: 2 * courtyardHalfHeight,
9305
9457
  layer: "top"
9306
9458
  };
9307
9459
  return {