Skip to content

Commit 93e6126

Browse files
authored
Render fabrication note paths on the fabrication layer (#29)
1 parent 650dcb6 commit 93e6126

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

lib/generate-footprint-tsx.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,17 @@ export const generateFootprintTsx = (
6666
)
6767
}
6868

69-
// Map fabrication note paths to silkscreen paths in footprints
7069
for (const fabPath of fabricationNotePaths) {
71-
elementStrings.push(
72-
`<silkscreenpath route={${JSON.stringify(fabPath.route)}} />`,
73-
)
70+
const attrs = [`route={${JSON.stringify(fabPath.route)}}`]
71+
72+
if ("stroke_width" in fabPath && fabPath.stroke_width !== undefined) {
73+
attrs.push(`strokeWidth={${fabPath.stroke_width}}`)
74+
}
75+
if ("color" in fabPath && fabPath.color !== undefined) {
76+
attrs.push(`color="${fabPath.color}"`)
77+
}
78+
79+
elementStrings.push(`<fabricationnotepath ${attrs.join(" ")} />`)
7480
}
7581

7682
// Add silkscreen text elements (use pcbX/pcbY instead of anchorPosition)

tests/test4-support-silkscreen.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ test("test4 support silkscreen", async () => {
1313
footprint={<footprint>
1414
<smtpad portHints={["1"]} pcbX="-0.32mm" pcbY="0mm" width="0.46mm" height="0.4mm" shape="rect" />
1515
<smtpad portHints={["2"]} pcbX="0.32mm" pcbY="0mm" width="0.46mm" height="0.4mm" shape="rect" />
16-
<silkscreenpath route={[{"x":-0.3,"y":0.15},{"x":0.3,"y":0.15}]} />
17-
<silkscreenpath route={[{"x":-0.3,"y":-0.15},{"x":-0.3,"y":0.15}]} />
18-
<silkscreenpath route={[{"x":0.3,"y":0.15},{"x":0.3,"y":-0.15}]} />
19-
<silkscreenpath route={[{"x":0.3,"y":-0.15},{"x":-0.3,"y":-0.15}]} />
16+
<fabricationnotepath route={[{"x":-0.3,"y":0.15},{"x":0.3,"y":0.15}]} strokeWidth={0.1} />
17+
<fabricationnotepath route={[{"x":-0.3,"y":-0.15},{"x":-0.3,"y":0.15}]} strokeWidth={0.1} />
18+
<fabricationnotepath route={[{"x":0.3,"y":0.15},{"x":0.3,"y":-0.15}]} strokeWidth={0.1} />
19+
<fabricationnotepath route={[{"x":0.3,"y":-0.15},{"x":-0.3,"y":-0.15}]} strokeWidth={0.1} />
2020
<silkscreentext pcbX={0} pcbY={0.68} anchorAlignment="center" fontSize={0.25} text="\${REFERENCE}" />
2121
<silkscreentext pcbX={0} pcbY={1.05} anchorAlignment="center" fontSize={1.27} text="REF**" />
2222
<silkscreentext pcbX={0} pcbY={-1.05} anchorAlignment="center" fontSize={1.27} text="R_0201_0603Metric" />

0 commit comments

Comments
 (0)