Skip to content

feat: add castellated holes to board outlines - #816

Merged
seveibar merged 3 commits into
mainfrom
feat/board-castellated-outline-points
Aug 26, 2026
Merged

feat: add castellated holes to board outlines#816
seveibar merged 3 commits into
mainfrom
feat/board-castellated-outline-points

Conversation

@seveibar

@seveibar seveibar commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Proposes an additive way to describe castellated holes directly in a <board /> outline:

<board
  outline={[
    { x: "-5mm", y: "-5mm" },
    {
      x: "-5mm",
      y: 0,
      isCastellatedHole: true,
      holeDiameter: "0.8mm",
      padDiameter: "1.2mm",
      connectsTo: "net.GND",
    },
    { x: "-5mm", y: "5mm" },
    { x: "5mm", y: "5mm" },
    { x: "5mm", y: "-5mm" },
  ]}
/>

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

  • isCastellatedHole marks the outline point; its related geometry and connectivity props are flat on the same object.
  • holeDiameter and padDiameter are required when isCastellatedHole is true, making the drill and copper dimensions explicit without manufacturing-sensitive defaults.
  • connectsTo is optional and accepts one or more connection targets, also matching <platedhole />.
  • Distance strings are normalized to millimeters by the existing distance parser.
  • The type and schema are exported as BoardOutlinePoint and boardOutlinePoint for downstream consumers.

This PR is intentionally the props/API layer. Follow-up work in circuit-json and core will need to preserve the annotations in pcb_board output and materialize the fabrication/rendering behavior.

Related to tscircuit/tscircuit#3297.

Testing

  • bun test
  • bun run typecheck
  • bun run build
  • bun run check-circular-deps
  • bun run format:check
  • required generated documentation scripts

@seveibar
seveibar marked this pull request as ready for review August 26, 2026 04:53
@seveibar
seveibar merged commit 5c198fa into main Aug 26, 2026
5 checks passed
Comment thread tests/board.test.ts
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)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant