@tscircuit/footprinter 0.0.157 → 0.0.159
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 +130 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1028,6 +1028,7 @@ type Footprinter = {
|
|
|
1028
1028
|
sma: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1029
1029
|
smf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1030
1030
|
smb: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1031
|
+
potentiometer: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "pw" | "ca">;
|
|
1031
1032
|
sod923: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1032
1033
|
sod323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1033
1034
|
sod80: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(fn_exports, {
|
|
|
27
27
|
msop: () => msop,
|
|
28
28
|
pad: () => pad,
|
|
29
29
|
pinrow: () => pinrow,
|
|
30
|
+
potentiometer: () => potentiometer,
|
|
30
31
|
pushbutton: () => pushbutton,
|
|
31
32
|
qfn: () => qfn,
|
|
32
33
|
qfp: () => qfp,
|
|
@@ -3870,12 +3871,12 @@ var sot89_3 = (parameters) => {
|
|
|
3870
3871
|
const pads = [];
|
|
3871
3872
|
const padGap = Number.parseFloat(parameters.p);
|
|
3872
3873
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
3873
|
-
const
|
|
3874
|
+
const length43 = Number.parseFloat(parameters.w);
|
|
3874
3875
|
const padHeight = Number.parseFloat(parameters.pl);
|
|
3875
3876
|
pads.push(
|
|
3876
|
-
rectpad(1, -
|
|
3877
|
-
rectpad(2, -
|
|
3878
|
-
rectpad(3, -
|
|
3877
|
+
rectpad(1, -length43 / 2, padGap, padHeight, padWidth),
|
|
3878
|
+
rectpad(2, -length43 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
|
|
3879
|
+
rectpad(3, -length43 / 2, -padGap, padHeight, padWidth)
|
|
3879
3880
|
);
|
|
3880
3881
|
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
3881
3882
|
const width = Number.parseFloat(parameters.w) / 2 - 1;
|
|
@@ -3915,7 +3916,7 @@ var sot89_5 = (parameters) => {
|
|
|
3915
3916
|
const pads = [];
|
|
3916
3917
|
const padGap = Number.parseFloat(parameters.p);
|
|
3917
3918
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
3918
|
-
const
|
|
3919
|
+
const length43 = Number.parseFloat(parameters.w);
|
|
3919
3920
|
pads.push(
|
|
3920
3921
|
rectpad(1, -1.85, -1.5, 1.5, 0.7),
|
|
3921
3922
|
rectpad(2, -1.85, 1.5, 1.5, 0.7),
|
|
@@ -3998,8 +3999,8 @@ var to220_def = z34.object({
|
|
|
3998
3999
|
});
|
|
3999
4000
|
var to220 = (raw_params) => {
|
|
4000
4001
|
const parameters = to220_def.parse(raw_params);
|
|
4001
|
-
const { fn, id, od, w, h, string:
|
|
4002
|
-
const numPins = Number.parseInt(
|
|
4002
|
+
const { fn, id, od, w, h, string: string3 } = parameters;
|
|
4003
|
+
const numPins = Number.parseInt(string3?.split("_")[1] ?? "3");
|
|
4003
4004
|
const holeY = -1;
|
|
4004
4005
|
const halfWidth = w / 2;
|
|
4005
4006
|
const halfHeight = h / 2;
|
|
@@ -5703,11 +5704,12 @@ var sodWithoutParsing15 = (parameters) => {
|
|
|
5703
5704
|
};
|
|
5704
5705
|
|
|
5705
5706
|
// src/fn/solderjumper.ts
|
|
5707
|
+
import { length as length42 } from "circuit-json";
|
|
5706
5708
|
var solderjumper = (params) => {
|
|
5707
5709
|
const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
|
|
5708
|
-
const padSpacing = p;
|
|
5709
|
-
const padWidth = pw;
|
|
5710
|
-
const padHeight = ph;
|
|
5710
|
+
const padSpacing = length42.parse(p);
|
|
5711
|
+
const padWidth = length42.parse(pw);
|
|
5712
|
+
const padHeight = length42.parse(ph);
|
|
5711
5713
|
const traceWidth = Math.min(padHeight / 4, 0.5);
|
|
5712
5714
|
const pads = [];
|
|
5713
5715
|
for (let i = 0; i < num_pins; i++) {
|
|
@@ -5752,24 +5754,133 @@ var solderjumper = (params) => {
|
|
|
5752
5754
|
}
|
|
5753
5755
|
}
|
|
5754
5756
|
}
|
|
5755
|
-
const
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5757
|
+
const outlineWidth = (num_pins - 1) * padSpacing + padWidth + 0.7;
|
|
5758
|
+
const outlineHeight = padHeight + 1;
|
|
5759
|
+
const outlineCenterX = (num_pins - 1) * padSpacing / 2;
|
|
5760
|
+
const outlineCenterY = 0;
|
|
5761
|
+
const silkscreenRect = {
|
|
5762
|
+
type: "pcb_silkscreen_path",
|
|
5763
|
+
layer: "top",
|
|
5764
|
+
pcb_component_id: "",
|
|
5765
|
+
pcb_silkscreen_path_id: "outline",
|
|
5766
|
+
route: [
|
|
5767
|
+
{
|
|
5768
|
+
x: outlineCenterX - outlineWidth / 2,
|
|
5769
|
+
y: outlineCenterY - outlineHeight / 2
|
|
5770
|
+
},
|
|
5771
|
+
{
|
|
5772
|
+
x: outlineCenterX + outlineWidth / 2,
|
|
5773
|
+
y: outlineCenterY - outlineHeight / 2
|
|
5774
|
+
},
|
|
5775
|
+
{
|
|
5776
|
+
x: outlineCenterX + outlineWidth / 2,
|
|
5777
|
+
y: outlineCenterY + outlineHeight / 2
|
|
5778
|
+
},
|
|
5779
|
+
{
|
|
5780
|
+
x: outlineCenterX - outlineWidth / 2,
|
|
5781
|
+
y: outlineCenterY + outlineHeight / 2
|
|
5782
|
+
},
|
|
5783
|
+
{
|
|
5784
|
+
x: outlineCenterX - outlineWidth / 2,
|
|
5785
|
+
y: outlineCenterY - outlineHeight / 2
|
|
5786
|
+
}
|
|
5787
|
+
],
|
|
5788
|
+
stroke_width: 0.15
|
|
5789
|
+
};
|
|
5790
|
+
const refOffset = 0.6;
|
|
5791
|
+
const refY = outlineCenterY + outlineHeight / 2 + refOffset;
|
|
5792
|
+
const silk = silkscreenRef(outlineCenterX, refY, 0.4);
|
|
5760
5793
|
return {
|
|
5761
|
-
circuitJson: [...pads, ...traces, silk],
|
|
5794
|
+
circuitJson: [...pads, ...traces, silkscreenRect, silk],
|
|
5762
5795
|
parameters: params
|
|
5763
5796
|
};
|
|
5764
5797
|
};
|
|
5765
5798
|
|
|
5799
|
+
// src/fn/potentiometer.ts
|
|
5800
|
+
import { z as z52 } from "zod";
|
|
5801
|
+
var potentiometer_def = z52.object({
|
|
5802
|
+
fn: z52.string(),
|
|
5803
|
+
num_pins: z52.union([z52.literal(3), z52.literal(2)]).default(3),
|
|
5804
|
+
p: z52.string().default("3.8mm"),
|
|
5805
|
+
id: z52.string().default("1.25mm"),
|
|
5806
|
+
od: z52.string().default("2.35mm"),
|
|
5807
|
+
ca: z52.string().default("14mm").describe(
|
|
5808
|
+
"Caliper axis (width or diameter of the potentiometer body or adjustment knob)"
|
|
5809
|
+
),
|
|
5810
|
+
w: z52.string().default("5.35mm"),
|
|
5811
|
+
h: z52.string().default("4mm"),
|
|
5812
|
+
string: z52.string().optional()
|
|
5813
|
+
});
|
|
5814
|
+
var potentiometer_acp = (parameters) => {
|
|
5815
|
+
const { p, id, od, h, ca } = parameters;
|
|
5816
|
+
const y = Number.parseFloat(h);
|
|
5817
|
+
const caliper = Number.parseFloat(ca);
|
|
5818
|
+
return [
|
|
5819
|
+
platedhole(1, 0, caliper / 4 + 0.3, id, od),
|
|
5820
|
+
platedhole(2, y, 0, id, od),
|
|
5821
|
+
platedhole(3, 0, -caliper / 4 - 0.3, id, od)
|
|
5822
|
+
];
|
|
5823
|
+
};
|
|
5824
|
+
var potentiometer = (raw_params) => {
|
|
5825
|
+
const match = raw_params.string?.match(/^potentiometer_(\d+)/);
|
|
5826
|
+
const numPins = match ? Number.parseInt(match[1], 10) : 3;
|
|
5827
|
+
const parameters = potentiometer_def.parse({
|
|
5828
|
+
...raw_params,
|
|
5829
|
+
num_pins: numPins
|
|
5830
|
+
});
|
|
5831
|
+
let platedHoles = [];
|
|
5832
|
+
if (parameters.num_pins === 3) {
|
|
5833
|
+
platedHoles = potentiometer_acp(parameters);
|
|
5834
|
+
}
|
|
5835
|
+
const y = Number.parseFloat(parameters.ca) / 2 + 0.15;
|
|
5836
|
+
const x = Number.parseFloat(parameters.w);
|
|
5837
|
+
const od = Number.parseFloat(parameters.od) / 2 + 0.35;
|
|
5838
|
+
const silkscreenBody = {
|
|
5839
|
+
type: "pcb_silkscreen_path",
|
|
5840
|
+
layer: "top",
|
|
5841
|
+
pcb_component_id: "",
|
|
5842
|
+
route: [
|
|
5843
|
+
{ x: 0, y: y - 1.75 },
|
|
5844
|
+
{ x: 0, y },
|
|
5845
|
+
{ x, y },
|
|
5846
|
+
{ x, y: od }
|
|
5847
|
+
],
|
|
5848
|
+
stroke_width: 0.1,
|
|
5849
|
+
pcb_silkscreen_path_id: ""
|
|
5850
|
+
};
|
|
5851
|
+
const silkscreenBody2 = {
|
|
5852
|
+
type: "pcb_silkscreen_path",
|
|
5853
|
+
layer: "top",
|
|
5854
|
+
pcb_component_id: "",
|
|
5855
|
+
route: [
|
|
5856
|
+
{ x, y: -od },
|
|
5857
|
+
{ x, y: -y },
|
|
5858
|
+
{ x: 0, y: -y },
|
|
5859
|
+
{ x: 0, y: -y + 1.75 }
|
|
5860
|
+
],
|
|
5861
|
+
stroke_width: 0.1,
|
|
5862
|
+
pcb_silkscreen_path_id: ""
|
|
5863
|
+
};
|
|
5864
|
+
const W = Number.parseFloat(parameters.w) / 2;
|
|
5865
|
+
const silkscreenRefText = silkscreenRef(W, y + 1, 0.5);
|
|
5866
|
+
return {
|
|
5867
|
+
circuitJson: [
|
|
5868
|
+
...platedHoles,
|
|
5869
|
+
silkscreenBody,
|
|
5870
|
+
silkscreenBody2,
|
|
5871
|
+
silkscreenRefText
|
|
5872
|
+
],
|
|
5873
|
+
parameters
|
|
5874
|
+
};
|
|
5875
|
+
};
|
|
5876
|
+
|
|
5766
5877
|
// src/helpers/is-not-null.ts
|
|
5767
5878
|
function isNotNull(value) {
|
|
5768
5879
|
return value !== null;
|
|
5769
5880
|
}
|
|
5770
5881
|
|
|
5771
5882
|
// src/footprinter.ts
|
|
5772
|
-
var
|
|
5883
|
+
var string2 = (def) => {
|
|
5773
5884
|
let fp2 = footprinter();
|
|
5774
5885
|
const modifiedDef = (def.length === 4 || def.length === 5) && /^\d+$/.test(def) ? `res${def}` : def;
|
|
5775
5886
|
const def_parts = modifiedDef.split("_").map((s) => {
|
|
@@ -5873,7 +5984,7 @@ var footprinter = () => {
|
|
|
5873
5984
|
);
|
|
5874
5985
|
return proxy;
|
|
5875
5986
|
};
|
|
5876
|
-
footprinter.string =
|
|
5987
|
+
footprinter.string = string2;
|
|
5877
5988
|
footprinter.getFootprintNames = getFootprintNames;
|
|
5878
5989
|
var fp = footprinter;
|
|
5879
5990
|
export {
|
|
@@ -5882,6 +5993,6 @@ export {
|
|
|
5882
5993
|
getFootprintNames,
|
|
5883
5994
|
getFootprintNamesByType,
|
|
5884
5995
|
getFootprintSizes,
|
|
5885
|
-
string
|
|
5996
|
+
string2 as string
|
|
5886
5997
|
};
|
|
5887
5998
|
//# sourceMappingURL=index.js.map
|