Skip to content

Commit 2e72225

Browse files
Add support for PCB panels (#65)
* Add support for PCB panels * fix bun version in workflow
1 parent cccc2e1 commit 2e72225

5 files changed

Lines changed: 411 additions & 1 deletion

File tree

.github/workflows/bun-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup bun
1616
uses: oven-sh/setup-bun@v1
1717
with:
18-
bun-version: latest
18+
bun-version: 1.3.1
1919

2020
- name: Install dependencies
2121
run: bun install

src/gerber/convert-soup-to-gerber-commands/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,12 @@ export const convertSoupToGerberCommands = (
632632
}
633633
}
634634
} else if (element.type === "pcb_board" && layer === "edgecut") {
635+
// Skip boards that are inside a panel - only render the panel outline
636+
const board = element as any
637+
if (board.pcb_panel_id) {
638+
continue
639+
}
640+
635641
const glayer = glayers.Edge_Cuts
636642
const { width, height, center, outline } = element
637643
const gerberBuild = gerberBuilder().add("select_aperture", {
@@ -678,6 +684,36 @@ export const convertSoupToGerberCommands = (
678684
})
679685
}
680686

687+
glayer.push(...gerberBuild.build())
688+
} else if (element.type === "pcb_panel" && layer === "edgecut") {
689+
const glayer = glayers.Edge_Cuts
690+
const panel = element as any
691+
const { width, height, center } = panel
692+
const gerberBuild = gerberBuilder()
693+
.add("select_aperture", {
694+
aperture_number: 10,
695+
})
696+
.add("move_operation", {
697+
x: center.x - width / 2,
698+
y: mfy(center.y - height / 2),
699+
})
700+
.add("plot_operation", {
701+
x: center.x + width / 2,
702+
y: mfy(center.y - height / 2),
703+
})
704+
.add("plot_operation", {
705+
x: center.x + width / 2,
706+
y: mfy(center.y + height / 2),
707+
})
708+
.add("plot_operation", {
709+
x: center.x - width / 2,
710+
y: mfy(center.y + height / 2),
711+
})
712+
.add("plot_operation", {
713+
x: center.x - width / 2,
714+
y: mfy(center.y - height / 2),
715+
})
716+
681717
glayer.push(...gerberBuild.build())
682718
} else if (element.type === "pcb_cutout") {
683719
if (layer === "edgecut") {
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)