@tscircuit/footprinter 0.0.283 → 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: padSpacing3, padWidth: padWidth3, padHeight: padHeight3, padPitch: padPitch3, 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) * (padPitch3 / 2);
524
+ const halfRange = (numRows - 1) * (padPitch5 / 2);
525
525
  for (let i = 0; i < numRows; i++) {
526
- yPositions.push(halfRange - i * padPitch3);
526
+ yPositions.push(halfRange - i * padPitch5);
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, -padSpacing5 / 2, y, padWidth5, padHeight5));
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, padSpacing5 / 2, y, padWidth5, padHeight5)
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) + 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 = -padSpacing3 / 2;
563
+ const pin1X = -padSpacing5 / 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 - 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",
@@ -621,6 +621,38 @@ 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
+
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
+
624
656
  // src/fn/res.ts
625
657
  var getArrayCount = (parameters) => {
626
658
  const arrayValue = parameters.array ?? parameters.x;
@@ -660,6 +692,18 @@ var res = (rawParameters) => {
660
692
  parameters: rawParameters
661
693
  };
662
694
  }
695
+ if (arrayCount === 2 && imperialBase === "0603") {
696
+ return {
697
+ circuitJson: res0603Array2(rawParameters),
698
+ parameters: rawParameters
699
+ };
700
+ }
701
+ if (arrayCount === 4 && imperialBase === "0603") {
702
+ return {
703
+ circuitJson: res0603Array4(rawParameters),
704
+ parameters: rawParameters
705
+ };
706
+ }
663
707
  return { circuitJson: passive(rawParameters), parameters: rawParameters };
664
708
  };
665
709
 
@@ -3806,41 +3850,41 @@ var to92 = (raw_params) => {
3806
3850
  });
3807
3851
  const { p, id, od, w, h, inline } = parameters;
3808
3852
  const holeY = Number.parseFloat(h) / 2;
3809
- const padSpacing3 = Number.parseFloat(p);
3853
+ const padSpacing5 = Number.parseFloat(p);
3810
3854
  const holeDia = Number.parseFloat(id);
3811
3855
  const padDia = Number.parseFloat(od);
3812
- const padWidth3 = padDia;
3813
- const padHeight3 = padDia * (1.5 / 1.05);
3856
+ const padWidth5 = padDia;
3857
+ const padHeight5 = padDia * (1.5 / 1.05);
3814
3858
  let platedHoles = [];
3815
3859
  if (parameters.num_pins === 3) {
3816
3860
  if (inline) {
3817
3861
  platedHoles = [
3818
3862
  platedHoleWithRectPad(
3819
3863
  1,
3820
- -padSpacing3,
3821
- holeY - padSpacing3,
3864
+ -padSpacing5,
3865
+ holeY - padSpacing5,
3822
3866
  holeDia,
3823
3867
  padDia,
3824
- padHeight3,
3868
+ padHeight5,
3825
3869
  0,
3826
3870
  0
3827
3871
  ),
3828
- platedHolePill(2, 0, holeY - padSpacing3, holeDia, padWidth3, padHeight3),
3872
+ platedHolePill(2, 0, holeY - padSpacing5, holeDia, padWidth5, padHeight5),
3829
3873
  platedHolePill(
3830
3874
  3,
3831
- padSpacing3,
3832
- holeY - padSpacing3,
3875
+ padSpacing5,
3876
+ holeY - padSpacing5,
3833
3877
  holeDia,
3834
- padWidth3,
3835
- padHeight3
3878
+ padWidth5,
3879
+ padHeight5
3836
3880
  )
3837
3881
  ];
3838
3882
  } else {
3839
3883
  platedHoles = [
3840
3884
  platedHoleWithRectPad(
3841
3885
  1,
3842
- -padSpacing3,
3843
- holeY - padSpacing3,
3886
+ -padSpacing5,
3887
+ holeY - padSpacing5,
3844
3888
  holeDia,
3845
3889
  padDia,
3846
3890
  padDia,
@@ -3848,28 +3892,28 @@ var to92 = (raw_params) => {
3848
3892
  0
3849
3893
  ),
3850
3894
  platedhole(2, 0, holeY, holeDia, padDia),
3851
- platedhole(3, padSpacing3, holeY - padSpacing3, holeDia, padDia)
3895
+ platedhole(3, padSpacing5, holeY - padSpacing5, holeDia, padDia)
3852
3896
  ];
3853
3897
  }
3854
3898
  } else if (parameters.num_pins === 2) {
3855
3899
  platedHoles = [
3856
3900
  platedHoleWithRectPad(
3857
3901
  1,
3858
- -padSpacing3,
3859
- holeY - padSpacing3,
3902
+ -padSpacing5,
3903
+ holeY - padSpacing5,
3860
3904
  holeDia,
3861
- padWidth3,
3862
- padHeight3,
3905
+ padWidth5,
3906
+ padHeight5,
3863
3907
  0,
3864
3908
  0
3865
3909
  ),
3866
3910
  platedHolePill(
3867
3911
  2,
3868
- padSpacing3,
3869
- holeY - padSpacing3,
3912
+ padSpacing5,
3913
+ holeY - padSpacing5,
3870
3914
  holeDia,
3871
- padWidth3,
3872
- padHeight3
3915
+ padWidth5,
3916
+ padHeight5
3873
3917
  )
3874
3918
  ];
3875
3919
  } else {
@@ -4835,15 +4879,15 @@ var sot89_def = base_def.extend({
4835
4879
  var sot89_3 = (parameters) => {
4836
4880
  const pads = [];
4837
4881
  const padGap = Number.parseFloat(parameters.p);
4838
- const padWidth3 = Number.parseFloat(parameters.pw);
4882
+ const padWidth5 = Number.parseFloat(parameters.pw);
4839
4883
  const length51 = Number.parseFloat(parameters.w);
4840
- const padHeight3 = Number.parseFloat(parameters.pl);
4884
+ const padHeight5 = Number.parseFloat(parameters.pl);
4841
4885
  const centerExtra = 0.175;
4842
- const outerPadXShift = (padHeight3 - (padHeight3 + centerExtra)) / 2;
4886
+ const outerPadXShift = (padHeight5 - (padHeight5 + centerExtra)) / 2;
4843
4887
  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)
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)
4847
4891
  );
4848
4892
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
4849
4893
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -4882,7 +4926,7 @@ var sot89_3 = (parameters) => {
4882
4926
  var sot89_5 = (parameters) => {
4883
4927
  const pads = [];
4884
4928
  const padGap = Number.parseFloat(parameters.p);
4885
- const padWidth3 = Number.parseFloat(parameters.pw);
4929
+ const padWidth5 = Number.parseFloat(parameters.pw);
4886
4930
  const length51 = Number.parseFloat(parameters.w);
4887
4931
  pads.push(
4888
4932
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
@@ -6038,20 +6082,20 @@ var to92s_def = base_def.extend({
6038
6082
  var to92s_3 = (parameters) => {
6039
6083
  const { p, id, od, w, h } = parameters;
6040
6084
  const holeY = Number.parseFloat(h) / 2;
6041
- const padSpacing3 = Number.parseFloat(p);
6085
+ const padSpacing5 = Number.parseFloat(p);
6042
6086
  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)
6087
+ platedhole(1, -padSpacing5, holeY - padSpacing5, id, od),
6088
+ platedhole(2, 0, holeY - padSpacing5, id, od),
6089
+ platedhole(3, padSpacing5, holeY - padSpacing5, id, od)
6046
6090
  ];
6047
6091
  };
6048
6092
  var to92s_2 = (parameters) => {
6049
6093
  const { p, id, od, h } = parameters;
6050
6094
  const holeY = Number.parseFloat(h) / 2;
6051
- const padSpacing3 = Number.parseFloat(p);
6095
+ const padSpacing5 = Number.parseFloat(p);
6052
6096
  return [
6053
- platedhole(1, -padSpacing3, holeY - padSpacing3, id, od),
6054
- platedhole(2, padSpacing3, holeY - padSpacing3, id, od)
6097
+ platedhole(1, -padSpacing5, holeY - padSpacing5, id, od),
6098
+ platedhole(2, padSpacing5, holeY - padSpacing5, id, od)
6055
6099
  ];
6056
6100
  };
6057
6101
  var to92s = (raw_params) => {
@@ -6070,19 +6114,19 @@ var to92s = (raw_params) => {
6070
6114
  throw new Error("Invalid number of pins for TO-92");
6071
6115
  }
6072
6116
  const holeY = Number.parseFloat(parameters.h) / 2;
6073
- const padSpacing3 = Number.parseFloat(parameters.p);
6117
+ const padSpacing5 = Number.parseFloat(parameters.p);
6074
6118
  const silkscreenBody = {
6075
6119
  type: "pcb_silkscreen_path",
6076
6120
  layer: "top",
6077
6121
  pcb_component_id: "",
6078
6122
  route: [
6079
- { x: -holeY, y: holeY - padSpacing3 },
6123
+ { x: -holeY, y: holeY - padSpacing5 },
6080
6124
  { x: -1.9, y: 0 },
6081
6125
  { x: 1.9, y: 0 },
6082
- { x: holeY, y: holeY - padSpacing3 },
6126
+ { x: holeY, y: holeY - padSpacing5 },
6083
6127
  { x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6084
6128
  { x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
6085
- { x: -holeY, y: holeY - padSpacing3 }
6129
+ { x: -holeY, y: holeY - padSpacing5 }
6086
6130
  ],
6087
6131
  stroke_width: 0.1,
6088
6132
  pcb_silkscreen_path_id: ""
@@ -6861,13 +6905,13 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
6861
6905
  import { length as length45 } from "circuit-json";
6862
6906
  var solderjumper = (params) => {
6863
6907
  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);
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);
6868
6912
  const pads = [];
6869
6913
  for (let i = 0; i < num_pins; i++) {
6870
- pads.push(rectpad(i + 1, i * padSpacing3, 0, padWidth3, padHeight3));
6914
+ pads.push(rectpad(i + 1, i * padSpacing5, 0, padWidth5, padHeight5));
6871
6915
  }
6872
6916
  let traces = [];
6873
6917
  if (bridged) {
@@ -6877,11 +6921,11 @@ var solderjumper = (params) => {
6877
6921
  const from = pins[i];
6878
6922
  const to = pins[i + 1];
6879
6923
  if (typeof from === "number" && typeof to === "number" && !isNaN(from) && !isNaN(to)) {
6880
- const xCenterFrom = (from - 1) * padSpacing3;
6881
- const xCenterTo = (to - 1) * padSpacing3;
6924
+ const xCenterFrom = (from - 1) * padSpacing5;
6925
+ const xCenterTo = (to - 1) * padSpacing5;
6882
6926
  const directionMult = Math.sign(xCenterTo - xCenterFrom);
6883
- const x1 = xCenterFrom + directionMult * (padWidth3 / 2);
6884
- const x2 = xCenterTo - directionMult * (padWidth3 / 2);
6927
+ const x1 = xCenterFrom + directionMult * (padWidth5 / 2);
6928
+ const x2 = xCenterTo - directionMult * (padWidth5 / 2);
6885
6929
  traces.push({
6886
6930
  type: "pcb_trace",
6887
6931
  pcb_trace_id: "",
@@ -6908,9 +6952,9 @@ var solderjumper = (params) => {
6908
6952
  }
6909
6953
  }
6910
6954
  }
6911
- const outlineWidth = (num_pins - 1) * padSpacing3 + padWidth3 + 0.7;
6912
- const outlineHeight = padHeight3 + 1;
6913
- const outlineCenterX = (num_pins - 1) * padSpacing3 / 2;
6955
+ const outlineWidth = (num_pins - 1) * padSpacing5 + padWidth5 + 0.7;
6956
+ const outlineHeight = padHeight5 + 1;
6957
+ const outlineCenterX = (num_pins - 1) * padSpacing5 / 2;
6914
6958
  const outlineCenterY = 0;
6915
6959
  const silkscreenRect = {
6916
6960
  type: "pcb_silkscreen_path",
@@ -7011,40 +7055,40 @@ var generateSot457Elements = (params) => {
7011
7055
  const pads = [];
7012
7056
  const pitch = parseDimension(params.p);
7013
7057
  const padLength = parseDimension(params.pl);
7014
- const padWidth3 = parseDimension(params.pw);
7058
+ const padWidth5 = parseDimension(params.pw);
7015
7059
  const width = parseDimension(params.w);
7016
7060
  const height = parseDimension(params.h);
7017
7061
  if (params.wave) {
7018
7062
  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(
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(
7022
7066
  3,
7023
7067
  -pitch,
7024
7068
  0,
7025
7069
  parseDimension(params.pillw),
7026
7070
  parseDimension(params.pillh)
7027
7071
  ),
7028
- 4: ({ padWidth: padWidth4, padHeight: padHeight3 }) => pillpad(
7072
+ 4: ({ padWidth: padWidth6, padHeight: padHeight5 }) => pillpad(
7029
7073
  4,
7030
7074
  pitch,
7031
7075
  0,
7032
7076
  parseDimension(params.pillw),
7033
7077
  parseDimension(params.pillh)
7034
7078
  ),
7035
- 5: ({ padWidth: padWidth4, padHeight: padHeight3 }) => rectpad(5, pitch, pitch, padHeight3, padWidth4),
7036
- 6: ({ padWidth: padWidth4, padHeight: padHeight3 }) => rectpad(6, pitch, -pitch, padHeight3, padWidth4)
7079
+ 5: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(5, pitch, pitch, padHeight5, padWidth6),
7080
+ 6: ({ padWidth: padWidth6, padHeight: padHeight5 }) => rectpad(6, pitch, -pitch, padHeight5, padWidth6)
7037
7081
  };
7038
7082
  for (let i = 1; i <= params.num_pins; i++) {
7039
7083
  const config = pinConfigs[i];
7040
7084
  if (config) {
7041
- pads.push(config({ padWidth: padLength, padHeight: padWidth3 }));
7085
+ pads.push(config({ padWidth: padLength, padHeight: padWidth5 }));
7042
7086
  }
7043
7087
  }
7044
7088
  } else {
7045
7089
  for (let i = 1; i <= params.num_pins; i++) {
7046
7090
  const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
7047
- pads.push(rectpad(i, x, y, padLength, padWidth3));
7091
+ pads.push(rectpad(i, x, y, padLength, padWidth5));
7048
7092
  }
7049
7093
  }
7050
7094
  const silkscreenPath1 = {
@@ -7073,7 +7117,7 @@ var generateSot457Elements = (params) => {
7073
7117
  const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
7074
7118
  const triangleHeight = params.wave ? 1 : 0.5;
7075
7119
  const triangleWidth = params.wave ? 0.7 : 0.3;
7076
- pin1Position.x -= params.wave ? padWidth3 : padWidth3 * 1.7;
7120
+ pin1Position.x -= params.wave ? padWidth5 : padWidth5 * 1.7;
7077
7121
  const pin1Indicator = {
7078
7122
  type: "pcb_silkscreen_path",
7079
7123
  layer: "top",
@@ -7935,7 +7979,7 @@ var m2host_def = base_def.extend({
7935
7979
  var m2host = (raw_params) => {
7936
7980
  const parameters = m2host_def.parse(raw_params);
7937
7981
  const pads = [];
7938
- const padWidth3 = 0.5 - 0.15;
7982
+ const padWidth5 = 0.5 - 0.15;
7939
7983
  const padLength = 1.5;
7940
7984
  const pitch = 0.5;
7941
7985
  const halfPitch = pitch / 2;
@@ -7950,7 +7994,7 @@ var m2host = (raw_params) => {
7950
7994
  const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
7951
7995
  const rightEdgeOffset = 0.5;
7952
7996
  const x = rightEdgeOffset - padLengthWithOffset / 2;
7953
- const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth3);
7997
+ const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth5);
7954
7998
  pad2.layer = isBottomLayer ? "bottom" : "top";
7955
7999
  pads.push(pad2);
7956
8000
  }