feat: add castellated holes to board outlines - #816
Merged
Conversation
seveibar
marked this pull request as ready for review
August 26, 2026 04:53
Comment on lines
+53
to
+115
| test("should parse castellated holes on board outline points", () => { | ||
| const raw: BoardProps = { | ||
| name: "board", | ||
| outline: [ | ||
| { x: "-5mm", y: "-5mm" }, | ||
| { | ||
| x: "-5mm", | ||
| y: 0, | ||
| isCastellatedHole: true, | ||
| holeDiameter: "0.8mm", | ||
| padDiameter: "1.2mm", | ||
| connectsTo: ["net.GND", "source_port_1"], | ||
| }, | ||
| { x: "-5mm", y: "5mm" }, | ||
| { x: "5mm", y: "5mm" }, | ||
| { x: "5mm", y: "-5mm" }, | ||
| ], | ||
| } | ||
|
|
||
| const parsed = boardProps.parse(raw) | ||
|
|
||
| expect(parsed.outline?.[0]).toEqual({ x: -5, y: -5 }) | ||
| expect(parsed.outline?.[1]).toEqual({ | ||
| x: -5, | ||
| y: 0, | ||
| isCastellatedHole: true, | ||
| holeDiameter: 0.8, | ||
| padDiameter: 1.2, | ||
| connectsTo: ["net.GND", "source_port_1"], | ||
| }) | ||
| }) | ||
|
|
||
| test("should require both diameters for a castellated outline hole", () => { | ||
| const result = boardProps.safeParse({ | ||
| name: "board", | ||
| outline: [ | ||
| { | ||
| x: 0, | ||
| y: 0, | ||
| isCastellatedHole: true, | ||
| holeDiameter: "0.8mm", | ||
| }, | ||
| ], | ||
| }) | ||
|
|
||
| expect(result.success).toBe(false) | ||
| }) | ||
|
|
||
| test("should require isCastellatedHole for flattened hole props", () => { | ||
| const result = boardProps.safeParse({ | ||
| name: "board", | ||
| outline: [ | ||
| { | ||
| x: 0, | ||
| y: 0, | ||
| holeDiameter: "0.8mm", | ||
| padDiameter: "1.2mm", | ||
| }, | ||
| ], | ||
| }) | ||
|
|
||
| expect(result.success).toBe(false) | ||
| }) |
Contributor
There was a problem hiding this comment.
This diff adds three new test(...) calls to board.test.ts, which already contained tests before this PR. The style guide rule states that a *.test.ts file may have AT MOST one test(...) — after that, tests must be split into multiple numbered files (e.g., board1.test.ts, board2.test.ts, board3.test.ts, etc.). Please move the new tests into separate, numbered test files rather than appending them to the existing board.test.ts.
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proposes an additive way to describe castellated holes directly in a
<board />outline:Each flagged point is both an ordinary outline vertex and the center of the castellated hole. Existing
Point[]outlines remain valid without migration.API decisions
isCastellatedHolemarks the outline point; its related geometry and connectivity props are flat on the same object.holeDiameterandpadDiameterare required whenisCastellatedHoleis true, making the drill and copper dimensions explicit without manufacturing-sensitive defaults.connectsTois optional and accepts one or more connection targets, also matching<platedhole />.BoardOutlinePointandboardOutlinePointfor downstream consumers.This PR is intentionally the props/API layer. Follow-up work in
circuit-jsonandcorewill need to preserve the annotations inpcb_boardoutput and materialize the fabrication/rendering behavior.Related to tscircuit/tscircuit#3297.
Testing
bun testbun run typecheckbun run buildbun run check-circular-depsbun run format:check