@tscircuit/footprinter 0.0.286 → 0.0.287

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
@@ -519,25 +519,25 @@ var led = (parameters) => {
519
519
 
520
520
  // src/helpers/chipArray.ts
521
521
  var chipArray = (params) => {
522
- const { padSpacing: padSpacing6, padWidth: padWidth6, padHeight: padHeight6, padPitch: padPitch6, numRows, textbottom } = params;
522
+ const { padSpacing: padSpacing7, padWidth: padWidth7, padHeight: padHeight7, padPitch: padPitch7, numRows, textbottom } = params;
523
523
  const yPositions = [];
524
- const halfRange = (numRows - 1) * (padPitch6 / 2);
524
+ const halfRange = (numRows - 1) * (padPitch7 / 2);
525
525
  for (let i = 0; i < numRows; i++) {
526
- yPositions.push(halfRange - i * padPitch6);
526
+ yPositions.push(halfRange - i * padPitch7);
527
527
  }
528
528
  const pads = [];
529
529
  yPositions.forEach((y, index) => {
530
- pads.push(rectpad(index + 1, -padSpacing6 / 2, y, padWidth6, padHeight6));
530
+ pads.push(rectpad(index + 1, -padSpacing7 / 2, y, padWidth7, padHeight7));
531
531
  });
532
532
  yPositions.slice().reverse().forEach((y, index) => {
533
533
  pads.push(
534
- rectpad(index + numRows + 1, padSpacing6 / 2, y, padWidth6, padHeight6)
534
+ rectpad(index + numRows + 1, padSpacing7 / 2, y, padWidth7, padHeight7)
535
535
  );
536
536
  });
537
- const top = Math.max(...yPositions) + padHeight6 / 2 + 0.4;
538
- const bottom = Math.min(...yPositions) - padHeight6 / 2 - 0.4;
539
- const left = -padSpacing6 / 2 - padWidth6 / 2 - 0.4;
540
- const right = padSpacing6 / 2 + padWidth6 / 2 + 0.4;
537
+ const top = Math.max(...yPositions) + padHeight7 / 2 + 0.4;
538
+ const bottom = Math.min(...yPositions) - padHeight7 / 2 - 0.4;
539
+ const left = -padSpacing7 / 2 - padWidth7 / 2 - 0.4;
540
+ const right = padSpacing7 / 2 + padWidth7 / 2 + 0.4;
541
541
  const silkscreenTop = {
542
542
  type: "pcb_silkscreen_path",
543
543
  layer: "top",
@@ -560,11 +560,11 @@ var chipArray = (params) => {
560
560
  stroke_width: 0.12,
561
561
  pcb_silkscreen_path_id: "silkscreen_bottom"
562
562
  };
563
- const pin1X = -padSpacing6 / 2;
563
+ const pin1X = -padSpacing7 / 2;
564
564
  const pin1Y = Math.max(...yPositions);
565
565
  const pin1MarkerSize = 0.2;
566
- const pin1Left = pin1X - padWidth6 / 2 - 0.1;
567
- const pin1Top = pin1Y + padHeight6 / 2 + 0.1;
566
+ const pin1Left = pin1X - padWidth7 / 2 - 0.1;
567
+ const pin1Top = pin1Y + padHeight7 / 2 + 0.1;
568
568
  const pin1Marker = {
569
569
  type: "pcb_silkscreen_path",
570
570
  layer: "top",
@@ -669,6 +669,22 @@ var res0606Array2 = (params) => {
669
669
  });
670
670
  };
671
671
 
672
+ // src/helpers/res1206-array4.ts
673
+ var padSpacing6 = 3;
674
+ var padWidth6 = 0.9;
675
+ var padHeight6 = 0.9;
676
+ var padPitch6 = 1.34;
677
+ var res1206Array4 = (params) => {
678
+ return chipArray({
679
+ padSpacing: padSpacing6,
680
+ padWidth: padWidth6,
681
+ padHeight: padHeight6,
682
+ padPitch: padPitch6,
683
+ numRows: 4,
684
+ textbottom: params.textbottom
685
+ });
686
+ };
687
+
672
688
  // src/fn/res.ts
673
689
  var getArrayCount = (parameters) => {
674
690
  const arrayValue = parameters.array ?? parameters.x;
@@ -726,6 +742,12 @@ var res = (rawParameters) => {
726
742
  parameters: rawParameters
727
743
  };
728
744
  }
745
+ if (arrayCount === 4 && imperialBase === "1206") {
746
+ return {
747
+ circuitJson: res1206Array4(rawParameters),
748
+ parameters: rawParameters
749
+ };
750
+ }
729
751
  return { circuitJson: passive(rawParameters), parameters: rawParameters };
730
752
  };
731
753
 
@@ -3872,41 +3894,41 @@ var to92 = (raw_params) => {
3872
3894
  });
3873
3895
  const { p, id, od, w, h, inline } = parameters;
3874
3896
  const holeY = Number.parseFloat(h) / 2;
3875
- const padSpacing6 = Number.parseFloat(p);
3897
+ const padSpacing7 = Number.parseFloat(p);
3876
3898
  const holeDia = Number.parseFloat(id);
3877
3899
  const padDia = Number.parseFloat(od);
3878
- const padWidth6 = padDia;
3879
- const padHeight6 = padDia * (1.5 / 1.05);
3900
+ const padWidth7 = padDia;
3901
+ const padHeight7 = padDia * (1.5 / 1.05);
3880
3902
  let platedHoles = [];
3881
3903
  if (parameters.num_pins === 3) {
3882
3904
  if (inline) {
3883
3905
  platedHoles = [
3884
3906
  platedHoleWithRectPad(
3885
3907
  1,
3886
- -padSpacing6,
3887
- holeY - padSpacing6,
3908
+ -padSpacing7,
3909
+ holeY - padSpacing7,
3888
3910
  holeDia,
3889
3911
  padDia,
3890
- padHeight6,
3912
+ padHeight7,
3891
3913
  0,
3892
3914
  0
3893
3915
  ),
3894
- platedHolePill(2, 0, holeY - padSpacing6, holeDia, padWidth6, padHeight6),
3916
+ platedHolePill(2, 0, holeY - padSpacing7, holeDia, padWidth7, padHeight7),
3895
3917
  platedHolePill(
3896
3918
  3,
3897
- padSpacing6,
3898
- holeY - padSpacing6,
3919
+ padSpacing7,
3920
+ holeY - padSpacing7,
3899
3921
  holeDia,
3900
- padWidth6,
3901
- padHeight6
3922
+ padWidth7,
3923
+ padHeight7
3902
3924
  )
3903
3925
  ];
3904
3926
  } else {
3905
3927
  platedHoles = [
3906
3928
  platedHoleWithRectPad(
3907
3929
  1,
3908
- -padSpacing6,
3909
- holeY - padSpacing6,
3930
+ -padSpacing7,
3931
+ holeY - padSpacing7,
3910
3932
  holeDia,
3911
3933
  padDia,
3912
3934
  padDia,
@@ -3914,28 +3936,28 @@ var to92 = (raw_params) => {
3914
3936
  0
3915
3937
  ),
3916
3938
  platedhole(2, 0, holeY, holeDia, padDia),
3917
- platedhole(3, padSpacing6, holeY - padSpacing6, holeDia, padDia)
3939
+ platedhole(3, padSpacing7, holeY - padSpacing7, holeDia, padDia)
3918
3940
  ];
3919
3941
  }
3920
3942
  } else if (parameters.num_pins === 2) {
3921
3943
  platedHoles = [
3922
3944
  platedHoleWithRectPad(
3923
3945
  1,
3924
- -padSpacing6,
3925
- holeY - padSpacing6,
3946
+ -padSpacing7,
3947
+ holeY - padSpacing7,
3926
3948
  holeDia,
3927
- padWidth6,
3928
- padHeight6,
3949
+ padWidth7,
3950
+ padHeight7,
3929
3951
  0,
3930
3952
  0
3931
3953
  ),
3932
3954
  platedHolePill(
3933
3955
  2,
3934
- padSpacing6,
3935
- holeY - padSpacing6,
3956
+ padSpacing7,
3957
+ holeY - padSpacing7,
3936
3958
  holeDia,
3937
- padWidth6,
3938
- padHeight6
3959
+ padWidth7,
3960
+ padHeight7
3939
3961
  )
3940
3962
  ];
3941
3963
  } else {
@@ -4901,15 +4923,15 @@ var sot89_def = base_def.extend({
4901
4923
  var sot89_3 = (parameters) => {
4902
4924
  const pads = [];
4903
4925
  const padGap = Number.parseFloat(parameters.p);
4904
- const padWidth6 = Number.parseFloat(parameters.pw);
4926
+ const padWidth7 = Number.parseFloat(parameters.pw);
4905
4927
  const length51 = Number.parseFloat(parameters.w);
4906
- const padHeight6 = Number.parseFloat(parameters.pl);
4928
+ const padHeight7 = Number.parseFloat(parameters.pl);
4907
4929
  const centerExtra = 0.175;
4908
- const outerPadXShift = (padHeight6 - (padHeight6 + centerExtra)) / 2;
4930
+ const outerPadXShift = (padHeight7 - (padHeight7 + centerExtra)) / 2;
4909
4931
  pads.push(
4910
- rectpad(1, -length51 / 2 + outerPadXShift, padGap, padHeight6, padWidth6),
4911
- rectpad(2, -length51 / 2, 0, padHeight6 + centerExtra, padWidth6),
4912
- rectpad(3, -length51 / 2 + outerPadXShift, -padGap, padHeight6, padWidth6)
4932
+ rectpad(1, -length51 / 2 + outerPadXShift, padGap, padHeight7, padWidth7),
4933
+ rectpad(2, -length51 / 2, 0, padHeight7 + centerExtra, padWidth7),
4934
+ rectpad(3, -length51 / 2 + outerPadXShift, -padGap, padHeight7, padWidth7)
4913
4935
  );
4914
4936
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
4915
4937
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -4948,7 +4970,7 @@ var sot89_3 = (parameters) => {
4948
4970
  var sot89_5 = (parameters) => {
4949
4971
  const pads = [];
4950
4972
  const padGap = Number.parseFloat(parameters.p);
4951
- const padWidth6 = Number.parseFloat(parameters.pw);
4973
+ const padWidth7 = Number.parseFloat(parameters.pw);
4952
4974
  const length51 = Number.parseFloat(parameters.w);
4953
4975
  pads.push(
4954
4976
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
@@ -6104,20 +6126,20 @@ var to92s_def = base_def.extend({
6104
6126
  var to92s_3 = (parameters) => {
6105
6127
  const { p, id, od, w, h } = parameters;
6106
6128
  const holeY = Number.parseFloat(h) / 2;
6107
- const padSpacing6 = Number.parseFloat(p);
6129
+ const padSpacing7 = Number.parseFloat(p);
6108
6130
  return [
6109
- platedhole(1, -padSpacing6, holeY - padSpacing6, id, od),
6110
- platedhole(2, 0, holeY - padSpacing6, id, od),
6111
- platedhole(3, padSpacing6, holeY - padSpacing6, id, od)
6131
+ platedhole(1, -padSpacing7, holeY - padSpacing7, id, od),
6132
+ platedhole(2, 0, holeY - padSpacing7, id, od),
6133
+ platedhole(3, padSpacing7, holeY - padSpacing7, id, od)
6112
6134
  ];
6113
6135
  };
6114
6136
  var to92s_2 = (parameters) => {
6115
6137
  const { p, id, od, h } = parameters;
6116
6138
  const holeY = Number.parseFloat(h) / 2;
6117
- const padSpacing6 = Number.parseFloat(p);
6139
+ const padSpacing7 = Number.parseFloat(p);
6118
6140
  return [
6119
- platedhole(1, -padSpacing6, holeY - padSpacing6, id, od),
6120
- platedhole(2, padSpacing6, holeY - padSpacing6, id, od)
6141
+ platedhole(1, -padSpacing7, holeY - padSpacing7, id, od),
6142
+ platedhole(2, padSpacing7, holeY - padSpacing7, id, od)
6121
6143
  ];
6122
6144
  };
6123
6145
  var to92s = (raw_params) => {
@@ -6136,19 +6158,19 @@ var to92s = (raw_params) => {
6136
6158
  throw new Error("Invalid number of pins for TO-92");
6137
6159
  }
6138
6160
  const holeY = Number.parseFloat(parameters.h) / 2;
6139
- const padSpacing6 = Number.parseFloat(parameters.p);
6161
+ const padSpacing7 = Number.parseFloat(parameters.p);
6140
6162
  const silkscreenBody = {
6141
6163
  type: "pcb_silkscreen_path",
6142
6164
  layer: "top",
6143
6165
  pcb_component_id: "",
6144
6166
  route: [
6145
- { x: -holeY, y: holeY - padSpacing6 },
6167
+ { x: -holeY, y: holeY - padSpacing7 },
6146
6168
  { x: -1.9, y: 0 },
6147
6169
  { x: 1.9, y: 0 },
6148
- { x: holeY, y: holeY - padSpacing6 },
6170
+ { x: holeY, y: holeY - padSpacing7 },
6149
6171
  { x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6150
6172
  { x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6151
- { x: -holeY, y: holeY - padSpacing6 }
6173
+ { x: -holeY, y: holeY - padSpacing7 }
6152
6174
  ],
6153
6175
  stroke_width: 0.1,
6154
6176
  pcb_silkscreen_path_id: ""
@@ -6927,13 +6949,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
6927
6949
  import { length as length45 } from "circuit-json";
6928
6950
  var solderjumper = (params) => {
6929
6951
  const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
6930
- const padSpacing6 = length45.parse(p);
6931
- const padWidth6 = length45.parse(pw);
6932
- const padHeight6 = length45.parse(ph);
6933
- const traceWidth = Math.min(padHeight6 / 4, 0.5);
6952
+ const padSpacing7 = length45.parse(p);
6953
+ const padWidth7 = length45.parse(pw);
6954
+ const padHeight7 = length45.parse(ph);
6955
+ const traceWidth = Math.min(padHeight7 / 4, 0.5);
6934
6956
  const pads = [];
6935
6957
  for (let i = 0; i < num_pins; i++) {
6936
- pads.push(rectpad(i + 1, i * padSpacing6, 0, padWidth6, padHeight6));
6958
+ pads.push(rectpad(i + 1, i * padSpacing7, 0, padWidth7, padHeight7));
6937
6959
  }
6938
6960
  let traces = [];
6939
6961
  if (bridged) {
@@ -6943,11 +6965,11 @@ var solderjumper = (params) => {
6943
6965
  const from = pins[i];
6944
6966
  const to = pins[i + 1];
6945
6967
  if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
6946
- const xCenterFrom = (from - 1) * padSpacing6;
6947
- const xCenterTo = (to - 1) * padSpacing6;
6968
+ const xCenterFrom = (from - 1) * padSpacing7;
6969
+ const xCenterTo = (to - 1) * padSpacing7;
6948
6970
  const directionMult = Math.sign(xCenterTo - xCenterFrom);
6949
- const x1 = xCenterFrom + directionMult * (padWidth6 / 2);
6950
- const x2 = xCenterTo - directionMult * (padWidth6 / 2);
6971
+ const x1 = xCenterFrom + directionMult * (padWidth7 / 2);
6972
+ const x2 = xCenterTo - directionMult * (padWidth7 / 2);
6951
6973
  traces.push({
6952
6974
  type: "pcb_trace",
6953
6975
  pcb_trace_id: "",
@@ -6974,9 +6996,9 @@ var solderjumper = (params) => {
6974
6996
  }
6975
6997
  }
6976
6998
  }
6977
- const outlineWidth = (num_pins - 1) * padSpacing6 + padWidth6 + 0.7;
6978
- const outlineHeight = padHeight6 + 1;
6979
- const outlineCenterX = (num_pins - 1) * padSpacing6 / 2;
6999
+ const outlineWidth = (num_pins - 1) * padSpacing7 + padWidth7 + 0.7;
7000
+ const outlineHeight = padHeight7 + 1;
7001
+ const outlineCenterX = (num_pins - 1) * padSpacing7 / 2;
6980
7002
  const outlineCenterY = 0;
6981
7003
  const silkscreenRect = {
6982
7004
  type: "pcb_silkscreen_path",
@@ -7077,40 +7099,40 @@ var generateSot457Elements = (params) => {
7077
7099
  const pads = [];
7078
7100
  const pitch = parseDimension(params.p);
7079
7101
  const padLength = parseDimension(params.pl);
7080
- const padWidth6 = parseDimension(params.pw);
7102
+ const padWidth7 = parseDimension(params.pw);
7081
7103
  const width = parseDimension(params.w);
7082
7104
  const height = parseDimension(params.h);
7083
7105
  if (params.wave) {
7084
7106
  const pinConfigs = {
7085
- 1: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(1, -pitch, pitch, padHeight6, padWidth7),
7086
- 2: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(2, -pitch, -pitch, padHeight6, padWidth7),
7087
- 3: ({ padWidth: padWidth7, padHeight: padHeight6 }) => pillpad(
7107
+ 1: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(1, -pitch, pitch, padHeight7, padWidth8),
7108
+ 2: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(2, -pitch, -pitch, padHeight7, padWidth8),
7109
+ 3: ({ padWidth: padWidth8, padHeight: padHeight7 }) => pillpad(
7088
7110
  3,
7089
7111
  -pitch,
7090
7112
  0,
7091
7113
  parseDimension(params.pillw),
7092
7114
  parseDimension(params.pillh)
7093
7115
  ),
7094
- 4: ({ padWidth: padWidth7, padHeight: padHeight6 }) => pillpad(
7116
+ 4: ({ padWidth: padWidth8, padHeight: padHeight7 }) => pillpad(
7095
7117
  4,
7096
7118
  pitch,
7097
7119
  0,
7098
7120
  parseDimension(params.pillw),
7099
7121
  parseDimension(params.pillh)
7100
7122
  ),
7101
- 5: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(5, pitch, pitch, padHeight6, padWidth7),
7102
- 6: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(6, pitch, -pitch, padHeight6, padWidth7)
7123
+ 5: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(5, pitch, pitch, padHeight7, padWidth8),
7124
+ 6: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(6, pitch, -pitch, padHeight7, padWidth8)
7103
7125
  };
7104
7126
  for (let i = 1; i <= params.num_pins; i++) {
7105
7127
  const config = pinConfigs[i];
7106
7128
  if (config) {
7107
- pads.push(config({ padWidth: padLength, padHeight: padWidth6 }));
7129
+ pads.push(config({ padWidth: padLength, padHeight: padWidth7 }));
7108
7130
  }
7109
7131
  }
7110
7132
  } else {
7111
7133
  for (let i = 1; i <= params.num_pins; i++) {
7112
7134
  const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
7113
- pads.push(rectpad(i, x, y, padLength, padWidth6));
7135
+ pads.push(rectpad(i, x, y, padLength, padWidth7));
7114
7136
  }
7115
7137
  }
7116
7138
  const silkscreenPath1 = {
@@ -7139,7 +7161,7 @@ var generateSot457Elements = (params) => {
7139
7161
  const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
7140
7162
  const triangleHeight = params.wave ? 1 : 0.5;
7141
7163
  const triangleWidth = params.wave ? 0.7 : 0.3;
7142
- pin1Position.x -= params.wave ? padWidth6 : padWidth6 * 1.7;
7164
+ pin1Position.x -= params.wave ? padWidth7 : padWidth7 * 1.7;
7143
7165
  const pin1Indicator = {
7144
7166
  type: "pcb_silkscreen_path",
7145
7167
  layer: "top",
@@ -8001,7 +8023,7 @@ var m2host_def = base_def.extend({
8001
8023
  var m2host = (raw_params) => {
8002
8024
  const parameters = m2host_def.parse(raw_params);
8003
8025
  const pads = [];
8004
- const padWidth6 = 0.5 - 0.15;
8026
+ const padWidth7 = 0.5 - 0.15;
8005
8027
  const padLength = 1.5;
8006
8028
  const pitch = 0.5;
8007
8029
  const halfPitch = pitch / 2;
@@ -8016,7 +8038,7 @@ var m2host = (raw_params) => {
8016
8038
  const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
8017
8039
  const rightEdgeOffset = 0.5;
8018
8040
  const x = rightEdgeOffset - padLengthWithOffset / 2;
8019
- const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth6);
8041
+ const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth7);
8020
8042
  pad2.layer = isBottomLayer ? "bottom" : "top";
8021
8043
  pads.push(pad2);
8022
8044
  }