@tscircuit/footprinter 0.0.283 → 0.0.284

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: padSpacing3, padWidth: padWidth3, padHeight: padHeight3, padPitch: padPitch3, numRows, textbottom } = params;
522
+ const { padSpacing: padSpacing4, padWidth: padWidth4, padHeight: padHeight4, padPitch: padPitch4, numRows, textbottom } = params;
523
523
  const yPositions = [];
524
- const halfRange = (numRows - 1) * (padPitch3 / 2);
524
+ const halfRange = (numRows - 1) * (padPitch4 / 2);
525
525
  for (let i = 0; i < numRows; i++) {
526
- yPositions.push(halfRange - i * padPitch3);
526
+ yPositions.push(halfRange - i * padPitch4);
527
527
  }
528
528
  const pads = [];
529
529
  yPositions.forEach((y, index) => {
530
- pads.push(rectpad(index + 1, -padSpacing3 / 2, y, padWidth3, padHeight3));
530
+ pads.push(rectpad(index + 1, -padSpacing4 / 2, y, padWidth4, padHeight4));
531
531
  });
532
532
  yPositions.slice().reverse().forEach((y, index) => {
533
533
  pads.push(
534
- rectpad(index + numRows + 1, padSpacing3 / 2, y, padWidth3, padHeight3)
534
+ rectpad(index + numRows + 1, padSpacing4 / 2, y, padWidth4, padHeight4)
535
535
  );
536
536
  });
537
- const top = Math.max(...yPositions) + padHeight3 / 2 + 0.4;
538
- const bottom = Math.min(...yPositions) - padHeight3 / 2 - 0.4;
539
- const left = -padSpacing3 / 2 - padWidth3 / 2 - 0.4;
540
- const right = padSpacing3 / 2 + padWidth3 / 2 + 0.4;
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;
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 = -padSpacing3 / 2;
563
+ const pin1X = -padSpacing4 / 2;
564
564
  const pin1Y = Math.max(...yPositions);
565
565
  const pin1MarkerSize = 0.2;
566
- const pin1Left = pin1X - padWidth3 / 2 - 0.1;
567
- const pin1Top = pin1Y + padHeight3 / 2 + 0.1;
566
+ const pin1Left = pin1X - padWidth4 / 2 - 0.1;
567
+ const pin1Top = pin1Y + padHeight4 / 2 + 0.1;
568
568
  const pin1Marker = {
569
569
  type: "pcb_silkscreen_path",
570
570
  layer: "top",
@@ -621,6 +621,22 @@ var res0402Array4 = (params) => {
621
621
  });
622
622
  };
623
623
 
624
+ // src/helpers/res0603-array2.ts
625
+ var padSpacing3 = 1.7;
626
+ var padWidth3 = 0.9;
627
+ var padHeight3 = 0.4;
628
+ var padPitch3 = 0.8;
629
+ var res0603Array2 = (params) => {
630
+ return chipArray({
631
+ padSpacing: padSpacing3,
632
+ padWidth: padWidth3,
633
+ padHeight: padHeight3,
634
+ padPitch: padPitch3,
635
+ numRows: 2,
636
+ textbottom: params.textbottom
637
+ });
638
+ };
639
+
624
640
  // src/fn/res.ts
625
641
  var getArrayCount = (parameters) => {
626
642
  const arrayValue = parameters.array ?? parameters.x;
@@ -660,6 +676,12 @@ var res = (rawParameters) => {
660
676
  parameters: rawParameters
661
677
  };
662
678
  }
679
+ if (arrayCount === 2 && imperialBase === "0603") {
680
+ return {
681
+ circuitJson: res0603Array2(rawParameters),
682
+ parameters: rawParameters
683
+ };
684
+ }
663
685
  return { circuitJson: passive(rawParameters), parameters: rawParameters };
664
686
  };
665
687
 
@@ -3806,41 +3828,41 @@ var to92 = (raw_params) => {
3806
3828
  });
3807
3829
  const { p, id, od, w, h, inline } = parameters;
3808
3830
  const holeY = Number.parseFloat(h) / 2;
3809
- const padSpacing3 = Number.parseFloat(p);
3831
+ const padSpacing4 = Number.parseFloat(p);
3810
3832
  const holeDia = Number.parseFloat(id);
3811
3833
  const padDia = Number.parseFloat(od);
3812
- const padWidth3 = padDia;
3813
- const padHeight3 = padDia * (1.5 / 1.05);
3834
+ const padWidth4 = padDia;
3835
+ const padHeight4 = padDia * (1.5 / 1.05);
3814
3836
  let platedHoles = [];
3815
3837
  if (parameters.num_pins === 3) {
3816
3838
  if (inline) {
3817
3839
  platedHoles = [
3818
3840
  platedHoleWithRectPad(
3819
3841
  1,
3820
- -padSpacing3,
3821
- holeY - padSpacing3,
3842
+ -padSpacing4,
3843
+ holeY - padSpacing4,
3822
3844
  holeDia,
3823
3845
  padDia,
3824
- padHeight3,
3846
+ padHeight4,
3825
3847
  0,
3826
3848
  0
3827
3849
  ),
3828
- platedHolePill(2, 0, holeY - padSpacing3, holeDia, padWidth3, padHeight3),
3850
+ platedHolePill(2, 0, holeY - padSpacing4, holeDia, padWidth4, padHeight4),
3829
3851
  platedHolePill(
3830
3852
  3,
3831
- padSpacing3,
3832
- holeY - padSpacing3,
3853
+ padSpacing4,
3854
+ holeY - padSpacing4,
3833
3855
  holeDia,
3834
- padWidth3,
3835
- padHeight3
3856
+ padWidth4,
3857
+ padHeight4
3836
3858
  )
3837
3859
  ];
3838
3860
  } else {
3839
3861
  platedHoles = [
3840
3862
  platedHoleWithRectPad(
3841
3863
  1,
3842
- -padSpacing3,
3843
- holeY - padSpacing3,
3864
+ -padSpacing4,
3865
+ holeY - padSpacing4,
3844
3866
  holeDia,
3845
3867
  padDia,
3846
3868
  padDia,
@@ -3848,28 +3870,28 @@ var to92 = (raw_params) => {
3848
3870
  0
3849
3871
  ),
3850
3872
  platedhole(2, 0, holeY, holeDia, padDia),
3851
- platedhole(3, padSpacing3, holeY - padSpacing3, holeDia, padDia)
3873
+ platedhole(3, padSpacing4, holeY - padSpacing4, holeDia, padDia)
3852
3874
  ];
3853
3875
  }
3854
3876
  } else if (parameters.num_pins === 2) {
3855
3877
  platedHoles = [
3856
3878
  platedHoleWithRectPad(
3857
3879
  1,
3858
- -padSpacing3,
3859
- holeY - padSpacing3,
3880
+ -padSpacing4,
3881
+ holeY - padSpacing4,
3860
3882
  holeDia,
3861
- padWidth3,
3862
- padHeight3,
3883
+ padWidth4,
3884
+ padHeight4,
3863
3885
  0,
3864
3886
  0
3865
3887
  ),
3866
3888
  platedHolePill(
3867
3889
  2,
3868
- padSpacing3,
3869
- holeY - padSpacing3,
3890
+ padSpacing4,
3891
+ holeY - padSpacing4,
3870
3892
  holeDia,
3871
- padWidth3,
3872
- padHeight3
3893
+ padWidth4,
3894
+ padHeight4
3873
3895
  )
3874
3896
  ];
3875
3897
  } else {
@@ -4835,15 +4857,15 @@ var sot89_def = base_def.extend({
4835
4857
  var sot89_3 = (parameters) => {
4836
4858
  const pads = [];
4837
4859
  const padGap = Number.parseFloat(parameters.p);
4838
- const padWidth3 = Number.parseFloat(parameters.pw);
4860
+ const padWidth4 = Number.parseFloat(parameters.pw);
4839
4861
  const length51 = Number.parseFloat(parameters.w);
4840
- const padHeight3 = Number.parseFloat(parameters.pl);
4862
+ const padHeight4 = Number.parseFloat(parameters.pl);
4841
4863
  const centerExtra = 0.175;
4842
- const outerPadXShift = (padHeight3 - (padHeight3 + centerExtra)) / 2;
4864
+ const outerPadXShift = (padHeight4 - (padHeight4 + centerExtra)) / 2;
4843
4865
  pads.push(
4844
- rectpad(1, -length51 / 2 + outerPadXShift, padGap, padHeight3, padWidth3),
4845
- rectpad(2, -length51 / 2, 0, padHeight3 + centerExtra, padWidth3),
4846
- rectpad(3, -length51 / 2 + outerPadXShift, -padGap, padHeight3, padWidth3)
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)
4847
4869
  );
4848
4870
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
4849
4871
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -4882,7 +4904,7 @@ var sot89_3 = (parameters) => {
4882
4904
  var sot89_5 = (parameters) => {
4883
4905
  const pads = [];
4884
4906
  const padGap = Number.parseFloat(parameters.p);
4885
- const padWidth3 = Number.parseFloat(parameters.pw);
4907
+ const padWidth4 = Number.parseFloat(parameters.pw);
4886
4908
  const length51 = Number.parseFloat(parameters.w);
4887
4909
  pads.push(
4888
4910
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
@@ -6038,20 +6060,20 @@ var to92s_def = base_def.extend({
6038
6060
  var to92s_3 = (parameters) => {
6039
6061
  const { p, id, od, w, h } = parameters;
6040
6062
  const holeY = Number.parseFloat(h) / 2;
6041
- const padSpacing3 = Number.parseFloat(p);
6063
+ const padSpacing4 = Number.parseFloat(p);
6042
6064
  return [
6043
- platedhole(1, -padSpacing3, holeY - padSpacing3, id, od),
6044
- platedhole(2, 0, holeY - padSpacing3, id, od),
6045
- platedhole(3, padSpacing3, holeY - padSpacing3, id, od)
6065
+ platedhole(1, -padSpacing4, holeY - padSpacing4, id, od),
6066
+ platedhole(2, 0, holeY - padSpacing4, id, od),
6067
+ platedhole(3, padSpacing4, holeY - padSpacing4, id, od)
6046
6068
  ];
6047
6069
  };
6048
6070
  var to92s_2 = (parameters) => {
6049
6071
  const { p, id, od, h } = parameters;
6050
6072
  const holeY = Number.parseFloat(h) / 2;
6051
- const padSpacing3 = Number.parseFloat(p);
6073
+ const padSpacing4 = Number.parseFloat(p);
6052
6074
  return [
6053
- platedhole(1, -padSpacing3, holeY - padSpacing3, id, od),
6054
- platedhole(2, padSpacing3, holeY - padSpacing3, id, od)
6075
+ platedhole(1, -padSpacing4, holeY - padSpacing4, id, od),
6076
+ platedhole(2, padSpacing4, holeY - padSpacing4, id, od)
6055
6077
  ];
6056
6078
  };
6057
6079
  var to92s = (raw_params) => {
@@ -6070,19 +6092,19 @@ var to92s = (raw_params) => {
6070
6092
  throw new Error("Invalid number of pins for TO-92");
6071
6093
  }
6072
6094
  const holeY = Number.parseFloat(parameters.h) / 2;
6073
- const padSpacing3 = Number.parseFloat(parameters.p);
6095
+ const padSpacing4 = Number.parseFloat(parameters.p);
6074
6096
  const silkscreenBody = {
6075
6097
  type: "pcb_silkscreen_path",
6076
6098
  layer: "top",
6077
6099
  pcb_component_id: "",
6078
6100
  route: [
6079
- { x: -holeY, y: holeY - padSpacing3 },
6101
+ { x: -holeY, y: holeY - padSpacing4 },
6080
6102
  { x: -1.9, y: 0 },
6081
6103
  { x: 1.9, y: 0 },
6082
- { x: holeY, y: holeY - padSpacing3 },
6104
+ { x: holeY, y: holeY - padSpacing4 },
6083
6105
  { x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6084
6106
  { x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6085
- { x: -holeY, y: holeY - padSpacing3 }
6107
+ { x: -holeY, y: holeY - padSpacing4 }
6086
6108
  ],
6087
6109
  stroke_width: 0.1,
6088
6110
  pcb_silkscreen_path_id: ""
@@ -6861,13 +6883,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
6861
6883
  import { length as length45 } from "circuit-json";
6862
6884
  var solderjumper = (params) => {
6863
6885
  const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
6864
- const padSpacing3 = length45.parse(p);
6865
- const padWidth3 = length45.parse(pw);
6866
- const padHeight3 = length45.parse(ph);
6867
- const traceWidth = Math.min(padHeight3 / 4, 0.5);
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);
6868
6890
  const pads = [];
6869
6891
  for (let i = 0; i < num_pins; i++) {
6870
- pads.push(rectpad(i + 1, i * padSpacing3, 0, padWidth3, padHeight3));
6892
+ pads.push(rectpad(i + 1, i * padSpacing4, 0, padWidth4, padHeight4));
6871
6893
  }
6872
6894
  let traces = [];
6873
6895
  if (bridged) {
@@ -6877,11 +6899,11 @@ var solderjumper = (params) => {
6877
6899
  const from = pins[i];
6878
6900
  const to = pins[i + 1];
6879
6901
  if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
6880
- const xCenterFrom = (from - 1) * padSpacing3;
6881
- const xCenterTo = (to - 1) * padSpacing3;
6902
+ const xCenterFrom = (from - 1) * padSpacing4;
6903
+ const xCenterTo = (to - 1) * padSpacing4;
6882
6904
  const directionMult = Math.sign(xCenterTo - xCenterFrom);
6883
- const x1 = xCenterFrom + directionMult * (padWidth3 / 2);
6884
- const x2 = xCenterTo - directionMult * (padWidth3 / 2);
6905
+ const x1 = xCenterFrom + directionMult * (padWidth4 / 2);
6906
+ const x2 = xCenterTo - directionMult * (padWidth4 / 2);
6885
6907
  traces.push({
6886
6908
  type: "pcb_trace",
6887
6909
  pcb_trace_id: "",
@@ -6908,9 +6930,9 @@ var solderjumper = (params) => {
6908
6930
  }
6909
6931
  }
6910
6932
  }
6911
- const outlineWidth = (num_pins - 1) * padSpacing3 + padWidth3 + 0.7;
6912
- const outlineHeight = padHeight3 + 1;
6913
- const outlineCenterX = (num_pins - 1) * padSpacing3 / 2;
6933
+ const outlineWidth = (num_pins - 1) * padSpacing4 + padWidth4 + 0.7;
6934
+ const outlineHeight = padHeight4 + 1;
6935
+ const outlineCenterX = (num_pins - 1) * padSpacing4 / 2;
6914
6936
  const outlineCenterY = 0;
6915
6937
  const silkscreenRect = {
6916
6938
  type: "pcb_silkscreen_path",
@@ -7011,40 +7033,40 @@ var generateSot457Elements = (params) => {
7011
7033
  const pads = [];
7012
7034
  const pitch = parseDimension(params.p);
7013
7035
  const padLength = parseDimension(params.pl);
7014
- const padWidth3 = parseDimension(params.pw);
7036
+ const padWidth4 = parseDimension(params.pw);
7015
7037
  const width = parseDimension(params.w);
7016
7038
  const height = parseDimension(params.h);
7017
7039
  if (params.wave) {
7018
7040
  const pinConfigs = {
7019
- 1: ({ padWidth: padWidth4, padHeight: padHeight3 }) => rectpad(1, -pitch, pitch, padHeight3, padWidth4),
7020
- 2: ({ padWidth: padWidth4, padHeight: padHeight3 }) => rectpad(2, -pitch, -pitch, padHeight3, padWidth4),
7021
- 3: ({ padWidth: padWidth4, padHeight: padHeight3 }) => pillpad(
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(
7022
7044
  3,
7023
7045
  -pitch,
7024
7046
  0,
7025
7047
  parseDimension(params.pillw),
7026
7048
  parseDimension(params.pillh)
7027
7049
  ),
7028
- 4: ({ padWidth: padWidth4, padHeight: padHeight3 }) => pillpad(
7050
+ 4: ({ padWidth: padWidth5, padHeight: padHeight4 }) => pillpad(
7029
7051
  4,
7030
7052
  pitch,
7031
7053
  0,
7032
7054
  parseDimension(params.pillw),
7033
7055
  parseDimension(params.pillh)
7034
7056
  ),
7035
- 5: ({ padWidth: padWidth4, padHeight: padHeight3 }) => rectpad(5, pitch, pitch, padHeight3, padWidth4),
7036
- 6: ({ padWidth: padWidth4, padHeight: padHeight3 }) => rectpad(6, pitch, -pitch, padHeight3, padWidth4)
7057
+ 5: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(5, pitch, pitch, padHeight4, padWidth5),
7058
+ 6: ({ padWidth: padWidth5, padHeight: padHeight4 }) => rectpad(6, pitch, -pitch, padHeight4, padWidth5)
7037
7059
  };
7038
7060
  for (let i = 1; i <= params.num_pins; i++) {
7039
7061
  const config = pinConfigs[i];
7040
7062
  if (config) {
7041
- pads.push(config({ padWidth: padLength, padHeight: padWidth3 }));
7063
+ pads.push(config({ padWidth: padLength, padHeight: padWidth4 }));
7042
7064
  }
7043
7065
  }
7044
7066
  } else {
7045
7067
  for (let i = 1; i <= params.num_pins; i++) {
7046
7068
  const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
7047
- pads.push(rectpad(i, x, y, padLength, padWidth3));
7069
+ pads.push(rectpad(i, x, y, padLength, padWidth4));
7048
7070
  }
7049
7071
  }
7050
7072
  const silkscreenPath1 = {
@@ -7073,7 +7095,7 @@ var generateSot457Elements = (params) => {
7073
7095
  const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
7074
7096
  const triangleHeight = params.wave ? 1 : 0.5;
7075
7097
  const triangleWidth = params.wave ? 0.7 : 0.3;
7076
- pin1Position.x -= params.wave ? padWidth3 : padWidth3 * 1.7;
7098
+ pin1Position.x -= params.wave ? padWidth4 : padWidth4 * 1.7;
7077
7099
  const pin1Indicator = {
7078
7100
  type: "pcb_silkscreen_path",
7079
7101
  layer: "top",
@@ -7935,7 +7957,7 @@ var m2host_def = base_def.extend({
7935
7957
  var m2host = (raw_params) => {
7936
7958
  const parameters = m2host_def.parse(raw_params);
7937
7959
  const pads = [];
7938
- const padWidth3 = 0.5 - 0.15;
7960
+ const padWidth4 = 0.5 - 0.15;
7939
7961
  const padLength = 1.5;
7940
7962
  const pitch = 0.5;
7941
7963
  const halfPitch = pitch / 2;
@@ -7950,7 +7972,7 @@ var m2host = (raw_params) => {
7950
7972
  const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
7951
7973
  const rightEdgeOffset = 0.5;
7952
7974
  const x = rightEdgeOffset - padLengthWithOffset / 2;
7953
- const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth3);
7975
+ const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth4);
7954
7976
  pad2.layer = isBottomLayer ? "bottom" : "top";
7955
7977
  pads.push(pad2);
7956
7978
  }