@tscircuit/footprinter 0.0.9 → 0.0.10
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/package.json +2 -2
- package/src/fn/soic.ts +26 -2
- package/src/helpers/u-curve.ts +6 -0
- package/tests/fixtures/get-test-fixture.ts +2 -0
- package/tests/soic.test.ts +2 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/footprinter",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "ava",
|
|
8
|
+
"test": "FULL_RUN=1 ava",
|
|
9
9
|
"build": "tsup ./src/index.ts --dts --sourcemap"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [],
|
package/src/fn/soic.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { AnySoupElement } from "@tscircuit/soup"
|
|
1
|
+
import type { AnySoupElement, PcbSilkscreenPath } from "@tscircuit/soup"
|
|
2
2
|
import { platedhole } from "../helpers/platedhole"
|
|
3
3
|
import { z } from "zod"
|
|
4
4
|
import { length } from "@tscircuit/soup"
|
|
5
5
|
import type { NowDefined } from "../helpers/zod/now-defined"
|
|
6
|
+
import { u_curve } from "../helpers/u-curve"
|
|
6
7
|
|
|
7
8
|
const soic_def = z
|
|
8
9
|
.object({
|
|
@@ -78,5 +79,28 @@ export const soic = (raw_params: {
|
|
|
78
79
|
platedhole(i + 1, x, y, params.id ?? "0.6mm", params.od ?? "1mm")
|
|
79
80
|
)
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
+
|
|
83
|
+
/** silkscreen width */
|
|
84
|
+
const sw = params.w - params.od - 0.4
|
|
85
|
+
const sh = (params.num_pins / 2 - 1) * params.p + params.od + 0.4
|
|
86
|
+
const silkscreenBorder: PcbSilkscreenPath = {
|
|
87
|
+
layer: "top",
|
|
88
|
+
pcb_component_id: "",
|
|
89
|
+
pcb_silkscreen_path_id: "silkscreen_path_1",
|
|
90
|
+
route: [
|
|
91
|
+
{ x: -sw / 2, y: -sh / 2 },
|
|
92
|
+
{ x: -sw / 2, y: sh / 2 },
|
|
93
|
+
// Little U shape at the top
|
|
94
|
+
...u_curve.map(({ x, y }) => ({
|
|
95
|
+
x: (x * sw) / 6,
|
|
96
|
+
y: (y * sw) / 6 + sh / 2,
|
|
97
|
+
})),
|
|
98
|
+
{ x: sw / 2, y: sh / 2 },
|
|
99
|
+
{ x: sw / 2, y: -sh / 2 },
|
|
100
|
+
{ x: -sw / 2, y: -sh / 2 },
|
|
101
|
+
],
|
|
102
|
+
type: "pcb_silkscreen_path",
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return [...platedHoles, silkscreenBorder]
|
|
82
106
|
}
|
|
@@ -8,10 +8,12 @@ export const getTestFixture = async (t: ExecutionContext) => {
|
|
|
8
8
|
fp,
|
|
9
9
|
logSoup: (soup: AnySoupElement[]) => {
|
|
10
10
|
if (process.env.CI) return
|
|
11
|
+
if (process.env.FULL_RUN) return
|
|
11
12
|
return logSoup(`footprinter: ${t.title}`, soup)
|
|
12
13
|
},
|
|
13
14
|
logSoupWithPrefix: (prefix: string, soup: AnySoupElement[]) => {
|
|
14
15
|
if (process.env.CI) return
|
|
16
|
+
if (process.env.FULL_RUN) return
|
|
15
17
|
return logSoup(`footprinter: ${t.title} ${prefix}`, soup)
|
|
16
18
|
},
|
|
17
19
|
}
|
package/tests/soic.test.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { getTestFixture } from "tests/fixtures/get-test-fixture"
|
|
|
3
3
|
import { su } from "@tscircuit/soup-util"
|
|
4
4
|
|
|
5
5
|
test("soic8_w5.3mm_p1.27mm", async (t) => {
|
|
6
|
-
const { fp } = await getTestFixture(t)
|
|
6
|
+
const { fp, logSoup } = await getTestFixture(t)
|
|
7
7
|
const soup = fp.string("soic8_w5.3mm_p1.27mm").soup()
|
|
8
8
|
|
|
9
9
|
t.is(su(soup).pcb_plated_hole.list().length, 8)
|
|
10
|
+
await logSoup(soup)
|
|
10
11
|
})
|