Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions docs/elements/courtyardoutline.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,68 @@ export default () => (
)
`}
/>

## Anchor Alignment Examples

`<courtyardoutline />` draws the polygon you provide in footprint coordinates.
To make the footprint origin act like a specific anchor (center, top-left,
bottom-right, etc.), translate the outline points accordingly.

<CircuitPreview
showCourtyards
defaultView="pcb"
hideSchematicTab
hide3DTab
code={`
export default () => {
const W = 10
const H = 6

const rect = [
{ x: 0, y: 0 },
{ x: W, y: 0 },
{ x: W, y: H },
{ x: 0, y: H },
]

const translate = (outline, dx, dy) =>
outline.map((p) => ({ x: p.x + dx, y: p.y + dy }))

return (
<board width="70mm" height="26mm">
<chip
name="CENTER"
pcbX={-20}
footprint={
<footprint>
<platedhole shape="circle" pcbX={0} pcbY={0} outerDiameter={1.6} holeDiameter={0.8} />
<courtyardoutline outline={translate(rect, -W / 2, -H / 2)} />
</footprint>
}
/>

<chip
name="TOP_LEFT"
footprint={
<footprint>
<platedhole shape="circle" pcbX={0} pcbY={0} outerDiameter={1.6} holeDiameter={0.8} />
<courtyardoutline outline={translate(rect, 0, -H)} />
</footprint>
}
/>

<chip
name="BOTTOM_RIGHT"
pcbX={30}
footprint={
<footprint>
<platedhole shape="circle" pcbX={0} pcbY={0} outerDiameter={1.6} holeDiameter={0.8} />
<courtyardoutline outline={translate(rect, -W, 0)} />
</footprint>
}
/>
</board>
)
}
`}
/>
Loading