@tscircuit/footprinter 0.0.159 → 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 +1 -0
- package/dist/index.js +122 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
3875
|
+
const length44 = Number.parseFloat(parameters.w);
|
|
3875
3876
|
const padHeight = Number.parseFloat(parameters.pl);
|
|
3876
3877
|
pads.push(
|
|
3877
|
-
rectpad(1, -
|
|
3878
|
-
rectpad(2, -
|
|
3879
|
-
rectpad(3, -
|
|
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
|
|
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),
|
|
@@ -5874,6 +5875,122 @@ var potentiometer = (raw_params) => {
|
|
|
5874
5875
|
};
|
|
5875
5876
|
};
|
|
5876
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
|
+
|
|
5877
5994
|
// src/helpers/is-not-null.ts
|
|
5878
5995
|
function isNotNull(value) {
|
|
5879
5996
|
return value !== null;
|