@tscircuit/footprinter 0.0.159 → 0.0.161
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 +2 -0
- package/dist/index.js +248 -20
- 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">;
|
|
@@ -1047,6 +1048,7 @@ type Footprinter = {
|
|
|
1047
1048
|
to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
|
|
1048
1049
|
to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
|
|
1049
1050
|
sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1051
|
+
son: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw" | "epw" | "eph" | "ep">;
|
|
1050
1052
|
vssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1051
1053
|
msop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1052
1054
|
sot23w: () => 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,
|
|
@@ -55,6 +56,7 @@ __export(fn_exports, {
|
|
|
55
56
|
sod923: () => sod923,
|
|
56
57
|
soic: () => soic,
|
|
57
58
|
solderjumper: () => solderjumper,
|
|
59
|
+
son: () => son,
|
|
58
60
|
sop8: () => sop8,
|
|
59
61
|
sot223: () => sot223,
|
|
60
62
|
sot23: () => sot23,
|
|
@@ -3871,12 +3873,12 @@ var sot89_3 = (parameters) => {
|
|
|
3871
3873
|
const pads = [];
|
|
3872
3874
|
const padGap = Number.parseFloat(parameters.p);
|
|
3873
3875
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
3874
|
-
const
|
|
3876
|
+
const length45 = Number.parseFloat(parameters.w);
|
|
3875
3877
|
const padHeight = Number.parseFloat(parameters.pl);
|
|
3876
3878
|
pads.push(
|
|
3877
|
-
rectpad(1, -
|
|
3878
|
-
rectpad(2, -
|
|
3879
|
-
rectpad(3, -
|
|
3879
|
+
rectpad(1, -length45 / 2, padGap, padHeight, padWidth),
|
|
3880
|
+
rectpad(2, -length45 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
|
|
3881
|
+
rectpad(3, -length45 / 2, -padGap, padHeight, padWidth)
|
|
3880
3882
|
);
|
|
3881
3883
|
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
3882
3884
|
const width = Number.parseFloat(parameters.w) / 2 - 1;
|
|
@@ -3916,7 +3918,7 @@ var sot89_5 = (parameters) => {
|
|
|
3916
3918
|
const pads = [];
|
|
3917
3919
|
const padGap = Number.parseFloat(parameters.p);
|
|
3918
3920
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
3919
|
-
const
|
|
3921
|
+
const length45 = Number.parseFloat(parameters.w);
|
|
3920
3922
|
pads.push(
|
|
3921
3923
|
rectpad(1, -1.85, -1.5, 1.5, 0.7),
|
|
3922
3924
|
rectpad(2, -1.85, 1.5, 1.5, 0.7),
|
|
@@ -5703,13 +5705,123 @@ var sodWithoutParsing15 = (parameters) => {
|
|
|
5703
5705
|
return pads;
|
|
5704
5706
|
};
|
|
5705
5707
|
|
|
5706
|
-
// src/fn/
|
|
5708
|
+
// src/fn/son.ts
|
|
5709
|
+
import { z as z52 } from "zod";
|
|
5707
5710
|
import { length as length42 } from "circuit-json";
|
|
5711
|
+
var son_def = z52.object({
|
|
5712
|
+
fn: z52.string(),
|
|
5713
|
+
num_pins: z52.literal(8).default(8),
|
|
5714
|
+
w: z52.string().default("3mm"),
|
|
5715
|
+
h: z52.string().default("3mm"),
|
|
5716
|
+
p: z52.string().default("0.5mm"),
|
|
5717
|
+
pl: z52.string().default("0.52mm"),
|
|
5718
|
+
pw: z52.string().default("0.35mm"),
|
|
5719
|
+
epw: z52.string().default("1.40mm"),
|
|
5720
|
+
eph: z52.string().default("1.60mm"),
|
|
5721
|
+
string: z52.string().optional(),
|
|
5722
|
+
ep: z52.boolean().default(false)
|
|
5723
|
+
});
|
|
5724
|
+
var son = (raw_params) => {
|
|
5725
|
+
if (raw_params.string && raw_params.string.includes("_ep")) {
|
|
5726
|
+
raw_params.ep = true;
|
|
5727
|
+
}
|
|
5728
|
+
const parameters = son_def.parse(raw_params);
|
|
5729
|
+
const w = length42.parse(parameters.w);
|
|
5730
|
+
const h = length42.parse(parameters.h);
|
|
5731
|
+
const p = length42.parse(parameters.p);
|
|
5732
|
+
const pl = length42.parse(parameters.pl);
|
|
5733
|
+
const pw = length42.parse(parameters.pw);
|
|
5734
|
+
const epw = length42.parse(parameters.epw);
|
|
5735
|
+
const eph = length42.parse(parameters.eph);
|
|
5736
|
+
const pads = [];
|
|
5737
|
+
for (let i = 0; i < parameters.num_pins; i++) {
|
|
5738
|
+
const { x, y } = getSonPadCoord(parameters.num_pins, i + 1, w, p);
|
|
5739
|
+
pads.push(rectpad(i + 1, x, y, pl, pw));
|
|
5740
|
+
}
|
|
5741
|
+
if (parameters.ep) {
|
|
5742
|
+
pads.push(rectpad(parameters.num_pins + 1, 0, 0, epw, eph));
|
|
5743
|
+
}
|
|
5744
|
+
const silkscreenBoxWidth = w;
|
|
5745
|
+
const silkscreenBoxHeight = h;
|
|
5746
|
+
const silkscreenTopLine = {
|
|
5747
|
+
type: "pcb_silkscreen_path",
|
|
5748
|
+
layer: "top",
|
|
5749
|
+
pcb_component_id: "",
|
|
5750
|
+
route: [
|
|
5751
|
+
{ x: -silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 },
|
|
5752
|
+
{ x: silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 }
|
|
5753
|
+
],
|
|
5754
|
+
stroke_width: 0.05,
|
|
5755
|
+
pcb_silkscreen_path_id: ""
|
|
5756
|
+
};
|
|
5757
|
+
const silkscreenBottomLine = {
|
|
5758
|
+
type: "pcb_silkscreen_path",
|
|
5759
|
+
layer: "top",
|
|
5760
|
+
pcb_component_id: "",
|
|
5761
|
+
route: [
|
|
5762
|
+
{ x: -silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 },
|
|
5763
|
+
{ x: silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 }
|
|
5764
|
+
],
|
|
5765
|
+
stroke_width: 0.05,
|
|
5766
|
+
pcb_silkscreen_path_id: ""
|
|
5767
|
+
};
|
|
5768
|
+
const pin1Position = getSonPadCoord(
|
|
5769
|
+
parameters.num_pins,
|
|
5770
|
+
1,
|
|
5771
|
+
silkscreenBoxWidth,
|
|
5772
|
+
p
|
|
5773
|
+
);
|
|
5774
|
+
const pin1MarkerPosition = {
|
|
5775
|
+
x: pin1Position.x - 0.4,
|
|
5776
|
+
y: pin1Position.y
|
|
5777
|
+
};
|
|
5778
|
+
const pin1Marking = {
|
|
5779
|
+
type: "pcb_silkscreen_path",
|
|
5780
|
+
layer: "top",
|
|
5781
|
+
pcb_component_id: "pin_marker_1",
|
|
5782
|
+
route: [
|
|
5783
|
+
{ x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y },
|
|
5784
|
+
{ x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y + 0.3 },
|
|
5785
|
+
{ x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y - 0.3 },
|
|
5786
|
+
{ x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y }
|
|
5787
|
+
],
|
|
5788
|
+
stroke_width: 0.05,
|
|
5789
|
+
pcb_silkscreen_path_id: "pin_marker_1"
|
|
5790
|
+
};
|
|
5791
|
+
const silkscreenRefText = silkscreenRef(
|
|
5792
|
+
0,
|
|
5793
|
+
silkscreenBoxHeight / 2 + 0.5,
|
|
5794
|
+
0.3
|
|
5795
|
+
);
|
|
5796
|
+
return {
|
|
5797
|
+
circuitJson: [
|
|
5798
|
+
...pads,
|
|
5799
|
+
silkscreenTopLine,
|
|
5800
|
+
silkscreenBottomLine,
|
|
5801
|
+
silkscreenRefText,
|
|
5802
|
+
pin1Marking
|
|
5803
|
+
],
|
|
5804
|
+
parameters
|
|
5805
|
+
};
|
|
5806
|
+
};
|
|
5807
|
+
var getSonPadCoord = (num_pins, pn, w, p) => {
|
|
5808
|
+
const half = num_pins / 2;
|
|
5809
|
+
const rowIndex = (pn - 1) % half;
|
|
5810
|
+
const col = pn <= half ? -1 : 1;
|
|
5811
|
+
const row = (half - 1) / 2 - rowIndex;
|
|
5812
|
+
return {
|
|
5813
|
+
x: col * length42.parse("1.4mm"),
|
|
5814
|
+
y: row * p
|
|
5815
|
+
};
|
|
5816
|
+
};
|
|
5817
|
+
|
|
5818
|
+
// src/fn/solderjumper.ts
|
|
5819
|
+
import { length as length43 } from "circuit-json";
|
|
5708
5820
|
var solderjumper = (params) => {
|
|
5709
5821
|
const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
|
|
5710
|
-
const padSpacing =
|
|
5711
|
-
const padWidth =
|
|
5712
|
-
const padHeight =
|
|
5822
|
+
const padSpacing = length43.parse(p);
|
|
5823
|
+
const padWidth = length43.parse(pw);
|
|
5824
|
+
const padHeight = length43.parse(ph);
|
|
5713
5825
|
const traceWidth = Math.min(padHeight / 4, 0.5);
|
|
5714
5826
|
const pads = [];
|
|
5715
5827
|
for (let i = 0; i < num_pins; i++) {
|
|
@@ -5797,19 +5909,19 @@ var solderjumper = (params) => {
|
|
|
5797
5909
|
};
|
|
5798
5910
|
|
|
5799
5911
|
// src/fn/potentiometer.ts
|
|
5800
|
-
import { z as
|
|
5801
|
-
var potentiometer_def =
|
|
5802
|
-
fn:
|
|
5803
|
-
num_pins:
|
|
5804
|
-
p:
|
|
5805
|
-
id:
|
|
5806
|
-
od:
|
|
5807
|
-
ca:
|
|
5912
|
+
import { z as z53 } from "zod";
|
|
5913
|
+
var potentiometer_def = z53.object({
|
|
5914
|
+
fn: z53.string(),
|
|
5915
|
+
num_pins: z53.union([z53.literal(3), z53.literal(2)]).default(3),
|
|
5916
|
+
p: z53.string().default("3.8mm"),
|
|
5917
|
+
id: z53.string().default("1.25mm"),
|
|
5918
|
+
od: z53.string().default("2.35mm"),
|
|
5919
|
+
ca: z53.string().default("14mm").describe(
|
|
5808
5920
|
"Caliper axis (width or diameter of the potentiometer body or adjustment knob)"
|
|
5809
5921
|
),
|
|
5810
|
-
w:
|
|
5811
|
-
h:
|
|
5812
|
-
string:
|
|
5922
|
+
w: z53.string().default("5.35mm"),
|
|
5923
|
+
h: z53.string().default("4mm"),
|
|
5924
|
+
string: z53.string().optional()
|
|
5813
5925
|
});
|
|
5814
5926
|
var potentiometer_acp = (parameters) => {
|
|
5815
5927
|
const { p, id, od, h, ca } = parameters;
|
|
@@ -5874,6 +5986,122 @@ var potentiometer = (raw_params) => {
|
|
|
5874
5986
|
};
|
|
5875
5987
|
};
|
|
5876
5988
|
|
|
5989
|
+
// src/fn/electrolytic.ts
|
|
5990
|
+
import {
|
|
5991
|
+
length as length44
|
|
5992
|
+
} from "circuit-json";
|
|
5993
|
+
import { z as z54 } from "zod";
|
|
5994
|
+
var electrolytic_def = z54.object({
|
|
5995
|
+
fn: z54.string(),
|
|
5996
|
+
p: length44.optional().default("7.5mm"),
|
|
5997
|
+
id: length44.optional().default("1mm"),
|
|
5998
|
+
od: length44.optional().default("2mm"),
|
|
5999
|
+
d: length44.optional().default("10.5mm")
|
|
6000
|
+
});
|
|
6001
|
+
var generate_circle_arcs = (centerX, centerY, radius, cut, cutHeight) => {
|
|
6002
|
+
const topArc = [];
|
|
6003
|
+
const bottomArc = [];
|
|
6004
|
+
for (let i = 0; i <= 50; i++) {
|
|
6005
|
+
const theta = i / 50 * Math.PI;
|
|
6006
|
+
const x = centerX + Math.cos(theta) * radius;
|
|
6007
|
+
const y = centerY + Math.sin(theta) * radius;
|
|
6008
|
+
if (x < centerX - cut && y >= centerY - cutHeight / 2 && y <= centerY + cutHeight / 2) {
|
|
6009
|
+
continue;
|
|
6010
|
+
}
|
|
6011
|
+
topArc.push({ x, y });
|
|
6012
|
+
}
|
|
6013
|
+
for (let i = 0; i <= 50; i++) {
|
|
6014
|
+
const theta = Math.PI + i / 50 * Math.PI;
|
|
6015
|
+
const x = centerX + Math.cos(theta) * radius;
|
|
6016
|
+
const y = centerY + Math.sin(theta) * radius;
|
|
6017
|
+
if (x < centerX - cut && y >= centerY - cutHeight / 2 && y <= centerY + cutHeight / 2) {
|
|
6018
|
+
continue;
|
|
6019
|
+
}
|
|
6020
|
+
bottomArc.push({ x, y });
|
|
6021
|
+
}
|
|
6022
|
+
return { topArc, bottomArc };
|
|
6023
|
+
};
|
|
6024
|
+
var electrolytic = (raw_params) => {
|
|
6025
|
+
const parameters = electrolytic_def.parse(raw_params);
|
|
6026
|
+
const { p, id, od, d } = parameters;
|
|
6027
|
+
const plated_holes = [
|
|
6028
|
+
platedhole(1, -p / 2, 0, id, od),
|
|
6029
|
+
platedhole(2, p / 2, 0, id, od)
|
|
6030
|
+
];
|
|
6031
|
+
const { topArc, bottomArc } = generate_circle_arcs(
|
|
6032
|
+
0,
|
|
6033
|
+
0,
|
|
6034
|
+
d / 2 + 0.1,
|
|
6035
|
+
od / 2,
|
|
6036
|
+
od
|
|
6037
|
+
);
|
|
6038
|
+
const silkscreenBody2 = {
|
|
6039
|
+
type: "pcb_silkscreen_path",
|
|
6040
|
+
layer: "top",
|
|
6041
|
+
pcb_component_id: "",
|
|
6042
|
+
route: topArc,
|
|
6043
|
+
stroke_width: 0.1,
|
|
6044
|
+
pcb_silkscreen_path_id: ""
|
|
6045
|
+
};
|
|
6046
|
+
const silkscreenBody3 = {
|
|
6047
|
+
type: "pcb_silkscreen_path",
|
|
6048
|
+
layer: "top",
|
|
6049
|
+
pcb_component_id: "",
|
|
6050
|
+
route: bottomArc,
|
|
6051
|
+
stroke_width: 0.1,
|
|
6052
|
+
pcb_silkscreen_path_id: ""
|
|
6053
|
+
};
|
|
6054
|
+
const silkscreenBody = {
|
|
6055
|
+
type: "pcb_silkscreen_path",
|
|
6056
|
+
layer: "top",
|
|
6057
|
+
pcb_component_id: "",
|
|
6058
|
+
route: [
|
|
6059
|
+
{ x: 0, y: d / 2 + 0.1 },
|
|
6060
|
+
{ x: 0, y: -(d / 2 + 0.1) }
|
|
6061
|
+
],
|
|
6062
|
+
stroke_width: 0.1,
|
|
6063
|
+
pcb_silkscreen_path_id: ""
|
|
6064
|
+
};
|
|
6065
|
+
const X = -(d / 2 + 0.5);
|
|
6066
|
+
const plusY = od / 2 + 1.5;
|
|
6067
|
+
const Size = 0.5;
|
|
6068
|
+
const silkscreenpath3 = {
|
|
6069
|
+
type: "pcb_silkscreen_path",
|
|
6070
|
+
layer: "top",
|
|
6071
|
+
pcb_component_id: "",
|
|
6072
|
+
route: [
|
|
6073
|
+
{ x: X - Size, y: plusY },
|
|
6074
|
+
{ x: X + Size, y: plusY }
|
|
6075
|
+
],
|
|
6076
|
+
stroke_width: 0.1,
|
|
6077
|
+
pcb_silkscreen_path_id: ""
|
|
6078
|
+
};
|
|
6079
|
+
const silkscreenline = {
|
|
6080
|
+
type: "pcb_silkscreen_path",
|
|
6081
|
+
layer: "top",
|
|
6082
|
+
pcb_component_id: "",
|
|
6083
|
+
route: [
|
|
6084
|
+
{ x: X, y: plusY - Size },
|
|
6085
|
+
{ x: X, y: plusY + Size }
|
|
6086
|
+
],
|
|
6087
|
+
stroke_width: 0.1,
|
|
6088
|
+
pcb_silkscreen_path_id: ""
|
|
6089
|
+
};
|
|
6090
|
+
const silkscreenRefText = silkscreenRef(0, d / 2 + 1, 0.5);
|
|
6091
|
+
return {
|
|
6092
|
+
circuitJson: [
|
|
6093
|
+
...plated_holes,
|
|
6094
|
+
silkscreenBody2,
|
|
6095
|
+
silkscreenBody3,
|
|
6096
|
+
silkscreenBody,
|
|
6097
|
+
silkscreenpath3,
|
|
6098
|
+
silkscreenline,
|
|
6099
|
+
silkscreenRefText
|
|
6100
|
+
],
|
|
6101
|
+
parameters
|
|
6102
|
+
};
|
|
6103
|
+
};
|
|
6104
|
+
|
|
5877
6105
|
// src/helpers/is-not-null.ts
|
|
5878
6106
|
function isNotNull(value) {
|
|
5879
6107
|
return value !== null;
|