@tscircuit/footprinter 0.0.144 → 0.0.145
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 +142 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1043,6 +1043,7 @@ type Footprinter = {
|
|
|
1043
1043
|
to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
|
|
1044
1044
|
to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
|
|
1045
1045
|
sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1046
|
+
msop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1046
1047
|
sot23w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1047
1048
|
pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
|
|
1048
1049
|
stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(fn_exports, {
|
|
|
24
24
|
mlp: () => mlp,
|
|
25
25
|
ms012: () => ms012,
|
|
26
26
|
ms013: () => ms013,
|
|
27
|
+
msop: () => msop,
|
|
27
28
|
pad: () => pad,
|
|
28
29
|
pinrow: () => pinrow,
|
|
29
30
|
pushbutton: () => pushbutton,
|
|
@@ -3537,12 +3538,12 @@ var sot89_3 = (parameters) => {
|
|
|
3537
3538
|
const pads = [];
|
|
3538
3539
|
const padGap = Number.parseFloat(parameters.p);
|
|
3539
3540
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
3540
|
-
const
|
|
3541
|
+
const length38 = Number.parseFloat(parameters.w);
|
|
3541
3542
|
const padHeight = Number.parseFloat(parameters.pl);
|
|
3542
3543
|
pads.push(
|
|
3543
|
-
rectpad(1, -
|
|
3544
|
-
rectpad(2, -
|
|
3545
|
-
rectpad(3, -
|
|
3544
|
+
rectpad(1, -length38 / 2, padGap, padHeight, padWidth),
|
|
3545
|
+
rectpad(2, -length38 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
|
|
3546
|
+
rectpad(3, -length38 / 2, -padGap, padHeight, padWidth)
|
|
3546
3547
|
);
|
|
3547
3548
|
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
3548
3549
|
const width = Number.parseFloat(parameters.w) / 2 - 1;
|
|
@@ -3582,7 +3583,7 @@ var sot89_5 = (parameters) => {
|
|
|
3582
3583
|
const pads = [];
|
|
3583
3584
|
const padGap = Number.parseFloat(parameters.p);
|
|
3584
3585
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
3585
|
-
const
|
|
3586
|
+
const length38 = Number.parseFloat(parameters.w);
|
|
3586
3587
|
pads.push(
|
|
3587
3588
|
rectpad(1, -1.85, -1.5, 1.5, 0.7),
|
|
3588
3589
|
rectpad(2, -1.85, 1.5, 1.5, 0.7),
|
|
@@ -5046,6 +5047,142 @@ var sodWithoutParsing12 = (parameters) => {
|
|
|
5046
5047
|
return pads;
|
|
5047
5048
|
};
|
|
5048
5049
|
|
|
5050
|
+
// src/fn/msop.ts
|
|
5051
|
+
import { z as z47 } from "zod";
|
|
5052
|
+
import { length as length37 } from "circuit-json";
|
|
5053
|
+
var getDefaultValues = (num_pins) => {
|
|
5054
|
+
switch (num_pins) {
|
|
5055
|
+
case 10:
|
|
5056
|
+
return {
|
|
5057
|
+
w: "3.10mm",
|
|
5058
|
+
h: "3.32mm",
|
|
5059
|
+
p: "0.5mm",
|
|
5060
|
+
pl: "1.63mm",
|
|
5061
|
+
pw: "0.33mm"
|
|
5062
|
+
};
|
|
5063
|
+
case 12:
|
|
5064
|
+
return {
|
|
5065
|
+
w: "3mm",
|
|
5066
|
+
h: "4mm",
|
|
5067
|
+
p: "0.65mm",
|
|
5068
|
+
pl: "0.88mm",
|
|
5069
|
+
pw: "0.4mm"
|
|
5070
|
+
};
|
|
5071
|
+
case 16:
|
|
5072
|
+
return {
|
|
5073
|
+
w: "3.10mm",
|
|
5074
|
+
h: "4mm",
|
|
5075
|
+
p: "0.5mm",
|
|
5076
|
+
pl: "0.88mm",
|
|
5077
|
+
pw: "0.3mm"
|
|
5078
|
+
};
|
|
5079
|
+
default:
|
|
5080
|
+
return {
|
|
5081
|
+
w: "3.10mm",
|
|
5082
|
+
h: "3.32mm",
|
|
5083
|
+
p: "0.65mm",
|
|
5084
|
+
pl: "1.63mm",
|
|
5085
|
+
pw: "0.4mm"
|
|
5086
|
+
};
|
|
5087
|
+
}
|
|
5088
|
+
};
|
|
5089
|
+
var msop_def = z47.object({
|
|
5090
|
+
fn: z47.string(),
|
|
5091
|
+
num_pins: z47.union([z47.literal(8), z47.literal(10), z47.literal(12), z47.literal(16)]).default(8),
|
|
5092
|
+
w: z47.string().optional(),
|
|
5093
|
+
h: z47.string().optional(),
|
|
5094
|
+
p: z47.string().optional(),
|
|
5095
|
+
pl: z47.string().optional(),
|
|
5096
|
+
pw: z47.string().optional(),
|
|
5097
|
+
string: z47.string().optional()
|
|
5098
|
+
});
|
|
5099
|
+
var getMsopCoords = (pinCount, pn, w, p) => {
|
|
5100
|
+
const half = pinCount / 2;
|
|
5101
|
+
const rowIndex = (pn - 1) % half;
|
|
5102
|
+
const col = pn <= half ? -1 : 1;
|
|
5103
|
+
const row = (half - 1) / 2 - rowIndex;
|
|
5104
|
+
return {
|
|
5105
|
+
x: col * length37.parse("2mm"),
|
|
5106
|
+
y: row * p
|
|
5107
|
+
};
|
|
5108
|
+
};
|
|
5109
|
+
var msop = (raw_params) => {
|
|
5110
|
+
const parameters = msop_def.parse(raw_params);
|
|
5111
|
+
const defaults = getDefaultValues(parameters.num_pins);
|
|
5112
|
+
const w = length37.parse(parameters.w || defaults.w);
|
|
5113
|
+
const h = length37.parse(parameters.h || defaults.h);
|
|
5114
|
+
const p = length37.parse(parameters.p || defaults.p);
|
|
5115
|
+
const pl = length37.parse(parameters.pl || defaults.pl);
|
|
5116
|
+
const pw = length37.parse(parameters.pw || defaults.pw);
|
|
5117
|
+
const pads = [];
|
|
5118
|
+
for (let i = 0; i < parameters.num_pins; i++) {
|
|
5119
|
+
const { x, y } = getMsopCoords(parameters.num_pins, i + 1, w, p);
|
|
5120
|
+
pads.push(rectpad(i + 1, x, y, pl, pw));
|
|
5121
|
+
}
|
|
5122
|
+
const silkscreenBoxWidth = w;
|
|
5123
|
+
const silkscreenBoxHeight = h;
|
|
5124
|
+
const silkscreenTopLine = {
|
|
5125
|
+
type: "pcb_silkscreen_path",
|
|
5126
|
+
layer: "top",
|
|
5127
|
+
pcb_component_id: "",
|
|
5128
|
+
route: [
|
|
5129
|
+
{ x: -silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 },
|
|
5130
|
+
{ x: silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 }
|
|
5131
|
+
],
|
|
5132
|
+
stroke_width: 0.05,
|
|
5133
|
+
pcb_silkscreen_path_id: ""
|
|
5134
|
+
};
|
|
5135
|
+
const silkscreenBottomLine = {
|
|
5136
|
+
type: "pcb_silkscreen_path",
|
|
5137
|
+
layer: "top",
|
|
5138
|
+
pcb_component_id: "",
|
|
5139
|
+
route: [
|
|
5140
|
+
{ x: -silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 },
|
|
5141
|
+
{ x: silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 }
|
|
5142
|
+
],
|
|
5143
|
+
stroke_width: 0.05,
|
|
5144
|
+
pcb_silkscreen_path_id: ""
|
|
5145
|
+
};
|
|
5146
|
+
const pin1Position = getMsopCoords(
|
|
5147
|
+
parameters.num_pins,
|
|
5148
|
+
1,
|
|
5149
|
+
silkscreenBoxWidth,
|
|
5150
|
+
p
|
|
5151
|
+
);
|
|
5152
|
+
const pin1MarkerPosition = {
|
|
5153
|
+
x: pin1Position.x - 0.8,
|
|
5154
|
+
y: pin1Position.y
|
|
5155
|
+
};
|
|
5156
|
+
const pin1Marking = {
|
|
5157
|
+
type: "pcb_silkscreen_path",
|
|
5158
|
+
layer: "top",
|
|
5159
|
+
pcb_component_id: "pin_marker_1",
|
|
5160
|
+
route: [
|
|
5161
|
+
{ x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y },
|
|
5162
|
+
{ x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y + 0.3 },
|
|
5163
|
+
{ x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y - 0.3 },
|
|
5164
|
+
{ x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y }
|
|
5165
|
+
],
|
|
5166
|
+
stroke_width: 0.05,
|
|
5167
|
+
pcb_silkscreen_path_id: "pin_marker_1"
|
|
5168
|
+
};
|
|
5169
|
+
const silkscreenRefText = silkscreenRef(
|
|
5170
|
+
0,
|
|
5171
|
+
silkscreenBoxHeight / 2 + 0.5,
|
|
5172
|
+
0.3
|
|
5173
|
+
);
|
|
5174
|
+
return {
|
|
5175
|
+
circuitJson: [
|
|
5176
|
+
...pads,
|
|
5177
|
+
silkscreenTopLine,
|
|
5178
|
+
silkscreenBottomLine,
|
|
5179
|
+
silkscreenRefText,
|
|
5180
|
+
pin1Marking
|
|
5181
|
+
],
|
|
5182
|
+
parameters
|
|
5183
|
+
};
|
|
5184
|
+
};
|
|
5185
|
+
|
|
5049
5186
|
// src/helpers/is-not-null.ts
|
|
5050
5187
|
function isNotNull(value) {
|
|
5051
5188
|
return value !== null;
|