Skip to content

Commit e80124e

Browse files
silkscreen for solderjumper
1 parent ffbc675 commit e80124e

6 files changed

Lines changed: 53 additions & 15 deletions

src/fn/solderjumper.ts

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { rectpad } from "../helpers/rectpad"
22
import { silkscreenRef } from "../helpers/silkscreenRef"
33
import type { AnyCircuitElement } from "circuit-json"
4+
import { length } from "circuit-json"
45

56
/**
67
* Solderjumper footprint generator
@@ -26,9 +27,9 @@ export const solderjumper = (params: {
2627
ph?: number
2728
}) => {
2829
const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params
29-
const padSpacing = p
30-
const padWidth = pw
31-
const padHeight = ph
30+
const padSpacing = length.parse(p)
31+
const padWidth = length.parse(pw)
32+
const padHeight = length.parse(ph)
3233
const traceWidth = Math.min(padHeight / 4, 0.5)
3334
const pads: AnyCircuitElement[] = []
3435
for (let i = 0; i < num_pins; i++) {
@@ -81,14 +82,51 @@ export const solderjumper = (params: {
8182
}
8283
}
8384
}
84-
// Add silkscreen ref
85-
const silk = silkscreenRef(
86-
((num_pins - 1) * padSpacing) / 2,
87-
Number(padHeight) + 0.1,
88-
0.4,
89-
)
85+
const outlineWidth = (num_pins - 1) * padSpacing + padWidth + 0.7
86+
const outlineHeight = padHeight + 1.0
87+
const outlineCenterX = ((num_pins - 1) * padSpacing) / 2
88+
const outlineCenterY = 0
89+
90+
console.log("outlineWidth", outlineWidth)
91+
console.log("outlineHeight", outlineHeight)
92+
console.log("outlineCenterX", outlineCenterX)
93+
console.log("outlineCenterY", outlineCenterY)
94+
const silkscreenRect = {
95+
type: "pcb_silkscreen_path",
96+
layer: "top",
97+
pcb_component_id: "",
98+
pcb_silkscreen_path_id: "outline",
99+
route: [
100+
{
101+
x: outlineCenterX - outlineWidth / 2,
102+
y: outlineCenterY - outlineHeight / 2,
103+
},
104+
{
105+
x: outlineCenterX + outlineWidth / 2,
106+
y: outlineCenterY - outlineHeight / 2,
107+
},
108+
{
109+
x: outlineCenterX + outlineWidth / 2,
110+
y: outlineCenterY + outlineHeight / 2,
111+
},
112+
{
113+
x: outlineCenterX - outlineWidth / 2,
114+
y: outlineCenterY + outlineHeight / 2,
115+
},
116+
{
117+
x: outlineCenterX - outlineWidth / 2,
118+
y: outlineCenterY - outlineHeight / 2,
119+
},
120+
],
121+
stroke_width: 0.15,
122+
}
123+
124+
const refOffset = 0.6
125+
const refY = outlineCenterY + outlineHeight / 2 + refOffset
126+
const silk = silkscreenRef(outlineCenterX, refY, 0.4)
127+
90128
return {
91-
circuitJson: [...pads, ...traces, silk],
129+
circuitJson: [...pads, ...traces, silkscreenRect, silk],
92130
parameters: params,
93131
}
94132
}
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)