@tscircuit/footprinter 0.0.284 → 0.0.285

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: padSpacing5, padWidth: padWidth5, padHeight: padHeight5, padPitch: padPitch5, numRows, textbottom } = params;
523
523
  const yPositions = [];
524
- const halfRange = (numRows - 1) * (padPitch4 / 2);
524
+ const halfRange = (numRows - 1) * (padPitch5 / 2);
525
525
  for (let i = 0; i < numRows; i++) {
526
- yPositions.push(halfRange - i * padPitch4);
526
+ yPositions.push(halfRange - i * padPitch5);
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, -padSpacing5 / 2, y, padWidth5, padHeight5));
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, padSpacing5 / 2, y, padWidth5, padHeight5)
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) + 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;
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 = -padSpacing5 / 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 - padWidth5 / 2 - 0.1;
567
+ const pin1Top = pin1Y + padHeight5 / 2 + 0.1;
568
568
  const pin1Marker = {
569
569
  type: "pcb_silkscreen_path",
570
570
  layer: "top",
@@ -637,6 +637,22 @@ 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
+
640
656
  // src/fn/res.ts
641
657
  var getArrayCount = (parameters) => {
642
658
  const arrayValue = parameters.array ?? parameters.x;
@@ -682,6 +698,12 @@ var res = (rawParameters) => {
682
698
  parameters: rawParameters
683
699
  };
684
700
  }
701
+ if (arrayCount === 4 && imperialBase === "0603") {
702
+ return {
703
+ circuitJson: res0603Array4(rawParameters),
704
+ parameters: rawParameters
705
+ };
706
+ }
685
707
  return { circuitJson: passive(rawParameters), parameters: rawParameters };
686
708
  };
687
709
 
@@ -3828,41 +3850,41 @@ var to92 = (raw_params) => {
3828
3850
  });
3829
3851
  const { p, id, od, w, h, inline } = parameters;
3830
3852
  const holeY = Number.parseFloat(h) / 2;
3831
- const padSpacing4 = Number.parseFloat(p);
3853
+ const padSpacing5 = Number.parseFloat(p);
3832
3854
  const holeDia = Number.parseFloat(id);
3833
3855
  const padDia = Number.parseFloat(od);
3834
- const padWidth4 = padDia;
3835
- const padHeight4 = padDia * (1.5 / 1.05);
3856
+ const padWidth5 = padDia;
3857
+ const padHeight5 = padDia * (1.5 / 1.05);
3836
3858
  let platedHoles = [];
3837
3859
  if (parameters.num_pins === 3) {
3838
3860
  if (inline) {
3839
3861
  platedHoles = [
3840
3862
  platedHoleWithRectPad(
3841
3863
  1,
3842
- -padSpacing4,
3843
- holeY - padSpacing4,
3864
+ -padSpacing5,
3865
+ holeY - padSpacing5,
3844
3866
  holeDia,
3845
3867
  padDia,
3846
- padHeight4,
3868
+ padHeight5,
3847
3869
  0,
3848
3870
  0
3849
3871
  ),
3850
- platedHolePill(2, 0, holeY - padSpacing4, holeDia, padWidth4, padHeight4),
3872
+ platedHolePill(2, 0, holeY - padSpacing5, holeDia, padWidth5, padHeight5),
3851
3873
  platedHolePill(
3852
3874
  3,
3853
- padSpacing4,
3854
- holeY - padSpacing4,
3875
+ padSpacing5,
3876
+ holeY - padSpacing5,
3855
3877
  holeDia,
3856
- padWidth4,
3857
- padHeight4
3878
+ padWidth5,
3879
+ padHeight5
3858
3880
  )
3859
3881
  ];
3860
3882
  } else {
3861
3883
  platedHoles = [
3862
3884
  platedHoleWithRectPad(
3863
3885
  1,
3864
- -padSpacing4,
3865
- holeY - padSpacing4,
3886
+ -padSpacing5,
3887
+ holeY - padSpacing5,
3866
3888
  holeDia,
3867
3889
  padDia,
3868
3890
  padDia,
@@ -3870,28 +3892,28 @@ var to92 = (raw_params) => {
3870
3892
  0
3871
3893
  ),
3872
3894
  platedhole(2, 0, holeY, holeDia, padDia),
3873
- platedhole(3, padSpacing4, holeY - padSpacing4, holeDia, padDia)
3895
+ platedhole(3, padSpacing5, holeY - padSpacing5, holeDia, padDia)
3874
3896
  ];
3875
3897
  }
3876
3898
  } else if (parameters.num_pins === 2) {
3877
3899
  platedHoles = [
3878
3900
  platedHoleWithRectPad(
3879
3901
  1,
3880
- -padSpacing4,
3881
- holeY - padSpacing4,
3902
+ -padSpacing5,
3903
+ holeY - padSpacing5,
3882
3904
  holeDia,
3883
- padWidth4,
3884
- padHeight4,
3905
+ padWidth5,
3906
+ padHeight5,
3885
3907
  0,
3886
3908
  0
3887
3909
  ),
3888
3910
  platedHolePill(
3889
3911
  2,
3890
- padSpacing4,
3891
- holeY - padSpacing4,
3912
+ padSpacing5,
3913
+ holeY - padSpacing5,
3892
3914
  holeDia,
3893
- padWidth4,
3894
- padHeight4
3915
+ padWidth5,
3916
+ padHeight5
3895
3917
  )
3896
3918
  ];
3897
3919
  } else {
@@ -4857,15 +4879,15 @@ var sot89_def = base_def.extend({
4857
4879
  var sot89_3 = (parameters) => {
4858
4880
  const pads = [];
4859
4881
  const padGap = Number.parseFloat(parameters.p);
4860
- const padWidth4 = Number.parseFloat(parameters.pw);
4882
+ const padWidth5 = Number.parseFloat(parameters.pw);
4861
4883
  const length51 = Number.parseFloat(parameters.w);
4862
- const padHeight4 = Number.parseFloat(parameters.pl);
4884
+ const padHeight5 = Number.parseFloat(parameters.pl);
4863
4885
  const centerExtra = 0.175;
4864
- const outerPadXShift = (padHeight4 - (padHeight4 + centerExtra)) / 2;
4886
+ const outerPadXShift = (padHeight5 - (padHeight5 + centerExtra)) / 2;
4865
4887
  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)
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)
4869
4891
  );
4870
4892
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
4871
4893
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -4904,7 +4926,7 @@ var sot89_3 = (parameters) => {
4904
4926
  var sot89_5 = (parameters) => {
4905
4927
  const pads = [];
4906
4928
  const padGap = Number.parseFloat(parameters.p);
4907
- const padWidth4 = Number.parseFloat(parameters.pw);
4929
+ const padWidth5 = Number.parseFloat(parameters.pw);
4908
4930
  const length51 = Number.parseFloat(parameters.w);
4909
4931
  pads.push(
4910
4932
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
@@ -6060,20 +6082,20 @@ var to92s_def = base_def.extend({
6060
6082
  var to92s_3 = (parameters) => {
6061
6083
  const { p, id, od, w, h } = parameters;
6062
6084
  const holeY = Number.parseFloat(h) / 2;
6063
- const padSpacing4 = Number.parseFloat(p);
6085
+ const padSpacing5 = Number.parseFloat(p);
6064
6086
  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)
6087
+ platedhole(1, -padSpacing5, holeY - padSpacing5, id, od),
6088
+ platedhole(2, 0, holeY - padSpacing5, id, od),
6089
+ platedhole(3, padSpacing5, holeY - padSpacing5, id, od)
6068
6090
  ];
6069
6091
  };
6070
6092
  var to92s_2 = (parameters) => {
6071
6093
  const { p, id, od, h } = parameters;
6072
6094
  const holeY = Number.parseFloat(h) / 2;
6073
- const padSpacing4 = Number.parseFloat(p);
6095
+ const padSpacing5 = Number.parseFloat(p);
6074
6096
  return [
6075
- platedhole(1, -padSpacing4, holeY - padSpacing4, id, od),
6076
- platedhole(2, padSpacing4, holeY - padSpacing4, id, od)
6097
+ platedhole(1, -padSpacing5, holeY - padSpacing5, id, od),
6098
+ platedhole(2, padSpacing5, holeY - padSpacing5, id, od)
6077
6099
  ];
6078
6100
  };
6079
6101
  var to92s = (raw_params) => {
@@ -6092,19 +6114,19 @@ var to92s = (raw_params) => {
6092
6114
  throw new Error("Invalid number of pins for TO-92");
6093
6115
  }
6094
6116
  const holeY = Number.parseFloat(parameters.h) / 2;
6095
- const padSpacing4 = Number.parseFloat(parameters.p);
6117
+ const padSpacing5 = Number.parseFloat(parameters.p);
6096
6118
  const silkscreenBody = {
6097
6119
  type: "pcb_silkscreen_path",
6098
6120
  layer: "top",
6099
6121
  pcb_component_id: "",
6100
6122
  route: [
6101
- { x: -holeY, y: holeY - padSpacing4 },
6123
+ { x: -holeY, y: holeY - padSpacing5 },
6102
6124
  { x: -1.9, y: 0 },
6103
6125
  { x: 1.9, y: 0 },
6104
- { x: holeY, y: holeY - padSpacing4 },
6126
+ { x: holeY, y: holeY - padSpacing5 },
6105
6127
  { x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6106
6128
  { x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6107
- { x: -holeY, y: holeY - padSpacing4 }
6129
+ { x: -holeY, y: holeY - padSpacing5 }
6108
6130
  ],
6109
6131
  stroke_width: 0.1,
6110
6132
  pcb_silkscreen_path_id: ""
@@ -6883,13 +6905,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
6883
6905
  import { length as length45 } from "circuit-json";
6884
6906
  var solderjumper = (params) => {
6885
6907
  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);
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);
6890
6912
  const pads = [];
6891
6913
  for (let i = 0; i < num_pins; i++) {
6892
- pads.push(rectpad(i + 1, i * padSpacing4, 0, padWidth4, padHeight4));
6914
+ pads.push(rectpad(i + 1, i * padSpacing5, 0, padWidth5, padHeight5));
6893
6915
  }
6894
6916
  let traces = [];
6895
6917
  if (bridged) {
@@ -6899,11 +6921,11 @@ var solderjumper = (params) => {
6899
6921
  const from = pins[i];
6900
6922
  const to = pins[i + 1];
6901
6923
  if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
6902
- const xCenterFrom = (from - 1) * padSpacing4;
6903
- const xCenterTo = (to - 1) * padSpacing4;
6924
+ const xCenterFrom = (from - 1) * padSpacing5;
6925
+ const xCenterTo = (to - 1) * padSpacing5;
6904
6926
  const directionMult = Math.sign(xCenterTo - xCenterFrom);
6905
- const x1 = xCenterFrom + directionMult * (padWidth4 / 2);
6906
- const x2 = xCenterTo - directionMult * (padWidth4 / 2);
6927
+ const x1 = xCenterFrom + directionMult * (padWidth5 / 2);
6928
+ const x2 = xCenterTo - directionMult * (padWidth5 / 2);
6907
6929
  traces.push({
6908
6930
  type: "pcb_trace",
6909
6931
  pcb_trace_id: "",
@@ -6930,9 +6952,9 @@ var solderjumper = (params) => {
6930
6952
  }
6931
6953
  }
6932
6954
  }
6933
- const outlineWidth = (num_pins - 1) * padSpacing4 + padWidth4 + 0.7;
6934
- const outlineHeight = padHeight4 + 1;
6935
- const outlineCenterX = (num_pins - 1) * padSpacing4 / 2;
6955
+ const outlineWidth = (num_pins - 1) * padSpacing5 + padWidth5 + 0.7;
6956
+ const outlineHeight = padHeight5 + 1;
6957
+ const outlineCenterX = (num_pins - 1) * padSpacing5 / 2;
6936
6958
  const outlineCenterY = 0;
6937
6959
  const silkscreenRect = {
6938
6960
  type: "pcb_silkscreen_path",
@@ -7033,40 +7055,40 @@ var generateSot457Elements = (params) => {
7033
7055
  const pads = [];
7034
7056
  const pitch = parseDimension(params.p);
7035
7057
  const padLength = parseDimension(params.pl);
7036
- const padWidth4 = parseDimension(params.pw);
7058
+ const padWidth5 = parseDimension(params.pw);
7037
7059
  const width = parseDimension(params.w);
7038
7060
  const height = parseDimension(params.h);
7039
7061
  if (params.wave) {
7040
7062
  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(
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(
7044
7066
  3,
7045
7067
  -pitch,
7046
7068
  0,
7047
7069
  parseDimension(params.pillw),
7048
7070
  parseDimension(params.pillh)
7049
7071
  ),
7050
- 4: ({ padWidth: padWidth5, padHeight: padHeight4 }) => pillpad(
7072
+ 4: ({ padWidth: padWidth6, padHeight: padHeight5 }) => pillpad(
7051
7073
  4,
7052
7074
  pitch,
7053
7075
  0,
7054
7076
  parseDimension(params.pillw),
7055
7077
  parseDimension(params.pillh)
7056
7078
  ),
7057
- 5: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(5, pitch, pitch, padHeight4, padWidth5),
7058
- 6: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(6, pitch, -pitch, padHeight4, padWidth5)
7079
+ 5: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(5, pitch, pitch, padHeight5, padWidth6),
7080
+ 6: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(6, pitch, -pitch, padHeight5, padWidth6)
7059
7081
  };
7060
7082
  for (let i = 1; i <= params.num_pins; i++) {
7061
7083
  const config = pinConfigs[i];
7062
7084
  if (config) {
7063
- pads.push(config({ padWidth: padLength, padHeight: padWidth4 }));
7085
+ pads.push(config({ padWidth: padLength, padHeight: padWidth5 }));
7064
7086
  }
7065
7087
  }
7066
7088
  } else {
7067
7089
  for (let i = 1; i <= params.num_pins; i++) {
7068
7090
  const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
7069
- pads.push(rectpad(i, x, y, padLength, padWidth4));
7091
+ pads.push(rectpad(i, x, y, padLength, padWidth5));
7070
7092
  }
7071
7093
  }
7072
7094
  const silkscreenPath1 = {
@@ -7095,7 +7117,7 @@ var generateSot457Elements = (params) => {
7095
7117
  const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
7096
7118
  const triangleHeight = params.wave ? 1 : 0.5;
7097
7119
  const triangleWidth = params.wave ? 0.7 : 0.3;
7098
- pin1Position.x -= params.wave ? padWidth4 : padWidth4 * 1.7;
7120
+ pin1Position.x -= params.wave ? padWidth5 : padWidth5 * 1.7;
7099
7121
  const pin1Indicator = {
7100
7122
  type: "pcb_silkscreen_path",
7101
7123
  layer: "top",
@@ -7957,7 +7979,7 @@ var m2host_def = base_def.extend({
7957
7979
  var m2host = (raw_params) => {
7958
7980
  const parameters = m2host_def.parse(raw_params);
7959
7981
  const pads = [];
7960
- const padWidth4 = 0.5 - 0.15;
7982
+ const padWidth5 = 0.5 - 0.15;
7961
7983
  const padLength = 1.5;
7962
7984
  const pitch = 0.5;
7963
7985
  const halfPitch = pitch / 2;
@@ -7972,7 +7994,7 @@ var m2host = (raw_params) => {
7972
7994
  const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
7973
7995
  const rightEdgeOffset = 0.5;
7974
7996
  const x = rightEdgeOffset - padLengthWithOffset / 2;
7975
- const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth4);
7997
+ const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth5);
7976
7998
  pad2.layer = isBottomLayer ? "bottom" : "top";
7977
7999
  pads.push(pad2);
7978
8000
  }