tsci-agent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/cli.js +280061 -0
- package/dist/skill/CHECKLIST.md +26 -0
- package/dist/skill/CLI.md +180 -0
- package/dist/skill/LICENSE +21 -0
- package/dist/skill/README.md +32 -0
- package/dist/skill/SKILL.md +163 -0
- package/dist/skill/SYNTAX.md +229 -0
- package/dist/skill/WORKFLOW.md +92 -0
- package/dist/skill/elements/analogsimulation.md +32 -0
- package/dist/skill/elements/battery.md +24 -0
- package/dist/skill/elements/board.md +23 -0
- package/dist/skill/elements/breakout.md +68 -0
- package/dist/skill/elements/breakoutpoint.md +27 -0
- package/dist/skill/elements/cadassembly.md +39 -0
- package/dist/skill/elements/cadmodel.md +31 -0
- package/dist/skill/elements/capacitor.md +28 -0
- package/dist/skill/elements/chip.md +44 -0
- package/dist/skill/elements/connector.md +125 -0
- package/dist/skill/elements/constraint.md +73 -0
- package/dist/skill/elements/copperpour.md +34 -0
- package/dist/skill/elements/coppertext.md +28 -0
- package/dist/skill/elements/courtyardcircle.md +32 -0
- package/dist/skill/elements/courtyardoutline.md +42 -0
- package/dist/skill/elements/courtyardpill.md +29 -0
- package/dist/skill/elements/courtyardrect.md +38 -0
- package/dist/skill/elements/crystal.md +28 -0
- package/dist/skill/elements/currentsource.md +26 -0
- package/dist/skill/elements/cutout.md +35 -0
- package/dist/skill/elements/diode.md +23 -0
- package/dist/skill/elements/fabricationnotedimension.md +27 -0
- package/dist/skill/elements/fabricationnotepath.md +29 -0
- package/dist/skill/elements/fabricationnoterect.md +40 -0
- package/dist/skill/elements/fabricationnotetext.md +32 -0
- package/dist/skill/elements/fiducial.md +34 -0
- package/dist/skill/elements/footprint.md +95 -0
- package/dist/skill/elements/fuse.md +28 -0
- package/dist/skill/elements/group.md +29 -0
- package/dist/skill/elements/hole.md +23 -0
- package/dist/skill/elements/inductor.md +27 -0
- package/dist/skill/elements/jumper.md +23 -0
- package/dist/skill/elements/led.md +23 -0
- package/dist/skill/elements/mosfet.md +26 -0
- package/dist/skill/elements/mountedboard.md +26 -0
- package/dist/skill/elements/net.md +27 -0
- package/dist/skill/elements/netalias.md +25 -0
- package/dist/skill/elements/netlabel.md +60 -0
- package/dist/skill/elements/opamp.md +30 -0
- package/dist/skill/elements/panel.md +24 -0
- package/dist/skill/elements/pcbkeepout.md +22 -0
- package/dist/skill/elements/pcbnotedimension.md +31 -0
- package/dist/skill/elements/pcbnoteline.md +30 -0
- package/dist/skill/elements/pcbnotepath.md +31 -0
- package/dist/skill/elements/pcbnoterect.md +30 -0
- package/dist/skill/elements/pcbnotetext.md +29 -0
- package/dist/skill/elements/pcbtrace.md +30 -0
- package/dist/skill/elements/pinheader.md +34 -0
- package/dist/skill/elements/pinout.md +26 -0
- package/dist/skill/elements/platedhole.md +34 -0
- package/dist/skill/elements/port.md +38 -0
- package/dist/skill/elements/potentiometer.md +27 -0
- package/dist/skill/elements/pushbutton.md +26 -0
- package/dist/skill/elements/resistor.md +27 -0
- package/dist/skill/elements/resonator.md +28 -0
- package/dist/skill/elements/schematicarc.md +39 -0
- package/dist/skill/elements/schematicbox.md +22 -0
- package/dist/skill/elements/schematiccell.md +26 -0
- package/dist/skill/elements/schematiccircle.md +36 -0
- package/dist/skill/elements/schematicline.md +39 -0
- package/dist/skill/elements/schematicpath.md +40 -0
- package/dist/skill/elements/schematicrect.md +38 -0
- package/dist/skill/elements/schematicrow.md +26 -0
- package/dist/skill/elements/schematicsection.md +91 -0
- package/dist/skill/elements/schematictable.md +48 -0
- package/dist/skill/elements/schematictext.md +23 -0
- package/dist/skill/elements/silkscreencircle.md +27 -0
- package/dist/skill/elements/silkscreenline.md +31 -0
- package/dist/skill/elements/silkscreenpath.md +70 -0
- package/dist/skill/elements/silkscreenrect.md +25 -0
- package/dist/skill/elements/silkscreentext.md +23 -0
- package/dist/skill/elements/smtpad.md +35 -0
- package/dist/skill/elements/solderjumper.md +21 -0
- package/dist/skill/elements/subcircuit.md +29 -0
- package/dist/skill/elements/subpanel.md +26 -0
- package/dist/skill/elements/switch.md +21 -0
- package/dist/skill/elements/symbol.md +54 -0
- package/dist/skill/elements/testpoint.md +26 -0
- package/dist/skill/elements/trace.md +28 -0
- package/dist/skill/elements/tracehint.md +24 -0
- package/dist/skill/elements/transistor.md +25 -0
- package/dist/skill/elements/via.md +30 -0
- package/dist/skill/elements/voltageprobe.md +36 -0
- package/dist/skill/elements/voltagesource.md +36 -0
- package/dist/skill/scripts/export_svgs.sh +23 -0
- package/dist/skill/scripts/fetch_ai_txt.sh +15 -0
- package/dist/skill/scripts/smoke_test.sh +48 -0
- package/dist/skill/templates/arduino-shield-led.tsx +14 -0
- package/dist/skill/templates/chip-with-pinouts.tsx +65 -0
- package/dist/skill/templates/group-layout.tsx +13 -0
- package/dist/skill/templates/minimal-board.tsx +13 -0
- package/package.json +39 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Recommended workflow
|
|
2
|
+
|
|
3
|
+
## 1) Start from a known shape
|
|
4
|
+
|
|
5
|
+
- Prefer a standard template when possible (Arduino Shield, Raspberry Pi HAT, etc.)
|
|
6
|
+
- Otherwise use `<board width height>` with explicit dimensions.
|
|
7
|
+
|
|
8
|
+
## 2) Establish rails and connectors early
|
|
9
|
+
|
|
10
|
+
- Decide net names (`net.GND`, `net.VCC`, `net.V3_3`, etc.)
|
|
11
|
+
- Add power entry (USB-C, barrel jack, header) and protection (fuse/TVS) as appropriate.
|
|
12
|
+
- For USB-C, use `<connector standard="usb_c" />` directly (no JLC import needed).
|
|
13
|
+
|
|
14
|
+
## 3) Search before you model
|
|
15
|
+
|
|
16
|
+
- Use `tsci search` to find:
|
|
17
|
+
- JLCPCB components: `tsci search --jlcpcb "STM32F4"`
|
|
18
|
+
- KiCad footprints: `tsci search --kicad "SOIC8"`
|
|
19
|
+
- Registry packages: `tsci search --tscircuit "ESP32"`
|
|
20
|
+
|
|
21
|
+
## 4) Add/import parts
|
|
22
|
+
|
|
23
|
+
- Prefer `tsci add <author/pkg>` when a reusable module exists.
|
|
24
|
+
- Use `tsci import` when you must bring in a specific component (e.g., supplier part).
|
|
25
|
+
- For JLCPCB parts: first search with `tsci search --jlcpcb "<query>"`, then import with `tsci import "<part number>"`.
|
|
26
|
+
|
|
27
|
+
## 5) Define pinLabels and pinAttributes first
|
|
28
|
+
|
|
29
|
+
**This is a critical step for chips and ICs.** Before wiring traces, ensure your components have correct `pinLabels` and `pinAttributes`.
|
|
30
|
+
|
|
31
|
+
### Getting pin information right
|
|
32
|
+
|
|
33
|
+
1. **Consult the datasheet** - Look up the component's datasheet to find the correct pin names and functions.
|
|
34
|
+
|
|
35
|
+
2. **Define pinLabels** - Map physical pin numbers to meaningful names:
|
|
36
|
+
```tsx
|
|
37
|
+
pinLabels={{
|
|
38
|
+
pin1: "VCC",
|
|
39
|
+
pin2: "GND",
|
|
40
|
+
pin3: ["SDA", "I2C_DATA"],
|
|
41
|
+
pin4: ["SCL", "I2C_CLK"],
|
|
42
|
+
}}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
3. **Add pinAttributes** - Specify pin behavior for DRC and schematic clarity:
|
|
46
|
+
```tsx
|
|
47
|
+
pinAttributes={{
|
|
48
|
+
VCC: { requiresPower: true },
|
|
49
|
+
EN: { mustBeConnected: true },
|
|
50
|
+
VOUT: { providesPower: true },
|
|
51
|
+
}}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
4. **Verify pin mappings** - Double-check that:
|
|
55
|
+
- Power pins are marked with `requiresPower` or `providesPower`
|
|
56
|
+
- Critical control pins have `mustBeConnected: true`
|
|
57
|
+
- Multi-function pins have all relevant aliases
|
|
58
|
+
|
|
59
|
+
## 6) Make a minimal, working first draft
|
|
60
|
+
|
|
61
|
+
- Place core IC + passives
|
|
62
|
+
- Wire nets using `<trace />`
|
|
63
|
+
- Reference pins by label when pinLabels are defined:
|
|
64
|
+
```tsx
|
|
65
|
+
<trace from="U1.VCC" to="net.V3_3" />
|
|
66
|
+
<trace from="U1.GND" to="net.GND" />
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 7) Iterate with `tsci build`
|
|
70
|
+
|
|
71
|
+
- Run `tsci check netlist` before `tsci check schematic-placement`, `tsci check placement`, and `tsci build` to catch connectivity issues early.
|
|
72
|
+
- Use `tsci check schematic-placement` to validate schematic-side placement before checking PCB placement.
|
|
73
|
+
- Do not finalize unless both `tsci check schematic-placement` and `tsci check placement` pass with no actionable placement violations; if violations exist, fix layout and rerun until clean.
|
|
74
|
+
- Run `tsci build` to validate changes—this is the preferred iteration method for AI-driven development.
|
|
75
|
+
- DRC (Design Rule Check) errors can often be ignored during development; focus on connectivity and component placement first.
|
|
76
|
+
- Fix connectivity errors first, then placement.
|
|
77
|
+
- Run `tsci snapshot` to inspect placement before checking routing.
|
|
78
|
+
- Run `tsci check routing-difficulty` after placement to identify potential areas of congestion.
|
|
79
|
+
- Then address routing issues.
|
|
80
|
+
- Use `tsci dev` only when interactive visual preview is needed (not typical for AI iteration).
|
|
81
|
+
|
|
82
|
+
## 8) Stabilize and regression-test
|
|
83
|
+
|
|
84
|
+
- Use `tsci build` in CI or before sharing.
|
|
85
|
+
- Use `tsci snapshot` to generate visuals that help with placement analysis and quick circuit understanding.
|
|
86
|
+
- Use `tsci snapshot --pcb-only` when you want a fast, placement-focused PCB view without schematic snapshots.
|
|
87
|
+
- Use `tsci snapshot --test` in CI/regression checks to prevent overwriting snapshots and catch unexpected visual diffs.
|
|
88
|
+
|
|
89
|
+
## 9) Export what you need
|
|
90
|
+
|
|
91
|
+
- `tsci export` for SVG/netlist/DSN/3D/library
|
|
92
|
+
- Fabrication zip (Gerbers/BOM/PnP): use the export UI after `tsci dev`
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# `<analogsimulation />`
|
|
2
|
+
|
|
3
|
+
Configure and run SPICE simulations for a tscircuit board.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board routingDisabled>
|
|
10
|
+
<voltagesource name="V1" voltage="5V" />
|
|
11
|
+
<resistor name="R1" resistance="1k" />
|
|
12
|
+
|
|
13
|
+
<trace from=".V1 > .pin1" to=".R1 > .pin1" />
|
|
14
|
+
<trace from=".V1 > .pin2" to=".R1 > .pin2" />
|
|
15
|
+
|
|
16
|
+
<voltageprobe name="VP_IN" connectsTo=".V1 > .pin1" />
|
|
17
|
+
<voltageprobe name="VP_OUT" connectsTo=".R1 > .pin1" />
|
|
18
|
+
|
|
19
|
+
<analogsimulation duration="10ms" timePerStep="0.1ms" spiceEngine="ngspice" />
|
|
20
|
+
</board>
|
|
21
|
+
)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
Commonly used: `simulationType`, `duration`, `timePerStep`, `spiceEngine`, `name`, `footprint`, `connections`
|
|
27
|
+
|
|
28
|
+
## References
|
|
29
|
+
|
|
30
|
+
- Props: [AnalogSimulationProps](https://github.com/tscircuit/props#analogsimulationprops-analogsimulation)
|
|
31
|
+
- Source: [lib/components/analogsimulation.ts](https://github.com/tscircuit/props/blob/main/lib/components/analogsimulation.ts)
|
|
32
|
+
- Local docs: [docs/docs/elements/analogsimulation.mdx](../docs/docs/elements/analogsimulation.mdx)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# `<battery />`
|
|
2
|
+
|
|
3
|
+
A `<battery />` is a power source that provides electrical energy through electrochemical reactions. Batteries are essential components that supply power to electronic circuits and devices. They have a positive and negative terminal and must be connected with correct polarity.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<battery
|
|
10
|
+
name="BAT1"
|
|
11
|
+
capacity="2500mAh"
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
Commonly used: `capacity`, `voltage`, `standard`, `schOrientation`, `name`, `footprint`, `connections`
|
|
19
|
+
|
|
20
|
+
## References
|
|
21
|
+
|
|
22
|
+
- Props: [BatteryProps](https://github.com/tscircuit/props#batteryprops-battery)
|
|
23
|
+
- Source: [lib/components/battery.ts](https://github.com/tscircuit/props/blob/main/lib/components/battery.ts)
|
|
24
|
+
- Local docs: [docs/docs/elements/battery.mdx](../docs/docs/elements/battery.mdx)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# `<board />`
|
|
2
|
+
|
|
3
|
+
Root element that contains all chips and traces to create a printed circuit board.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board width="10mm" height="10mm">
|
|
10
|
+
<resistor resistance="1k" footprint="0402" name="R1" />
|
|
11
|
+
</board>
|
|
12
|
+
)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
Commonly used: `title`, `material`, `layers`, `borderRadius`, `thickness`, `boardAnchorPosition`, `anchorAlignment`, `boardAnchorAlignment`
|
|
18
|
+
|
|
19
|
+
## References
|
|
20
|
+
|
|
21
|
+
- Props: [BoardProps](https://github.com/tscircuit/props#boardprops-board)
|
|
22
|
+
- Source: [lib/components/board.ts](https://github.com/tscircuit/props/blob/main/lib/components/board.ts)
|
|
23
|
+
- Local docs: [docs/docs/elements/board.mdx](../docs/docs/elements/board.mdx)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# `<breakout />`
|
|
2
|
+
|
|
3
|
+
A `<breakout />` is similar to a [`<group />`](./group.md) but is meant for situations where you want to guide the autorouter on where connections should exit the group. Inside a breakout you can place [`<breakoutpoint />`](./breakoutpoint.md) elements to define explicit exit locations, or let tscircuit generate breakout points automatically for connections that leave the breakout.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board width="20mm" height="20mm">
|
|
10
|
+
<breakout autorouter="auto">
|
|
11
|
+
<resistor name="R1" resistance="1k" footprint="0402" pcbX={0} pcbY={0} />
|
|
12
|
+
<capacitor name="C1" capacitance="1uF" footprint="0402" pcbX={2} pcbY={0} />
|
|
13
|
+
<trace from="R1.2" to="C1.1" />
|
|
14
|
+
<breakoutpoint connection="R1.1" pcbX={5} pcbY={5} />
|
|
15
|
+
</breakout>
|
|
16
|
+
</board>
|
|
17
|
+
)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Auto-generated breakout points
|
|
21
|
+
|
|
22
|
+
When traces connect from components inside a `<breakout />` to components outside of it, tscircuit creates the needed breakout points automatically — no manual `<breakoutpoint />` required. This keeps the breakout local to the component cluster while still letting board-level traces reach headers and surrounding parts.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
export default () => (
|
|
26
|
+
<board width="20mm" height="16mm">
|
|
27
|
+
<breakout name="MCU_BREAKOUT" padding="1mm">
|
|
28
|
+
<chip
|
|
29
|
+
name="U1"
|
|
30
|
+
footprint="qfp16"
|
|
31
|
+
pinLabels={{ pin1: "GPIO1", pin5: "VCC", pin6: "GND", pin7: "SDA", pin8: "SCL" }}
|
|
32
|
+
pcbX={0}
|
|
33
|
+
pcbY={0}
|
|
34
|
+
/>
|
|
35
|
+
<capacitor name="C1" capacitance="100nF" footprint="0402" pcbX={-3.5} pcbY={2.4} />
|
|
36
|
+
<trace from="C1.1" to="U1.GPIO1" />
|
|
37
|
+
</breakout>
|
|
38
|
+
<pinheader
|
|
39
|
+
name="J1"
|
|
40
|
+
pinCount={4}
|
|
41
|
+
footprint="pinrow4"
|
|
42
|
+
pinLabels={["VCC", "GND", "SDA", "SCL"]}
|
|
43
|
+
pcbX={7}
|
|
44
|
+
pcbY={0}
|
|
45
|
+
pcbRotation={90}
|
|
46
|
+
/>
|
|
47
|
+
<trace from="J1.VCC" to="U1.VCC" />
|
|
48
|
+
<trace from="J1.GND" to="U1.GND" />
|
|
49
|
+
<trace from="J1.SDA" to="U1.SDA" />
|
|
50
|
+
<trace from="J1.SCL" to="U1.SCL" />
|
|
51
|
+
</board>
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Props
|
|
56
|
+
|
|
57
|
+
`<breakout />` accepts all the layout props of `<group />` plus:
|
|
58
|
+
|
|
59
|
+
- `padding` — uniform padding around the breakout region
|
|
60
|
+
- `paddingLeft` / `paddingRight` / `paddingTop` / `paddingBottom` — per-side padding
|
|
61
|
+
- `autorouter` — autorouter configuration inherited by children
|
|
62
|
+
|
|
63
|
+
## References
|
|
64
|
+
|
|
65
|
+
- Props: [BreakoutProps](https://github.com/tscircuit/props#breakoutprops-breakout)
|
|
66
|
+
- Source: [lib/components/breakout.ts](https://github.com/tscircuit/props/blob/main/lib/components/breakout.ts)
|
|
67
|
+
- Related: [`<breakoutpoint />`](./breakoutpoint.md), [`<group />`](./group.md)
|
|
68
|
+
- Docs: https://docs.tscircuit.com/elements/breakout
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# `<breakoutpoint />`
|
|
2
|
+
|
|
3
|
+
A `<breakoutpoint />` defines an explicit location where a connection should exit a [`<breakout />`](./breakout.md). Use it when you want to control exactly where a net escapes the breakout region instead of relying on auto-generated breakout points.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board width="20mm" height="20mm">
|
|
10
|
+
<breakout>
|
|
11
|
+
<resistor name="R1" resistance="1k" footprint="0402" pcbX={0} pcbY={0} />
|
|
12
|
+
<breakoutpoint connection="R1.1" pcbX={5} pcbY={5} />
|
|
13
|
+
</breakout>
|
|
14
|
+
</board>
|
|
15
|
+
)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Props
|
|
19
|
+
|
|
20
|
+
Commonly used: `connection` (the pin selector that should exit at this point), `pcbX`, `pcbY`
|
|
21
|
+
|
|
22
|
+
## References
|
|
23
|
+
|
|
24
|
+
- Props: [BreakoutPointProps](https://github.com/tscircuit/props#breakoutpointprops-breakoutpoint)
|
|
25
|
+
- Source: [lib/components/breakout-point.ts](https://github.com/tscircuit/props/blob/main/lib/components/breakout-point.ts)
|
|
26
|
+
- Related: [`<breakout />`](./breakout.md)
|
|
27
|
+
- Docs: https://docs.tscircuit.com/elements/breakoutpoint
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# `<cadassembly />`
|
|
2
|
+
|
|
3
|
+
A CAD assembly is a collection of cad models and constraints to "put together" a component.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board width="10mm" height="10mm">
|
|
10
|
+
<chip
|
|
11
|
+
name="J1"
|
|
12
|
+
cadModel={
|
|
13
|
+
<cadassembly>
|
|
14
|
+
<cadmodel
|
|
15
|
+
positionOffset={{ x: 0, y: -4, z: 0 }}
|
|
16
|
+
rotationOffset={{ x: 0, y: 0, z: 0 }}
|
|
17
|
+
modelUrl="https://modelcdn.tscircuit.com/jscad_models/pinrow4.glb"
|
|
18
|
+
/>
|
|
19
|
+
<cadmodel
|
|
20
|
+
positionOffset={{ x: 0, y: 4, z: 0 }}
|
|
21
|
+
rotationOffset={{ x: 0, y: 0, z: 0 }}
|
|
22
|
+
modelUrl="https://modelcdn.tscircuit.com/jscad_models/pinrow4.glb"
|
|
23
|
+
/>
|
|
24
|
+
</cadassembly>
|
|
25
|
+
}
|
|
26
|
+
/>
|
|
27
|
+
</board>
|
|
28
|
+
)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Props
|
|
32
|
+
|
|
33
|
+
Commonly used: `originalLayer`, `children`, `name`, `footprint`, `connections`
|
|
34
|
+
|
|
35
|
+
## References
|
|
36
|
+
|
|
37
|
+
- Props: [CadAssemblyProps](https://github.com/tscircuit/props#cadassemblyprops-cadassembly)
|
|
38
|
+
- Source: [lib/components/cadassembly.ts](https://github.com/tscircuit/props/blob/main/lib/components/cadassembly.ts)
|
|
39
|
+
- Local docs: [docs/docs/elements/cadassembly.mdx](../docs/docs/elements/cadassembly.mdx)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# `<cadmodel />`
|
|
2
|
+
|
|
3
|
+
A CAD model is a 3D model of a component that can be used in a CAD assembly.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board>
|
|
10
|
+
<chip
|
|
11
|
+
name="U1"
|
|
12
|
+
footprint="soic8"
|
|
13
|
+
cadModel={
|
|
14
|
+
<cadmodel
|
|
15
|
+
modelUrl="https://modelcdn.tscircuit.com/jscad_models/soic8.glb"
|
|
16
|
+
/>
|
|
17
|
+
}
|
|
18
|
+
/>
|
|
19
|
+
</board>
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
Commonly used: `modelUrl`, `stepUrl`, `pcbX`, `pcbY`, `pcbLeftEdgeX`, `pcbRightEdgeX`, `pcbTopEdgeY`, `pcbBottomEdgeY`
|
|
26
|
+
|
|
27
|
+
## References
|
|
28
|
+
|
|
29
|
+
- Props: [CadModelProps](https://github.com/tscircuit/props#cadmodelprops-cadmodel)
|
|
30
|
+
- Source: [lib/components/cadmodel.ts](https://github.com/tscircuit/props/blob/main/lib/components/cadmodel.ts)
|
|
31
|
+
- Local docs: [docs/docs/elements/cadmodel.mdx](../docs/docs/elements/cadmodel.mdx)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# `<capacitor />`
|
|
2
|
+
|
|
3
|
+
A `<capacitor />` stores electrical energy in an electric field. Capacitors are commonly used for filtering, energy storage, and timing circuits. Unlike resistors, capacitors can be polarized (like electrolytic capacitors) or non-polarized (like ceramic capacitors).
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board width="10mm" height="10mm">
|
|
10
|
+
<capacitor
|
|
11
|
+
name="C2"
|
|
12
|
+
footprint="axial_p5mm"
|
|
13
|
+
capacitance="10μF"
|
|
14
|
+
polarized
|
|
15
|
+
/>
|
|
16
|
+
</board>
|
|
17
|
+
)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
|
|
22
|
+
Commonly used: `capacitance`, `maxVoltageRating`, `schShowRatings`, `polarized`, `decouplingFor`, `decouplingTo`, `bypassFor`, `bypassTo`
|
|
23
|
+
|
|
24
|
+
## References
|
|
25
|
+
|
|
26
|
+
- Props: [CapacitorProps](https://github.com/tscircuit/props#capacitorprops-capacitor)
|
|
27
|
+
- Source: [lib/components/capacitor.ts](https://github.com/tscircuit/props/blob/main/lib/components/capacitor.ts)
|
|
28
|
+
- Local docs: [docs/docs/elements/capacitor.mdx](../docs/docs/elements/capacitor.mdx)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# `<chip />`
|
|
2
|
+
|
|
3
|
+
Used to represent virtually any single-part electronic component. Extremely flexible and supports custom footprints and pin arrangements.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import type { CommonLayoutProps } from "tscircuit"
|
|
9
|
+
|
|
10
|
+
interface Props extends CommonLayoutProps {
|
|
11
|
+
name: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const A555Timer = (props: Props) => {
|
|
15
|
+
return (
|
|
16
|
+
<board width="10mm" height="10mm">
|
|
17
|
+
<chip
|
|
18
|
+
footprint="soic8"
|
|
19
|
+
pinLabels={{
|
|
20
|
+
pin1: "VCC",
|
|
21
|
+
pin2: "DISCH",
|
|
22
|
+
pin3: "THRES",
|
|
23
|
+
pin4: "CTRL",
|
|
24
|
+
pin5: "GND",
|
|
25
|
+
pin6: "TRIG",
|
|
26
|
+
pin7: "OUT",
|
|
27
|
+
pin8: "RESET"
|
|
28
|
+
}}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
</board>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Props
|
|
37
|
+
|
|
38
|
+
Commonly used: `manufacturerPartNumber`, `pinLabels`, `showPinAliases`, `pcbPinLabels`, `schPinArrangement`, `schPortArrangement`, `pinCompatibleVariants`, `schPinStyle`
|
|
39
|
+
|
|
40
|
+
## References
|
|
41
|
+
|
|
42
|
+
- Props: [ChipProps](https://github.com/tscircuit/props#chipprops-chip)
|
|
43
|
+
- Source: [lib/components/chip.ts](https://github.com/tscircuit/props/blob/main/lib/components/chip.ts)
|
|
44
|
+
- Local docs: [docs/docs/elements/chip.mdx](../docs/docs/elements/chip.mdx)
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# `<connector />`
|
|
2
|
+
|
|
3
|
+
A general-purpose connector component for board-to-board, cable, and edge interfaces.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board width="40mm" height="40mm">
|
|
10
|
+
<connector
|
|
11
|
+
name="J1"
|
|
12
|
+
manufacturerPartNumber="AF_QTZB1_0"
|
|
13
|
+
pinLabels={{
|
|
14
|
+
pin1: ["VCC"],
|
|
15
|
+
pin2: ["D_NEG"],
|
|
16
|
+
pin3: ["D_POS"],
|
|
17
|
+
pin4: ["GND"],
|
|
18
|
+
pin5: ["EH1"],
|
|
19
|
+
pin6: ["EH2"],
|
|
20
|
+
}}
|
|
21
|
+
footprint={
|
|
22
|
+
<footprint>
|
|
23
|
+
<hole pcbX="-2.5mm" pcbY="-2.125mm" diameter="1.3mm" />
|
|
24
|
+
<hole pcbX="2.5mm" pcbY="-2.125mm" diameter="1.3mm" />
|
|
25
|
+
<smtpad
|
|
26
|
+
portHints={["pin1"]}
|
|
27
|
+
pcbX="-3.5mm"
|
|
28
|
+
pcbY="1.575mm"
|
|
29
|
+
width="1.1mm"
|
|
30
|
+
height="3.8mm"
|
|
31
|
+
shape="rect"
|
|
32
|
+
/>
|
|
33
|
+
<smtpad
|
|
34
|
+
portHints={["pin2"]}
|
|
35
|
+
pcbX="-1mm"
|
|
36
|
+
pcbY="1.575mm"
|
|
37
|
+
width="1.1mm"
|
|
38
|
+
height="3.8mm"
|
|
39
|
+
shape="rect"
|
|
40
|
+
/>
|
|
41
|
+
<smtpad
|
|
42
|
+
portHints={["pin3"]}
|
|
43
|
+
pcbX="1mm"
|
|
44
|
+
pcbY="1.575mm"
|
|
45
|
+
width="1.1mm"
|
|
46
|
+
height="3.8mm"
|
|
47
|
+
shape="rect"
|
|
48
|
+
/>
|
|
49
|
+
<smtpad
|
|
50
|
+
portHints={["pin4"]}
|
|
51
|
+
pcbX="3.5mm"
|
|
52
|
+
pcbY="1.575mm"
|
|
53
|
+
width="1.1mm"
|
|
54
|
+
height="3.8mm"
|
|
55
|
+
shape="rect"
|
|
56
|
+
/>
|
|
57
|
+
<smtpad
|
|
58
|
+
portHints={["pin5"]}
|
|
59
|
+
pcbX="7.15mm"
|
|
60
|
+
pcbY="-1.475mm"
|
|
61
|
+
width="1.8mm"
|
|
62
|
+
height="4mm"
|
|
63
|
+
shape="rect"
|
|
64
|
+
/>
|
|
65
|
+
<smtpad
|
|
66
|
+
portHints={["pin6"]}
|
|
67
|
+
pcbX="-7.15mm"
|
|
68
|
+
pcbY="-1.475mm"
|
|
69
|
+
width="1.8mm"
|
|
70
|
+
height="4mm"
|
|
71
|
+
shape="rect"
|
|
72
|
+
/>
|
|
73
|
+
</footprint>
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
</board>
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## USB-C standard example
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
export default () => (
|
|
84
|
+
<board width="20mm" height="20mm">
|
|
85
|
+
<connector name="USBC" standard="usb_c" pcbX={0} pcbY={0} />
|
|
86
|
+
</board>
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Accessible orientation warning
|
|
91
|
+
|
|
92
|
+
Placement checks can warn when a connector faces away from the nearest board edge:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
J1 is facing x+ but should face x- so the connector is accessible from the board edge
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For side-entry connectors, place the connector near the board edge it should face, then use `pcbRotation` if needed so the cable or mating part enters from that edge.
|
|
99
|
+
|
|
100
|
+
For vertical-entry connectors, such as a battery connector inserted from above, set `insertionDirection="from_above"` on the `<footprint />`. This tells the checker that the connector does not need to face a board edge.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
<connector
|
|
104
|
+
name="J1"
|
|
105
|
+
pcbX="0"
|
|
106
|
+
pcbY="0"
|
|
107
|
+
footprint={
|
|
108
|
+
<footprint insertionDirection="from_above">
|
|
109
|
+
{/* pads / holes */}
|
|
110
|
+
</footprint>
|
|
111
|
+
}
|
|
112
|
+
/>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Other insertion directions are `from_left`, `from_right`, `from_front`, and `from_back`.
|
|
116
|
+
|
|
117
|
+
## Props
|
|
118
|
+
|
|
119
|
+
Commonly used: `standard`, `name`, `footprint`, `connections`
|
|
120
|
+
|
|
121
|
+
## References
|
|
122
|
+
|
|
123
|
+
- Props: [ConnectorProps](https://github.com/tscircuit/props#connectorprops-connector)
|
|
124
|
+
- Source: [lib/components/connector.ts](https://github.com/tscircuit/props/blob/main/lib/components/connector.ts)
|
|
125
|
+
- Local docs: [docs/docs/elements/connector.mdx](../docs/docs/elements/connector.mdx)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# `<constraint />`
|
|
2
|
+
|
|
3
|
+
The `<constraint />` element is used to enforce geometric relationships between different elements in a PCB footprint. Constraints can set specific distances and alignments, such as center-to-center, edge-to-edge, or ensuring two elements line up along the same axis.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
/**
|
|
9
|
+
* A switch shaft you can use to connect a pluggable Kailh socket.
|
|
10
|
+
*/
|
|
11
|
+
const KeyswitchSocket = (props: {
|
|
12
|
+
name: string
|
|
13
|
+
pcbX?: number
|
|
14
|
+
pcbY?: number
|
|
15
|
+
layer?: "top" | "bottom"
|
|
16
|
+
}) => (
|
|
17
|
+
<chip
|
|
18
|
+
{...props}
|
|
19
|
+
cadModel={{
|
|
20
|
+
objUrl: "/easyeda/C5184526",
|
|
21
|
+
}}
|
|
22
|
+
footprint={
|
|
23
|
+
<footprint>
|
|
24
|
+
{/* <silkscreentext text={props.name} /> */}
|
|
25
|
+
<smtpad
|
|
26
|
+
shape="rect"
|
|
27
|
+
width="2.55mm"
|
|
28
|
+
height="2.5mm"
|
|
29
|
+
portHints={["pin1"]}
|
|
30
|
+
layer="top"
|
|
31
|
+
/>
|
|
32
|
+
<smtpad
|
|
33
|
+
shape="rect"
|
|
34
|
+
width="2.55mm"
|
|
35
|
+
height="2.5mm"
|
|
36
|
+
portHints={["pin2"]}
|
|
37
|
+
layer="top"
|
|
38
|
+
/>
|
|
39
|
+
<hole name="H1" diameter="3mm" />
|
|
40
|
+
<hole name="H2" diameter="3mm" />
|
|
41
|
+
<constraint xDist="6.35mm" centerToCenter left=".H1" right=".H2" />
|
|
42
|
+
<constraint yDist="2.54mm" centerToCenter top=".H1" bottom=".H2" />
|
|
43
|
+
<constraint edgeToEdge xDist="11.3mm" left=".pin1" right=".pin2" />
|
|
44
|
+
<constraint sameY for={[".pin1", ".H1"]} />
|
|
45
|
+
<constraint sameY for={[".pin2", ".H2"]} />
|
|
46
|
+
<constraint
|
|
47
|
+
edgeToEdge
|
|
48
|
+
xDist={(11.3 - 6.35 - 3) / 2}
|
|
49
|
+
left=".pin1"
|
|
50
|
+
right=".H1"
|
|
51
|
+
/>
|
|
52
|
+
</footprint>
|
|
53
|
+
}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
export default () => (
|
|
58
|
+
<board width="40mm" height="40mm">
|
|
59
|
+
<KeyswitchSocket name="SW1" pcbX={-10} pcbY={0} layer="top" />
|
|
60
|
+
<KeyswitchSocket name="SW2" pcbX={10} pcbY={0} layer="bottom" />
|
|
61
|
+
</board>
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Props
|
|
66
|
+
|
|
67
|
+
Commonly used: `pcb`, `xDist`, `left`, `right`, `edgeToEdge`, `centerToCenter`, `yDist`, `top`
|
|
68
|
+
|
|
69
|
+
## References
|
|
70
|
+
|
|
71
|
+
- Props: [ConstraintProps](https://github.com/tscircuit/props#constraintprops-constraint)
|
|
72
|
+
- Source: [lib/components/constraint.ts](https://github.com/tscircuit/props/blob/main/lib/components/constraint.ts)
|
|
73
|
+
- Local docs: [docs/docs/footprints/constraint.mdx](../docs/docs/footprints/constraint.mdx)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# `<copperpour />`
|
|
2
|
+
|
|
3
|
+
The `<copperpour />` element (also known as a groundplane) fills large areas of a layer with copper tied to a specific net, helping with return paths, shielding, and thermal performance.
|
|
4
|
+
|
|
5
|
+
Local long-form docs currently live in `docs/docs/elements/groundplane.mdx`.
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
export default () => (
|
|
11
|
+
<board
|
|
12
|
+
width="30mm"
|
|
13
|
+
height="20mm"
|
|
14
|
+
>
|
|
15
|
+
<chip name="U1" footprint="soic8" pcbX={-6} pcbY={0} />
|
|
16
|
+
<resistor name="R1" resistance="10k" footprint="0402" pcbX={6} pcbY={4} />
|
|
17
|
+
<capacitor name="C1" capacitance="100nF" footprint="0402" pcbX={6} pcbY={-4} />
|
|
18
|
+
<trace from=".R1 > .pin2" to="net.GND" />
|
|
19
|
+
<trace from=".C1 > .pin2" to="net.GND" />
|
|
20
|
+
<trace from=".U1 > .pin4" to="net.GND" />
|
|
21
|
+
<copperpour connectsTo="net.GND" layer="top" clearance="0.15mm" />
|
|
22
|
+
</board>
|
|
23
|
+
)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
Commonly used: `name`, `layer`, `connectsTo`, `padMargin`, `traceMargin`, `clearance`, `boardEdgeMargin`, `cutoutMargin`
|
|
29
|
+
|
|
30
|
+
## References
|
|
31
|
+
|
|
32
|
+
- Props: [CopperPourProps](https://github.com/tscircuit/props#copperpourprops-copperpour)
|
|
33
|
+
- Source: [lib/components/copper-pour.ts](https://github.com/tscircuit/props/blob/main/lib/components/copper-pour.ts)
|
|
34
|
+
- Local docs: [docs/docs/elements/groundplane.mdx](../docs/docs/elements/groundplane.mdx)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# `<coppertext />`
|
|
2
|
+
|
|
3
|
+
Copper-layer text for labels, logos, and exposed copper markings.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
export default () => (
|
|
9
|
+
<board width="20mm" height="10mm">
|
|
10
|
+
<coppertext
|
|
11
|
+
text="GND"
|
|
12
|
+
pcbX={0}
|
|
13
|
+
pcbY={0}
|
|
14
|
+
layers={["top"]}
|
|
15
|
+
fontSize="2mm"
|
|
16
|
+
/>
|
|
17
|
+
</board>
|
|
18
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
Commonly used: `text`, `anchorAlignment`, `font`, `fontSize`, `layers`, `knockout`, `mirrored`, `pcbX`
|
|
24
|
+
|
|
25
|
+
## References
|
|
26
|
+
|
|
27
|
+
- Props: [CopperTextProps](https://github.com/tscircuit/props#coppertextprops-coppertext)
|
|
28
|
+
- Source: [lib/components/copper-text.ts](https://github.com/tscircuit/props/blob/main/lib/components/copper-text.ts)
|