@tscircuit/footprinter 0.0.284 → 0.0.286

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: padSpacing4, padWidth: padWidth4, padHeight: padHeight4, padPitch: padPitch4, numRows, textbottom } = params;
522
+ const { padSpacing: padSpacing6, padWidth: padWidth6, padHeight: padHeight6, padPitch: padPitch6, numRows, textbottom } = params;
523
523
  const yPositions = [];
524
- const halfRange = (numRows - 1) * (padPitch4 / 2);
524
+ const halfRange = (numRows - 1) * (padPitch6 / 2);
525
525
  for (let i = 0; i < numRows; i++) {
526
- yPositions.push(halfRange - i * padPitch4);
526
+ yPositions.push(halfRange - i * padPitch6);
527
527
  }
528
528
  const pads = [];
529
529
  yPositions.forEach((y, index) => {
530
- pads.push(rectpad(index + 1, -padSpacing4 / 2, y, padWidth4, padHeight4));
530
+ pads.push(rectpad(index + 1, -padSpacing6 / 2, y, padWidth6, padHeight6));
531
531
  });
532
532
  yPositions.slice().reverse().forEach((y, index) => {
533
533
  pads.push(
534
- rectpad(index + numRows + 1, padSpacing4 / 2, y, padWidth4, padHeight4)
534
+ rectpad(index + numRows + 1, padSpacing6 / 2, y, padWidth6, padHeight6)
535
535
  );
536
536
  });
537
- const top = Math.max(...yPositions) + padHeight4 / 2 + 0.4;
538
- const bottom = Math.min(...yPositions) - padHeight4 / 2 - 0.4;
539
- const left = -padSpacing4 / 2 - padWidth4 / 2 - 0.4;
540
- const right = padSpacing4 / 2 + padWidth4 / 2 + 0.4;
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;
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 = -padSpacing4 / 2;
563
+ const pin1X = -padSpacing6 / 2;
564
564
  const pin1Y = Math.max(...yPositions);
565
565
  const pin1MarkerSize = 0.2;
566
- const pin1Left = pin1X - padWidth4 / 2 - 0.1;
567
- const pin1Top = pin1Y + padHeight4 / 2 + 0.1;
566
+ const pin1Left = pin1X - padWidth6 / 2 - 0.1;
567
+ const pin1Top = pin1Y + padHeight6 / 2 + 0.1;
568
568
  const pin1Marker = {
569
569
  type: "pcb_silkscreen_path",
570
570
  layer: "top",
@@ -637,6 +637,38 @@ var res0603Array2 = (params) => {
637
637
  });
638
638
  };
639
639
 
640
+ // src/helpers/res0603-array4.ts
641
+ var padSpacing4 = 1.7;
642
+ var padWidth4 = 0.9;
643
+ var padHeight4 = 0.4;
644
+ var padPitch4 = 0.8;
645
+ var res0603Array4 = (params) => {
646
+ return chipArray({
647
+ padSpacing: padSpacing4,
648
+ padWidth: padWidth4,
649
+ padHeight: padHeight4,
650
+ padPitch: padPitch4,
651
+ numRows: 4,
652
+ textbottom: params.textbottom
653
+ });
654
+ };
655
+
656
+ // src/helpers/res0606-array2.ts
657
+ var padSpacing5 = 1.4;
658
+ var padWidth5 = 0.7;
659
+ var padHeight5 = 0.64;
660
+ var padPitch5 = 0.94;
661
+ var res0606Array2 = (params) => {
662
+ return chipArray({
663
+ padSpacing: padSpacing5,
664
+ padWidth: padWidth5,
665
+ padHeight: padHeight5,
666
+ padPitch: padPitch5,
667
+ numRows: 2,
668
+ textbottom: params.textbottom
669
+ });
670
+ };
671
+
640
672
  // src/fn/res.ts
641
673
  var getArrayCount = (parameters) => {
642
674
  const arrayValue = parameters.array ?? parameters.x;
@@ -682,6 +714,18 @@ var res = (rawParameters) => {
682
714
  parameters: rawParameters
683
715
  };
684
716
  }
717
+ if (arrayCount === 4 && imperialBase === "0603") {
718
+ return {
719
+ circuitJson: res0603Array4(rawParameters),
720
+ parameters: rawParameters
721
+ };
722
+ }
723
+ if (arrayCount === 2 && imperialBase === "0606") {
724
+ return {
725
+ circuitJson: res0606Array2(rawParameters),
726
+ parameters: rawParameters
727
+ };
728
+ }
685
729
  return { circuitJson: passive(rawParameters), parameters: rawParameters };
686
730
  };
687
731
 
@@ -3828,41 +3872,41 @@ var to92 = (raw_params) => {
3828
3872
  });
3829
3873
  const { p, id, od, w, h, inline } = parameters;
3830
3874
  const holeY = Number.parseFloat(h) / 2;
3831
- const padSpacing4 = Number.parseFloat(p);
3875
+ const padSpacing6 = Number.parseFloat(p);
3832
3876
  const holeDia = Number.parseFloat(id);
3833
3877
  const padDia = Number.parseFloat(od);
3834
- const padWidth4 = padDia;
3835
- const padHeight4 = padDia * (1.5 / 1.05);
3878
+ const padWidth6 = padDia;
3879
+ const padHeight6 = padDia * (1.5 / 1.05);
3836
3880
  let platedHoles = [];
3837
3881
  if (parameters.num_pins === 3) {
3838
3882
  if (inline) {
3839
3883
  platedHoles = [
3840
3884
  platedHoleWithRectPad(
3841
3885
  1,
3842
- -padSpacing4,
3843
- holeY - padSpacing4,
3886
+ -padSpacing6,
3887
+ holeY - padSpacing6,
3844
3888
  holeDia,
3845
3889
  padDia,
3846
- padHeight4,
3890
+ padHeight6,
3847
3891
  0,
3848
3892
  0
3849
3893
  ),
3850
- platedHolePill(2, 0, holeY - padSpacing4, holeDia, padWidth4, padHeight4),
3894
+ platedHolePill(2, 0, holeY - padSpacing6, holeDia, padWidth6, padHeight6),
3851
3895
  platedHolePill(
3852
3896
  3,
3853
- padSpacing4,
3854
- holeY - padSpacing4,
3897
+ padSpacing6,
3898
+ holeY - padSpacing6,
3855
3899
  holeDia,
3856
- padWidth4,
3857
- padHeight4
3900
+ padWidth6,
3901
+ padHeight6
3858
3902
  )
3859
3903
  ];
3860
3904
  } else {
3861
3905
  platedHoles = [
3862
3906
  platedHoleWithRectPad(
3863
3907
  1,
3864
- -padSpacing4,
3865
- holeY - padSpacing4,
3908
+ -padSpacing6,
3909
+ holeY - padSpacing6,
3866
3910
  holeDia,
3867
3911
  padDia,
3868
3912
  padDia,
@@ -3870,28 +3914,28 @@ var to92 = (raw_params) => {
3870
3914
  0
3871
3915
  ),
3872
3916
  platedhole(2, 0, holeY, holeDia, padDia),
3873
- platedhole(3, padSpacing4, holeY - padSpacing4, holeDia, padDia)
3917
+ platedhole(3, padSpacing6, holeY - padSpacing6, holeDia, padDia)
3874
3918
  ];
3875
3919
  }
3876
3920
  } else if (parameters.num_pins === 2) {
3877
3921
  platedHoles = [
3878
3922
  platedHoleWithRectPad(
3879
3923
  1,
3880
- -padSpacing4,
3881
- holeY - padSpacing4,
3924
+ -padSpacing6,
3925
+ holeY - padSpacing6,
3882
3926
  holeDia,
3883
- padWidth4,
3884
- padHeight4,
3927
+ padWidth6,
3928
+ padHeight6,
3885
3929
  0,
3886
3930
  0
3887
3931
  ),
3888
3932
  platedHolePill(
3889
3933
  2,
3890
- padSpacing4,
3891
- holeY - padSpacing4,
3934
+ padSpacing6,
3935
+ holeY - padSpacing6,
3892
3936
  holeDia,
3893
- padWidth4,
3894
- padHeight4
3937
+ padWidth6,
3938
+ padHeight6
3895
3939
  )
3896
3940
  ];
3897
3941
  } else {
@@ -4857,15 +4901,15 @@ var sot89_def = base_def.extend({
4857
4901
  var sot89_3 = (parameters) => {
4858
4902
  const pads = [];
4859
4903
  const padGap = Number.parseFloat(parameters.p);
4860
- const padWidth4 = Number.parseFloat(parameters.pw);
4904
+ const padWidth6 = Number.parseFloat(parameters.pw);
4861
4905
  const length51 = Number.parseFloat(parameters.w);
4862
- const padHeight4 = Number.parseFloat(parameters.pl);
4906
+ const padHeight6 = Number.parseFloat(parameters.pl);
4863
4907
  const centerExtra = 0.175;
4864
- const outerPadXShift = (padHeight4 - (padHeight4 + centerExtra)) / 2;
4908
+ const outerPadXShift = (padHeight6 - (padHeight6 + centerExtra)) / 2;
4865
4909
  pads.push(
4866
- rectpad(1, -length51 / 2 + outerPadXShift, padGap, padHeight4, padWidth4),
4867
- rectpad(2, -length51 / 2, 0, padHeight4 + centerExtra, padWidth4),
4868
- rectpad(3, -length51 / 2 + outerPadXShift, -padGap, padHeight4, padWidth4)
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)
4869
4913
  );
4870
4914
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
4871
4915
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -4904,7 +4948,7 @@ var sot89_3 = (parameters) => {
4904
4948
  var sot89_5 = (parameters) => {
4905
4949
  const pads = [];
4906
4950
  const padGap = Number.parseFloat(parameters.p);
4907
- const padWidth4 = Number.parseFloat(parameters.pw);
4951
+ const padWidth6 = Number.parseFloat(parameters.pw);
4908
4952
  const length51 = Number.parseFloat(parameters.w);
4909
4953
  pads.push(
4910
4954
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
@@ -6060,20 +6104,20 @@ var to92s_def = base_def.extend({
6060
6104
  var to92s_3 = (parameters) => {
6061
6105
  const { p, id, od, w, h } = parameters;
6062
6106
  const holeY = Number.parseFloat(h) / 2;
6063
- const padSpacing4 = Number.parseFloat(p);
6107
+ const padSpacing6 = Number.parseFloat(p);
6064
6108
  return [
6065
- platedhole(1, -padSpacing4, holeY - padSpacing4, id, od),
6066
- platedhole(2, 0, holeY - padSpacing4, id, od),
6067
- platedhole(3, padSpacing4, holeY - padSpacing4, id, od)
6109
+ platedhole(1, -padSpacing6, holeY - padSpacing6, id, od),
6110
+ platedhole(2, 0, holeY - padSpacing6, id, od),
6111
+ platedhole(3, padSpacing6, holeY - padSpacing6, id, od)
6068
6112
  ];
6069
6113
  };
6070
6114
  var to92s_2 = (parameters) => {
6071
6115
  const { p, id, od, h } = parameters;
6072
6116
  const holeY = Number.parseFloat(h) / 2;
6073
- const padSpacing4 = Number.parseFloat(p);
6117
+ const padSpacing6 = Number.parseFloat(p);
6074
6118
  return [
6075
- platedhole(1, -padSpacing4, holeY - padSpacing4, id, od),
6076
- platedhole(2, padSpacing4, holeY - padSpacing4, id, od)
6119
+ platedhole(1, -padSpacing6, holeY - padSpacing6, id, od),
6120
+ platedhole(2, padSpacing6, holeY - padSpacing6, id, od)
6077
6121
  ];
6078
6122
  };
6079
6123
  var to92s = (raw_params) => {
@@ -6092,19 +6136,19 @@ var to92s = (raw_params) => {
6092
6136
  throw new Error("Invalid number of pins for TO-92");
6093
6137
  }
6094
6138
  const holeY = Number.parseFloat(parameters.h) / 2;
6095
- const padSpacing4 = Number.parseFloat(parameters.p);
6139
+ const padSpacing6 = Number.parseFloat(parameters.p);
6096
6140
  const silkscreenBody = {
6097
6141
  type: "pcb_silkscreen_path",
6098
6142
  layer: "top",
6099
6143
  pcb_component_id: "",
6100
6144
  route: [
6101
- { x: -holeY, y: holeY - padSpacing4 },
6145
+ { x: -holeY, y: holeY - padSpacing6 },
6102
6146
  { x: -1.9, y: 0 },
6103
6147
  { x: 1.9, y: 0 },
6104
- { x: holeY, y: holeY - padSpacing4 },
6148
+ { x: holeY, y: holeY - padSpacing6 },
6105
6149
  { x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6106
6150
  { x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6107
- { x: -holeY, y: holeY - padSpacing4 }
6151
+ { x: -holeY, y: holeY - padSpacing6 }
6108
6152
  ],
6109
6153
  stroke_width: 0.1,
6110
6154
  pcb_silkscreen_path_id: ""
@@ -6883,13 +6927,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
6883
6927
  import { length as length45 } from "circuit-json";
6884
6928
  var solderjumper = (params) => {
6885
6929
  const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
6886
- const padSpacing4 = length45.parse(p);
6887
- const padWidth4 = length45.parse(pw);
6888
- const padHeight4 = length45.parse(ph);
6889
- const traceWidth = Math.min(padHeight4 / 4, 0.5);
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);
6890
6934
  const pads = [];
6891
6935
  for (let i = 0; i < num_pins; i++) {
6892
- pads.push(rectpad(i + 1, i * padSpacing4, 0, padWidth4, padHeight4));
6936
+ pads.push(rectpad(i + 1, i * padSpacing6, 0, padWidth6, padHeight6));
6893
6937
  }
6894
6938
  let traces = [];
6895
6939
  if (bridged) {
@@ -6899,11 +6943,11 @@ var solderjumper = (params) => {
6899
6943
  const from = pins[i];
6900
6944
  const to = pins[i + 1];
6901
6945
  if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
6902
- const xCenterFrom = (from - 1) * padSpacing4;
6903
- const xCenterTo = (to - 1) * padSpacing4;
6946
+ const xCenterFrom = (from - 1) * padSpacing6;
6947
+ const xCenterTo = (to - 1) * padSpacing6;
6904
6948
  const directionMult = Math.sign(xCenterTo - xCenterFrom);
6905
- const x1 = xCenterFrom + directionMult * (padWidth4 / 2);
6906
- const x2 = xCenterTo - directionMult * (padWidth4 / 2);
6949
+ const x1 = xCenterFrom + directionMult * (padWidth6 / 2);
6950
+ const x2 = xCenterTo - directionMult * (padWidth6 / 2);
6907
6951
  traces.push({
6908
6952
  type: "pcb_trace",
6909
6953
  pcb_trace_id: "",
@@ -6930,9 +6974,9 @@ var solderjumper = (params) => {
6930
6974
  }
6931
6975
  }
6932
6976
  }
6933
- const outlineWidth = (num_pins - 1) * padSpacing4 + padWidth4 + 0.7;
6934
- const outlineHeight = padHeight4 + 1;
6935
- const outlineCenterX = (num_pins - 1) * padSpacing4 / 2;
6977
+ const outlineWidth = (num_pins - 1) * padSpacing6 + padWidth6 + 0.7;
6978
+ const outlineHeight = padHeight6 + 1;
6979
+ const outlineCenterX = (num_pins - 1) * padSpacing6 / 2;
6936
6980
  const outlineCenterY = 0;
6937
6981
  const silkscreenRect = {
6938
6982
  type: "pcb_silkscreen_path",
@@ -7033,40 +7077,40 @@ var generateSot457Elements = (params) => {
7033
7077
  const pads = [];
7034
7078
  const pitch = parseDimension(params.p);
7035
7079
  const padLength = parseDimension(params.pl);
7036
- const padWidth4 = parseDimension(params.pw);
7080
+ const padWidth6 = parseDimension(params.pw);
7037
7081
  const width = parseDimension(params.w);
7038
7082
  const height = parseDimension(params.h);
7039
7083
  if (params.wave) {
7040
7084
  const pinConfigs = {
7041
- 1: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(1, -pitch, pitch, padHeight4, padWidth5),
7042
- 2: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(2, -pitch, -pitch, padHeight4, padWidth5),
7043
- 3: ({ padWidth: padWidth5, padHeight: padHeight4 }) => pillpad(
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(
7044
7088
  3,
7045
7089
  -pitch,
7046
7090
  0,
7047
7091
  parseDimension(params.pillw),
7048
7092
  parseDimension(params.pillh)
7049
7093
  ),
7050
- 4: ({ padWidth: padWidth5, padHeight: padHeight4 }) => pillpad(
7094
+ 4: ({ padWidth: padWidth7, padHeight: padHeight6 }) => pillpad(
7051
7095
  4,
7052
7096
  pitch,
7053
7097
  0,
7054
7098
  parseDimension(params.pillw),
7055
7099
  parseDimension(params.pillh)
7056
7100
  ),
7057
- 5: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(5, pitch, pitch, padHeight4, padWidth5),
7058
- 6: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(6, pitch, -pitch, padHeight4, padWidth5)
7101
+ 5: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(5, pitch, pitch, padHeight6, padWidth7),
7102
+ 6: ({ padWidth: padWidth7, padHeight: padHeight6 }) => rectpad(6, pitch, -pitch, padHeight6, padWidth7)
7059
7103
  };
7060
7104
  for (let i = 1; i <= params.num_pins; i++) {
7061
7105
  const config = pinConfigs[i];
7062
7106
  if (config) {
7063
- pads.push(config({ padWidth: padLength, padHeight: padWidth4 }));
7107
+ pads.push(config({ padWidth: padLength, padHeight: padWidth6 }));
7064
7108
  }
7065
7109
  }
7066
7110
  } else {
7067
7111
  for (let i = 1; i <= params.num_pins; i++) {
7068
7112
  const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
7069
- pads.push(rectpad(i, x, y, padLength, padWidth4));
7113
+ pads.push(rectpad(i, x, y, padLength, padWidth6));
7070
7114
  }
7071
7115
  }
7072
7116
  const silkscreenPath1 = {
@@ -7095,7 +7139,7 @@ var generateSot457Elements = (params) => {
7095
7139
  const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
7096
7140
  const triangleHeight = params.wave ? 1 : 0.5;
7097
7141
  const triangleWidth = params.wave ? 0.7 : 0.3;
7098
- pin1Position.x -= params.wave ? padWidth4 : padWidth4 * 1.7;
7142
+ pin1Position.x -= params.wave ? padWidth6 : padWidth6 * 1.7;
7099
7143
  const pin1Indicator = {
7100
7144
  type: "pcb_silkscreen_path",
7101
7145
  layer: "top",
@@ -7957,7 +8001,7 @@ var m2host_def = base_def.extend({
7957
8001
  var m2host = (raw_params) => {
7958
8002
  const parameters = m2host_def.parse(raw_params);
7959
8003
  const pads = [];
7960
- const padWidth4 = 0.5 - 0.15;
8004
+ const padWidth6 = 0.5 - 0.15;
7961
8005
  const padLength = 1.5;
7962
8006
  const pitch = 0.5;
7963
8007
  const halfPitch = pitch / 2;
@@ -7972,7 +8016,7 @@ var m2host = (raw_params) => {
7972
8016
  const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
7973
8017
  const rightEdgeOffset = 0.5;
7974
8018
  const x = rightEdgeOffset - padLengthWithOffset / 2;
7975
- const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth4);
8019
+ const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth6);
7976
8020
  pad2.layer = isBottomLayer ? "bottom" : "top";
7977
8021
  pads.push(pad2);
7978
8022
  }