A 3D printed circuit board viewer for tscircuit.
Documentation · Website · Twitter · Discord · Quickstart · Online Playground
- 3D visualization of PCB layouts
- Interactive camera controls (pan, zoom, rotate)
- Support for various PCB components (resistors, capacitors, Chips, etc.)
- Customizable board and component rendering
npm install @tscircuit/3d-viewer
import React from "react"
import { CadViewer } from "@tscircuit/3d-viewer"
const MyPCBViewer = () => {
return (
<CadViewer>
<board width="20mm" height="20mm">
<resistor
name="R1"
footprint="0805"
resistance="10k"
pcbX={5}
pcbY={5}
/>
<capacitor
name="C1"
footprint="0603"
capacitance="1uF"
pcbX={-4}
pcbY={0}
/>
</board>
</CadViewer>
)
}
export default MyPCBViewer
import React from "react"
import { CadViewer } from "@tscircuit/3d-viewer"
import mySoupData from "./mySoupData.json"
const MyPCBViewer = () => {
return <CadViewer soup={mySoupData} />
}
export default MyPCBViewer
Main component for rendering the 3D PCB viewer.
Props:
soup
: (optional) An array of AnySoupElement objects representing the PCB layout.children
: (optional) React children elements describing the PCB layout (alternative to usingsoup
).
Defines the PCB board dimensions.
Props:
width
: Width of the board (e.g., "20mm").height
: Height of the board (e.g., "20mm").
Various component elements can be used as children of the <board>
element:
<resistor>
<capacitor>
<chip>
<bug>
(for ICs)
Each component has specific props for defining its characteristics and position on the board.
You can define custom 3D models for components using the cadModel
prop:
<chip
name="U1"
footprint="soic8"
cadModel={{
objUrl: "/path/to/custom-model.obj",
mtlUrl: "/path/to/custom-material.mtl",
}}
/>
For more complex or programmatically defined models, you can use JSCAD:
<bug
footprint="soic8"
name="U1"
cadModel={{
jscad: {
type: "cube",
size: 5,
},
}}
/>
We welcome contributions! Please see our Contributing Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for details.