Skip to content

Commit 9d5348e

Browse files
authored
add doc for pcbnotedimension (#258)
1 parent c5d6467 commit 9d5348e

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

docs/elements/pcbnotedimension.mdx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: <pcbnotedimension />
3+
description: The `<pcbnotedimension />` element adds dimension annotations to PCBs showing measurements between two points.
4+
---
5+
6+
import CircuitPreview from "@site/src/components/CircuitPreview"
7+
8+
## Overview
9+
10+
`<pcbnotedimension />` lets you add dimensional annotations to your PCB design. These annotations display the distance between two points with arrows and text labels, making it easy to communicate critical measurements for manufacturing, assembly, or design review. Dimension annotations are visible in PCB previews and can be exported with fabrication outputs.
11+
12+
## Basic Usage
13+
14+
Below is a simple board with a dimension annotation showing the distance between two components. The dimension line connects two points and displays a label with the measurement.
15+
16+
<CircuitPreview
17+
defaultView="pcb"
18+
hide3DTab
19+
hideSchematicTab
20+
code={`
21+
export default () => (
22+
<board width="20mm" height="15mm">
23+
<resistor name="R1" resistance="10k" footprint="0402" pcbX={-3} pcbY={0} />
24+
<resistor name="R2" resistance="10k" footprint="0402" pcbX={3} pcbY={0} />
25+
<pcbnotedimension
26+
from={{ x: -3, y: 2 }}
27+
to={{ x: 3, y: 2 }}
28+
text="6mm"
29+
arrowSize={0.8}
30+
fontSize={1.5}
31+
color="#ffffff"
32+
/>
33+
</board>
34+
)
35+
`}
36+
/>
37+
38+
## Using Selectors
39+
40+
Instead of specifying exact coordinates, you can use selectors to reference components. The dimension will automatically point to the component's position.
41+
42+
<CircuitPreview
43+
defaultView="pcb"
44+
hide3DTab
45+
hideSchematicTab
46+
code={`
47+
export default () => (
48+
<board width="25mm" height="15mm">
49+
<resistor name="R1" resistance="10k" footprint="0402" pcbX={-5} pcbY={0} />
50+
<resistor name="R2" resistance="10k" footprint="0402" pcbX={5} pcbY={0} />
51+
<pcbnotedimension
52+
from="R1"
53+
to="R2"
54+
text="10mm spacing"
55+
fontSize={1.2}
56+
color="#00ff00"
57+
/>
58+
</board>
59+
)
60+
`}
61+
/>
62+
63+
## Properties
64+
65+
| Property | Type | Description |
66+
|---------|------|-------------|
67+
| `from` | string \| Point | **Required.** Starting point of the dimension. Can be a selector string (e.g., `"R1"`) or a Point object with `x` and `y` coordinates. |
68+
| `to` | string \| Point | **Required.** Ending point of the dimension. Can be a selector string (e.g., `"R2"`) or a Point object with `x` and `y` coordinates. |
69+
| `text` | string | Label text to display on the dimension line (e.g., `"5mm"`, `"Critical spacing"`). |
70+
| `arrowSize` | length | Size of the arrows at each end of the dimension line. Defaults to `1mm`. |
71+
| `fontSize` | length | Height of the label text. Defaults to `1mm`. |
72+
| `color` | string | Hex color code for the dimension line, arrows, and text (e.g., `"#ffffff"`, `"#00ff00"`). |
73+
| `font` | enum | Font type for the text. Currently only `"tscircuit2024"` is supported. Optional. |
74+
| `offset` | length | Distance to offset the dimension line from the direct path between points. |
75+
| `pcbRelative` | boolean | When `true`, coordinates are relative to the parent group instead of the board origin. |
76+
| `relative` | boolean | Similar to `pcbRelative`, applies to both PCB and schematic coordinates when used inside groups. |

0 commit comments

Comments
 (0)