@tscircuit/footprinter 0.0.285 → 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: padSpacing5, padWidth: padWidth5, padHeight: padHeight5, padPitch: padPitch5, 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) * (padPitch5 / 2);
524
+ const halfRange = (numRows - 1) * (padPitch7 / 2);
525
525
  for (let i = 0; i < numRows; i++) {
526
- yPositions.push(halfRange - i * padPitch5);
526
+ yPositions.push(halfRange - i * padPitch7);
527
527
  }
528
528
  const pads = [];
529
529
  yPositions.forEach((y, index) => {
530
- pads.push(rectpad(index + 1, -padSpacing5 / 2, y, padWidth5, padHeight5));
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, padSpacing5 / 2, y, padWidth5, padHeight5)
534
+ rectpad(index + numRows + 1, padSpacing7 / 2, y, padWidth7, padHeight7)
535
535
  );
536
536
  });
537
- const top = Math.max(...yPositions) + padHeight5 / 2 + 0.4;
538
- const bottom = Math.min(...yPositions) - padHeight5 / 2 - 0.4;
539
- const left = -padSpacing5 / 2 - padWidth5 / 2 - 0.4;
540
- const right = padSpacing5 / 2 + padWidth5 / 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 = -padSpacing5 / 2;
563
+ const pin1X = -padSpacing7 / 2;
564
564
  const pin1Y = Math.max(...yPositions);
565
565
  const pin1MarkerSize = 0.2;
566
- const pin1Left = pin1X - padWidth5 / 2 - 0.1;
567
- const pin1Top = pin1Y + padHeight5 / 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",
@@ -653,6 +653,38 @@ var res0603Array4 = (params) => {
653
653
  });
654
654
  };
655
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
+
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
+
656
688
  // src/fn/res.ts
657
689
  var getArrayCount = (parameters) => {
658
690
  const arrayValue = parameters.array ?? parameters.x;
@@ -704,6 +736,18 @@ var res = (rawParameters) => {
704
736
  parameters: rawParameters
705
737
  };
706
738
  }
739
+ if (arrayCount === 2 && imperialBase === "0606") {
740
+ return {
741
+ circuitJson: res0606Array2(rawParameters),
742
+ parameters: rawParameters
743
+ };
744
+ }
745
+ if (arrayCount === 4 && imperialBase === "1206") {
746
+ return {
747
+ circuitJson: res1206Array4(rawParameters),
748
+ parameters: rawParameters
749
+ };
750
+ }
707
751
  return { circuitJson: passive(rawParameters), parameters: rawParameters };
708
752
  };
709
753
 
@@ -3850,41 +3894,41 @@ var to92 = (raw_params) => {
3850
3894
  });
3851
3895
  const { p, id, od, w, h, inline } = parameters;
3852
3896
  const holeY = Number.parseFloat(h) / 2;
3853
- const padSpacing5 = Number.parseFloat(p);
3897
+ const padSpacing7 = Number.parseFloat(p);
3854
3898
  const holeDia = Number.parseFloat(id);
3855
3899
  const padDia = Number.parseFloat(od);
3856
- const padWidth5 = padDia;
3857
- const padHeight5 = padDia * (1.5 / 1.05);
3900
+ const padWidth7 = padDia;
3901
+ const padHeight7 = padDia * (1.5 / 1.05);
3858
3902
  let platedHoles = [];
3859
3903
  if (parameters.num_pins === 3) {
3860
3904
  if (inline) {
3861
3905
  platedHoles = [
3862
3906
  platedHoleWithRectPad(
3863
3907
  1,
3864
- -padSpacing5,
3865
- holeY - padSpacing5,
3908
+ -padSpacing7,
3909
+ holeY - padSpacing7,
3866
3910
  holeDia,
3867
3911
  padDia,
3868
- padHeight5,
3912
+ padHeight7,
3869
3913
  0,
3870
3914
  0
3871
3915
  ),
3872
- platedHolePill(2, 0, holeY - padSpacing5, holeDia, padWidth5, padHeight5),
3916
+ platedHolePill(2, 0, holeY - padSpacing7, holeDia, padWidth7, padHeight7),
3873
3917
  platedHolePill(
3874
3918
  3,
3875
- padSpacing5,
3876
- holeY - padSpacing5,
3919
+ padSpacing7,
3920
+ holeY - padSpacing7,
3877
3921
  holeDia,
3878
- padWidth5,
3879
- padHeight5
3922
+ padWidth7,
3923
+ padHeight7
3880
3924
  )
3881
3925
  ];
3882
3926
  } else {
3883
3927
  platedHoles = [
3884
3928
  platedHoleWithRectPad(
3885
3929
  1,
3886
- -padSpacing5,
3887
- holeY - padSpacing5,
3930
+ -padSpacing7,
3931
+ holeY - padSpacing7,
3888
3932
  holeDia,
3889
3933
  padDia,
3890
3934
  padDia,
@@ -3892,28 +3936,28 @@ var to92 = (raw_params) => {
3892
3936
  0
3893
3937
  ),
3894
3938
  platedhole(2, 0, holeY, holeDia, padDia),
3895
- platedhole(3, padSpacing5, holeY - padSpacing5, holeDia, padDia)
3939
+ platedhole(3, padSpacing7, holeY - padSpacing7, holeDia, padDia)
3896
3940
  ];
3897
3941
  }
3898
3942
  } else if (parameters.num_pins === 2) {
3899
3943
  platedHoles = [
3900
3944
  platedHoleWithRectPad(
3901
3945
  1,
3902
- -padSpacing5,
3903
- holeY - padSpacing5,
3946
+ -padSpacing7,
3947
+ holeY - padSpacing7,
3904
3948
  holeDia,
3905
- padWidth5,
3906
- padHeight5,
3949
+ padWidth7,
3950
+ padHeight7,
3907
3951
  0,
3908
3952
  0
3909
3953
  ),
3910
3954
  platedHolePill(
3911
3955
  2,
3912
- padSpacing5,
3913
- holeY - padSpacing5,
3956
+ padSpacing7,
3957
+ holeY - padSpacing7,
3914
3958
  holeDia,
3915
- padWidth5,
3916
- padHeight5
3959
+ padWidth7,
3960
+ padHeight7
3917
3961
  )
3918
3962
  ];
3919
3963
  } else {
@@ -4879,15 +4923,15 @@ var sot89_def = base_def.extend({
4879
4923
  var sot89_3 = (parameters) => {
4880
4924
  const pads = [];
4881
4925
  const padGap = Number.parseFloat(parameters.p);
4882
- const padWidth5 = Number.parseFloat(parameters.pw);
4926
+ const padWidth7 = Number.parseFloat(parameters.pw);
4883
4927
  const length51 = Number.parseFloat(parameters.w);
4884
- const padHeight5 = Number.parseFloat(parameters.pl);
4928
+ const padHeight7 = Number.parseFloat(parameters.pl);
4885
4929
  const centerExtra = 0.175;
4886
- const outerPadXShift = (padHeight5 - (padHeight5 + centerExtra)) / 2;
4930
+ const outerPadXShift = (padHeight7 - (padHeight7 + centerExtra)) / 2;
4887
4931
  pads.push(
4888
- rectpad(1, -length51 / 2 + outerPadXShift, padGap, padHeight5, padWidth5),
4889
- rectpad(2, -length51 / 2, 0, padHeight5 + centerExtra, padWidth5),
4890
- rectpad(3, -length51 / 2 + outerPadXShift, -padGap, padHeight5, padWidth5)
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)
4891
4935
  );
4892
4936
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
4893
4937
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -4926,7 +4970,7 @@ var sot89_3 = (parameters) => {
4926
4970
  var sot89_5 = (parameters) => {
4927
4971
  const pads = [];
4928
4972
  const padGap = Number.parseFloat(parameters.p);
4929
- const padWidth5 = Number.parseFloat(parameters.pw);
4973
+ const padWidth7 = Number.parseFloat(parameters.pw);
4930
4974
  const length51 = Number.parseFloat(parameters.w);
4931
4975
  pads.push(
4932
4976
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
@@ -6082,20 +6126,20 @@ var to92s_def = base_def.extend({
6082
6126
  var to92s_3 = (parameters) => {
6083
6127
  const { p, id, od, w, h } = parameters;
6084
6128
  const holeY = Number.parseFloat(h) / 2;
6085
- const padSpacing5 = Number.parseFloat(p);
6129
+ const padSpacing7 = Number.parseFloat(p);
6086
6130
  return [
6087
- platedhole(1, -padSpacing5, holeY - padSpacing5, id, od),
6088
- platedhole(2, 0, holeY - padSpacing5, id, od),
6089
- platedhole(3, padSpacing5, holeY - padSpacing5, 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)
6090
6134
  ];
6091
6135
  };
6092
6136
  var to92s_2 = (parameters) => {
6093
6137
  const { p, id, od, h } = parameters;
6094
6138
  const holeY = Number.parseFloat(h) / 2;
6095
- const padSpacing5 = Number.parseFloat(p);
6139
+ const padSpacing7 = Number.parseFloat(p);
6096
6140
  return [
6097
- platedhole(1, -padSpacing5, holeY - padSpacing5, id, od),
6098
- platedhole(2, padSpacing5, holeY - padSpacing5, id, od)
6141
+ platedhole(1, -padSpacing7, holeY - padSpacing7, id, od),
6142
+ platedhole(2, padSpacing7, holeY - padSpacing7, id, od)
6099
6143
  ];
6100
6144
  };
6101
6145
  var to92s = (raw_params) => {
@@ -6114,19 +6158,19 @@ var to92s = (raw_params) => {
6114
6158
  throw new Error("Invalid number of pins for TO-92");
6115
6159
  }
6116
6160
  const holeY = Number.parseFloat(parameters.h) / 2;
6117
- const padSpacing5 = Number.parseFloat(parameters.p);
6161
+ const padSpacing7 = Number.parseFloat(parameters.p);
6118
6162
  const silkscreenBody = {
6119
6163
  type: "pcb_silkscreen_path",
6120
6164
  layer: "top",
6121
6165
  pcb_component_id: "",
6122
6166
  route: [
6123
- { x: -holeY, y: holeY - padSpacing5 },
6167
+ { x: -holeY, y: holeY - padSpacing7 },
6124
6168
  { x: -1.9, y: 0 },
6125
6169
  { x: 1.9, y: 0 },
6126
- { x: holeY, y: holeY - padSpacing5 },
6170
+ { x: holeY, y: holeY - padSpacing7 },
6127
6171
  { x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6128
6172
  { x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6129
- { x: -holeY, y: holeY - padSpacing5 }
6173
+ { x: -holeY, y: holeY - padSpacing7 }
6130
6174
  ],
6131
6175
  stroke_width: 0.1,
6132
6176
  pcb_silkscreen_path_id: ""
@@ -6905,13 +6949,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
6905
6949
  import { length as length45 } from "circuit-json";
6906
6950
  var solderjumper = (params) => {
6907
6951
  const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
6908
- const padSpacing5 = length45.parse(p);
6909
- const padWidth5 = length45.parse(pw);
6910
- const padHeight5 = length45.parse(ph);
6911
- const traceWidth = Math.min(padHeight5 / 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);
6912
6956
  const pads = [];
6913
6957
  for (let i = 0; i < num_pins; i++) {
6914
- pads.push(rectpad(i + 1, i * padSpacing5, 0, padWidth5, padHeight5));
6958
+ pads.push(rectpad(i + 1, i * padSpacing7, 0, padWidth7, padHeight7));
6915
6959
  }
6916
6960
  let traces = [];
6917
6961
  if (bridged) {
@@ -6921,11 +6965,11 @@ var solderjumper = (params) => {
6921
6965
  const from = pins[i];
6922
6966
  const to = pins[i + 1];
6923
6967
  if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
6924
- const xCenterFrom = (from - 1) * padSpacing5;
6925
- const xCenterTo = (to - 1) * padSpacing5;
6968
+ const xCenterFrom = (from - 1) * padSpacing7;
6969
+ const xCenterTo = (to - 1) * padSpacing7;
6926
6970
  const directionMult = Math.sign(xCenterTo - xCenterFrom);
6927
- const x1 = xCenterFrom + directionMult * (padWidth5 / 2);
6928
- const x2 = xCenterTo - directionMult * (padWidth5 / 2);
6971
+ const x1 = xCenterFrom + directionMult * (padWidth7 / 2);
6972
+ const x2 = xCenterTo - directionMult * (padWidth7 / 2);
6929
6973
  traces.push({
6930
6974
  type: "pcb_trace",
6931
6975
  pcb_trace_id: "",
@@ -6952,9 +6996,9 @@ var solderjumper = (params) => {
6952
6996
  }
6953
6997
  }
6954
6998
  }
6955
- const outlineWidth = (num_pins - 1) * padSpacing5 + padWidth5 + 0.7;
6956
- const outlineHeight = padHeight5 + 1;
6957
- const outlineCenterX = (num_pins - 1) * padSpacing5 / 2;
6999
+ const outlineWidth = (num_pins - 1) * padSpacing7 + padWidth7 + 0.7;
7000
+ const outlineHeight = padHeight7 + 1;
7001
+ const outlineCenterX = (num_pins - 1) * padSpacing7 / 2;
6958
7002
  const outlineCenterY = 0;
6959
7003
  const silkscreenRect = {
6960
7004
  type: "pcb_silkscreen_path",
@@ -7055,40 +7099,40 @@ var generateSot457Elements = (params) => {
7055
7099
  const pads = [];
7056
7100
  const pitch = parseDimension(params.p);
7057
7101
  const padLength = parseDimension(params.pl);
7058
- const padWidth5 = parseDimension(params.pw);
7102
+ const padWidth7 = parseDimension(params.pw);
7059
7103
  const width = parseDimension(params.w);
7060
7104
  const height = parseDimension(params.h);
7061
7105
  if (params.wave) {
7062
7106
  const pinConfigs = {
7063
- 1: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(1, -pitch, pitch, padHeight5, padWidth6),
7064
- 2: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(2, -pitch, -pitch, padHeight5, padWidth6),
7065
- 3: ({ padWidth: padWidth6, padHeight: padHeight5 }) => 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(
7066
7110
  3,
7067
7111
  -pitch,
7068
7112
  0,
7069
7113
  parseDimension(params.pillw),
7070
7114
  parseDimension(params.pillh)
7071
7115
  ),
7072
- 4: ({ padWidth: padWidth6, padHeight: padHeight5 }) => pillpad(
7116
+ 4: ({ padWidth: padWidth8, padHeight: padHeight7 }) => pillpad(
7073
7117
  4,
7074
7118
  pitch,
7075
7119
  0,
7076
7120
  parseDimension(params.pillw),
7077
7121
  parseDimension(params.pillh)
7078
7122
  ),
7079
- 5: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(5, pitch, pitch, padHeight5, padWidth6),
7080
- 6: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(6, pitch, -pitch, padHeight5, padWidth6)
7123
+ 5: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(5, pitch, pitch, padHeight7, padWidth8),
7124
+ 6: ({ padWidth: padWidth8, padHeight: padHeight7 }) => rectpad(6, pitch, -pitch, padHeight7, padWidth8)
7081
7125
  };
7082
7126
  for (let i = 1; i <= params.num_pins; i++) {
7083
7127
  const config = pinConfigs[i];
7084
7128
  if (config) {
7085
- pads.push(config({ padWidth: padLength, padHeight: padWidth5 }));
7129
+ pads.push(config({ padWidth: padLength, padHeight: padWidth7 }));
7086
7130
  }
7087
7131
  }
7088
7132
  } else {
7089
7133
  for (let i = 1; i <= params.num_pins; i++) {
7090
7134
  const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
7091
- pads.push(rectpad(i, x, y, padLength, padWidth5));
7135
+ pads.push(rectpad(i, x, y, padLength, padWidth7));
7092
7136
  }
7093
7137
  }
7094
7138
  const silkscreenPath1 = {
@@ -7117,7 +7161,7 @@ var generateSot457Elements = (params) => {
7117
7161
  const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
7118
7162
  const triangleHeight = params.wave ? 1 : 0.5;
7119
7163
  const triangleWidth = params.wave ? 0.7 : 0.3;
7120
- pin1Position.x -= params.wave ? padWidth5 : padWidth5 * 1.7;
7164
+ pin1Position.x -= params.wave ? padWidth7 : padWidth7 * 1.7;
7121
7165
  const pin1Indicator = {
7122
7166
  type: "pcb_silkscreen_path",
7123
7167
  layer: "top",
@@ -7979,7 +8023,7 @@ var m2host_def = base_def.extend({
7979
8023
  var m2host = (raw_params) => {
7980
8024
  const parameters = m2host_def.parse(raw_params);
7981
8025
  const pads = [];
7982
- const padWidth5 = 0.5 - 0.15;
8026
+ const padWidth7 = 0.5 - 0.15;
7983
8027
  const padLength = 1.5;
7984
8028
  const pitch = 0.5;
7985
8029
  const halfPitch = pitch / 2;
@@ -7994,7 +8038,7 @@ var m2host = (raw_params) => {
7994
8038
  const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
7995
8039
  const rightEdgeOffset = 0.5;
7996
8040
  const x = rightEdgeOffset - padLengthWithOffset / 2;
7997
- const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth5);
8041
+ const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth7);
7998
8042
  pad2.layer = isBottomLayer ? "bottom" : "top";
7999
8043
  pads.push(pad2);
8000
8044
  }