@tscircuit/footprinter 0.0.10 → 0.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/footprinter",
3
3
  "type": "module",
4
- "version": "0.0.10",
4
+ "version": "0.0.12",
5
5
  "description": "",
6
6
  "main": "dist/index.cjs",
7
7
  "scripts": {
package/src/fn/dip.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { AnySoupElement } from "@tscircuit/soup"
1
+ import type { AnySoupElement, PcbSilkscreenPath } from "@tscircuit/soup"
2
+ import { u_curve } from "../helpers/u-curve"
2
3
  import { platedhole } from "../helpers/platedhole"
3
4
  import { z } from "zod"
4
5
  import { length } from "@tscircuit/soup"
@@ -91,5 +92,27 @@ export const dip = (raw_params: {
91
92
  platedhole(i + 1, x, y, params.id ?? "0.8mm", params.od ?? "1mm")
92
93
  )
93
94
  }
94
- return platedHoles
95
+ /** silkscreen width */
96
+ const sw = params.w - params.od - 0.4
97
+ const sh = (params.num_pins / 2 - 1) * params.p + params.od + 0.4
98
+ const silkscreenBorder: PcbSilkscreenPath = {
99
+ layer: "top",
100
+ pcb_component_id: "",
101
+ pcb_silkscreen_path_id: "silkscreen_path_1",
102
+ route: [
103
+ { x: -sw / 2, y: -sh / 2 },
104
+ { x: -sw / 2, y: sh / 2 },
105
+ // Little U shape at the top
106
+ ...u_curve.map(({ x, y }) => ({
107
+ x: (x * sw) / 6,
108
+ y: (y * sw) / 6 + sh / 2,
109
+ })),
110
+ { x: sw / 2, y: sh / 2 },
111
+ { x: sw / 2, y: -sh / 2 },
112
+ { x: -sw / 2, y: -sh / 2 },
113
+ ],
114
+ type: "pcb_silkscreen_path",
115
+ }
116
+
117
+ return [...platedHoles, silkscreenBorder]
95
118
  }
package/tests/dip.test.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import test from "ava"
2
2
  import { fp } from "../src/footprinter"
3
3
  import type { AnySoupElement } from "@tscircuit/soup"
4
- import { toPinPositionString } from "./fixtures"
4
+ import { getTestFixture, toPinPositionString } from "./fixtures"
5
5
 
6
6
  test("dip params", (t) => {
7
7
  t.deepEqual(fp().dip(4).w(7.62).params(), {
@@ -26,7 +26,8 @@ test("dip footprint", (t) => {
26
26
  )
27
27
  })
28
28
 
29
- test("dip4_w3.00mm", (t) => {
29
+ test("dip4_w3.00mm", async (t) => {
30
+ const { fp, logSoup } = await getTestFixture(t)
30
31
  const soup = fp.string("dip4_w3.00mm").soup()
31
32
  const ps = toPinPositionString(soup)
32
33
 
@@ -39,4 +40,6 @@ test("dip4_w3.00mm", (t) => {
39
40
  4 : 1.50 1.27
40
41
  `.trim()
41
42
  )
43
+
44
+ await logSoup(soup)
42
45
  })