@tscircuit/footprinter 0.0.158 → 0.0.160

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.d.ts CHANGED
@@ -1029,6 +1029,7 @@ type Footprinter = {
1029
1029
  smf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1030
1030
  smb: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1031
1031
  potentiometer: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "pw" | "ca">;
1032
+ electrolytic: () => FootprinterParamsBuilder<"d" | "p" | "id" | "od">;
1032
1033
  sod923: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1033
1034
  sod323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1034
1035
  sod80: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ __export(fn_exports, {
14
14
  dfn: () => dfn,
15
15
  diode: () => diode,
16
16
  dip: () => dip,
17
+ electrolytic: () => electrolytic,
17
18
  hc49: () => hc49,
18
19
  jst: () => jst,
19
20
  led: () => led,
@@ -3871,12 +3872,12 @@ var sot89_3 = (parameters) => {
3871
3872
  const pads = [];
3872
3873
  const padGap = Number.parseFloat(parameters.p);
3873
3874
  const padWidth = Number.parseFloat(parameters.pw);
3874
- const length42 = Number.parseFloat(parameters.w);
3875
+ const length44 = Number.parseFloat(parameters.w);
3875
3876
  const padHeight = Number.parseFloat(parameters.pl);
3876
3877
  pads.push(
3877
- rectpad(1, -length42 / 2, padGap, padHeight, padWidth),
3878
- rectpad(2, -length42 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
3879
- rectpad(3, -length42 / 2, -padGap, padHeight, padWidth)
3878
+ rectpad(1, -length44 / 2, padGap, padHeight, padWidth),
3879
+ rectpad(2, -length44 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
3880
+ rectpad(3, -length44 / 2, -padGap, padHeight, padWidth)
3880
3881
  );
3881
3882
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
3882
3883
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -3916,7 +3917,7 @@ var sot89_5 = (parameters) => {
3916
3917
  const pads = [];
3917
3918
  const padGap = Number.parseFloat(parameters.p);
3918
3919
  const padWidth = Number.parseFloat(parameters.pw);
3919
- const length42 = Number.parseFloat(parameters.w);
3920
+ const length44 = Number.parseFloat(parameters.w);
3920
3921
  pads.push(
3921
3922
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
3922
3923
  rectpad(2, -1.85, 1.5, 1.5, 0.7),
@@ -5704,11 +5705,12 @@ var sodWithoutParsing15 = (parameters) => {
5704
5705
  };
5705
5706
 
5706
5707
  // src/fn/solderjumper.ts
5708
+ import { length as length42 } from "circuit-json";
5707
5709
  var solderjumper = (params) => {
5708
5710
  const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
5709
- const padSpacing = p;
5710
- const padWidth = pw;
5711
- const padHeight = ph;
5711
+ const padSpacing = length42.parse(p);
5712
+ const padWidth = length42.parse(pw);
5713
+ const padHeight = length42.parse(ph);
5712
5714
  const traceWidth = Math.min(padHeight / 4, 0.5);
5713
5715
  const pads = [];
5714
5716
  for (let i = 0; i < num_pins; i++) {
@@ -5753,13 +5755,44 @@ var solderjumper = (params) => {
5753
5755
  }
5754
5756
  }
5755
5757
  }
5756
- const silk = silkscreenRef(
5757
- (num_pins - 1) * padSpacing / 2,
5758
- Number(padHeight) + 0.1,
5759
- 0.4
5760
- );
5758
+ const outlineWidth = (num_pins - 1) * padSpacing + padWidth + 0.7;
5759
+ const outlineHeight = padHeight + 1;
5760
+ const outlineCenterX = (num_pins - 1) * padSpacing / 2;
5761
+ const outlineCenterY = 0;
5762
+ const silkscreenRect = {
5763
+ type: "pcb_silkscreen_path",
5764
+ layer: "top",
5765
+ pcb_component_id: "",
5766
+ pcb_silkscreen_path_id: "outline",
5767
+ route: [
5768
+ {
5769
+ x: outlineCenterX - outlineWidth / 2,
5770
+ y: outlineCenterY - outlineHeight / 2
5771
+ },
5772
+ {
5773
+ x: outlineCenterX + outlineWidth / 2,
5774
+ y: outlineCenterY - outlineHeight / 2
5775
+ },
5776
+ {
5777
+ x: outlineCenterX + outlineWidth / 2,
5778
+ y: outlineCenterY + outlineHeight / 2
5779
+ },
5780
+ {
5781
+ x: outlineCenterX - outlineWidth / 2,
5782
+ y: outlineCenterY + outlineHeight / 2
5783
+ },
5784
+ {
5785
+ x: outlineCenterX - outlineWidth / 2,
5786
+ y: outlineCenterY - outlineHeight / 2
5787
+ }
5788
+ ],
5789
+ stroke_width: 0.15
5790
+ };
5791
+ const refOffset = 0.6;
5792
+ const refY = outlineCenterY + outlineHeight / 2 + refOffset;
5793
+ const silk = silkscreenRef(outlineCenterX, refY, 0.4);
5761
5794
  return {
5762
- circuitJson: [...pads, ...traces, silk],
5795
+ circuitJson: [...pads, ...traces, silkscreenRect, silk],
5763
5796
  parameters: params
5764
5797
  };
5765
5798
  };
@@ -5842,6 +5875,122 @@ var potentiometer = (raw_params) => {
5842
5875
  };
5843
5876
  };
5844
5877
 
5878
+ // src/fn/electrolytic.ts
5879
+ import {
5880
+ length as length43
5881
+ } from "circuit-json";
5882
+ import { z as z53 } from "zod";
5883
+ var electrolytic_def = z53.object({
5884
+ fn: z53.string(),
5885
+ p: length43.optional().default("7.5mm"),
5886
+ id: length43.optional().default("1mm"),
5887
+ od: length43.optional().default("2mm"),
5888
+ d: length43.optional().default("10.5mm")
5889
+ });
5890
+ var generate_circle_arcs = (centerX, centerY, radius, cut, cutHeight) => {
5891
+ const topArc = [];
5892
+ const bottomArc = [];
5893
+ for (let i = 0; i <= 50; i++) {
5894
+ const theta = i / 50 * Math.PI;
5895
+ const x = centerX + Math.cos(theta) * radius;
5896
+ const y = centerY + Math.sin(theta) * radius;
5897
+ if (x < centerX - cut && y >= centerY - cutHeight / 2 && y <= centerY + cutHeight / 2) {
5898
+ continue;
5899
+ }
5900
+ topArc.push({ x, y });
5901
+ }
5902
+ for (let i = 0; i <= 50; i++) {
5903
+ const theta = Math.PI + i / 50 * Math.PI;
5904
+ const x = centerX + Math.cos(theta) * radius;
5905
+ const y = centerY + Math.sin(theta) * radius;
5906
+ if (x < centerX - cut && y >= centerY - cutHeight / 2 && y <= centerY + cutHeight / 2) {
5907
+ continue;
5908
+ }
5909
+ bottomArc.push({ x, y });
5910
+ }
5911
+ return { topArc, bottomArc };
5912
+ };
5913
+ var electrolytic = (raw_params) => {
5914
+ const parameters = electrolytic_def.parse(raw_params);
5915
+ const { p, id, od, d } = parameters;
5916
+ const plated_holes = [
5917
+ platedhole(1, -p / 2, 0, id, od),
5918
+ platedhole(2, p / 2, 0, id, od)
5919
+ ];
5920
+ const { topArc, bottomArc } = generate_circle_arcs(
5921
+ 0,
5922
+ 0,
5923
+ d / 2 + 0.1,
5924
+ od / 2,
5925
+ od
5926
+ );
5927
+ const silkscreenBody2 = {
5928
+ type: "pcb_silkscreen_path",
5929
+ layer: "top",
5930
+ pcb_component_id: "",
5931
+ route: topArc,
5932
+ stroke_width: 0.1,
5933
+ pcb_silkscreen_path_id: ""
5934
+ };
5935
+ const silkscreenBody3 = {
5936
+ type: "pcb_silkscreen_path",
5937
+ layer: "top",
5938
+ pcb_component_id: "",
5939
+ route: bottomArc,
5940
+ stroke_width: 0.1,
5941
+ pcb_silkscreen_path_id: ""
5942
+ };
5943
+ const silkscreenBody = {
5944
+ type: "pcb_silkscreen_path",
5945
+ layer: "top",
5946
+ pcb_component_id: "",
5947
+ route: [
5948
+ { x: 0, y: d / 2 + 0.1 },
5949
+ { x: 0, y: -(d / 2 + 0.1) }
5950
+ ],
5951
+ stroke_width: 0.1,
5952
+ pcb_silkscreen_path_id: ""
5953
+ };
5954
+ const X = -(d / 2 + 0.5);
5955
+ const plusY = od / 2 + 1.5;
5956
+ const Size = 0.5;
5957
+ const silkscreenpath3 = {
5958
+ type: "pcb_silkscreen_path",
5959
+ layer: "top",
5960
+ pcb_component_id: "",
5961
+ route: [
5962
+ { x: X - Size, y: plusY },
5963
+ { x: X + Size, y: plusY }
5964
+ ],
5965
+ stroke_width: 0.1,
5966
+ pcb_silkscreen_path_id: ""
5967
+ };
5968
+ const silkscreenline = {
5969
+ type: "pcb_silkscreen_path",
5970
+ layer: "top",
5971
+ pcb_component_id: "",
5972
+ route: [
5973
+ { x: X, y: plusY - Size },
5974
+ { x: X, y: plusY + Size }
5975
+ ],
5976
+ stroke_width: 0.1,
5977
+ pcb_silkscreen_path_id: ""
5978
+ };
5979
+ const silkscreenRefText = silkscreenRef(0, d / 2 + 1, 0.5);
5980
+ return {
5981
+ circuitJson: [
5982
+ ...plated_holes,
5983
+ silkscreenBody2,
5984
+ silkscreenBody3,
5985
+ silkscreenBody,
5986
+ silkscreenpath3,
5987
+ silkscreenline,
5988
+ silkscreenRefText
5989
+ ],
5990
+ parameters
5991
+ };
5992
+ };
5993
+
5845
5994
  // src/helpers/is-not-null.ts
5846
5995
  function isNotNull(value) {
5847
5996
  return value !== null;