circuit-json
v0.0.433
Published
Definitions for the tscircuit intermediary JSON format
Readme
Circuit JSON Specification circuit-json
Circuit JSON a low-level JSON-array circuit representation. It contains all the information needed to visually represent a schematic, PCB, produce Gerber files, produce bill of materials, run SPICE simulations, view warnings and more. It is designed to easily interoperate with a SQL database.
tscircuit · discord · online circuit json viewer · example.json · Introduction to Circuit JSON Video
You can think of Circuit JSON as a big JSON array of "Circuit Elements", each
element can have references to other elements, for example a source_component
has a corresponding pcb_component representation, which has a corresponding
set of pcb_ports and is connected via pcb_traces.
If you generated Circuit JSON, you can use a wide range of utilities and libraries provided by tscircuit. For example, if you want to autoroute a PCB, you could use Circuit JSON as an input to the tscircuit dsn-converter to generate a DSN file for freerouting, you could then read the DSN file back to Circuit JSON.
This module has the zod definitions and conversion functions for using circuit json, and is the primary way that Circuit JSON is defined and maintained.
https://github.com/user-attachments/assets/2f28b7ba-689e-4d80-85b2-5bdef84b41f8
To quickly generate Circuit JSON with tscircuit, use tscircuit/eval
Things You Can Do With Circuit JSON
- Generate Gerber files
- Generate and read Specctra DSN Autorouting files
- Generate Pick'n'Place Files
- Generate PCB and Schematic SVGs
- Generate Bill of Materials
- Generate SPICE netlists and simulations
- Display PCBs on the web
- Display Schematics on the web
- Display 3d models of electronics on the web
Table of Contents
Circuit JSON Specification
circuit-json- SourceAmbiguousPortReference
- SourceBoard
- SourceComponentBase
- SourceComponentInternalConnection
- SourceComponentMisconfiguredError
- SourceComponentPinsUnderspecifiedWarning
- SourceFailedToCreateComponentError
- SourceGroup
- SourceI2cMisconfiguredError
- SourceInterconnect
- SourceInvalidComponentPropertyError
- SourceManuallyPlacedVia
- SourceMissingManufacturerPartNumberWarning
- SourceMissingPropertyError
- SourceNet
- SourceNoGroundPinDefinedWarning
- SourceNoPowerPinDefinedWarning
- SourcePcbGroundPlane
- SourcePinAttributes
- SourcePinMissingTraceWarning
- SourcePinMustBeConnectedError
- SourcePort
- SourceProjectMetadata
- SourcePropertyIgnoredWarning
- SourceSimpleBattery
- SourceSimpleCapacitor
- SourceSimpleChip
- SourceSimpleConnector
- SourceSimpleCrystal
- SourceSimpleCurrentSource
- SourceSimpleDiode
- SourceSimpleFiducial
- SourceSimpleFuse
- SourceSimpleGround
- SourceSimpleInductor
- SourceSimpleLed
- SourceSimpleMosfet
- SourceSimpleOpAmp
- SourceSimplePinHeader
- SourceSimplePinout
- SourceSimplePotentiometer
- SourceSimplePowerSource
- SourceSimplePushButton
- SourceSimpleResistor
- SourceSimpleResonator
- SourceSimpleSwitch
- SourceSimpleTestPoint
- SourceSimpleTransistor
- SourceSimpleVoltageProbe
- SourceSimpleVoltageSource
- SourceTrace
- SourceTraceNotConnectedError
- UnknownErrorFindingPart
- PcbAutoroutingError
- PcbBoard
- PcbBreakoutPoint
- PcbComponent
- PcbComponentInvalidLayerError
- PcbComponentNotOnBoardEdgeError
- PcbComponentOutsideBoardError
- PcbConnectorNotInAccessibleOrientationWarning
- PcbCopperPour
- PcbCopperText
- PcbCourtyardCircle
- PcbCourtyardOutline
- PcbCourtyardOverlapError
- PcbCourtyardPill
- PcbCourtyardPolygon
- PcbCourtyardRect
- PcbCutout
- PcbFabricationNoteDimension
- PcbFabricationNotePath
- PcbFabricationNoteRect
- PcbFabricationNoteText
- PcbFootprintOverlapError
- PcbGroundPlane
- PcbGroundPlaneRegion
- PcbGroup
- PcbHole
- PcbManualEditConflictWarning
- PcbMissingFootprintError
- PcbNet
- PcbNoteDimension
- PcbNoteLine
- PcbNotePath
- PcbNoteRect
- PcbNoteText
- PcbPadPadClearanceError
- PcbPadTraceClearanceError
- PcbPanel
- PcbPanelizationPlacementError
- PcbPlacementError
- PcbPlatedHole
- PcbPort
- PcbPortNotConnectedError
- PcbPortNotMatchedError
- PcbRouteHints
- PcbSilkscreenCircle
- PcbSilkscreenGraphic
- PcbSilkscreenLine
- PcbSilkscreenOval
- PcbSilkscreenPath
- PcbSilkscreenPill
- PcbSilkscreenRect
- PcbSilkscreenText
- PcbSolderPaste
- PcbText
- PcbThermalSpoke
- PcbTrace
- PcbTraceError
- PcbTraceHint
- PcbTraceMissingError
- PcbTraceWarning
- PcbVia
- PcbViaClearanceError
- PcbViaTraceClearanceError
- SchematicArc
- SchematicBox
- SchematicCircle
- SchematicComponent
- SchematicDebugObject
- SchematicError
- SchematicGroup
- SchematicLayoutError
- SchematicLine
- SchematicManualEditConflictWarning
- SchematicNetLabel
- SchematicPath
- SchematicPort
- SchematicRect
- SchematicSheet
- SchematicSymbol
- SchematicTable
- SchematicTableCell
- SchematicText
- SchematicTrace
- SchematicVoltageProbe
Typescript Usage
import { any_circuit_element, simple_source_resistor } from "circuit-json"
import type { SourceSimpleResistor } from "circuit-json"
const resistor: SourceSimpleResistor = simple_source_resistor.parse({
type: "source_component",
ftype: "simple_resistor",
source_component_id: "source_component_1",
name: "R1",
resistane: "1k",
})
console.log(resistor.resistance) // 1000
// This is the common way to parse/transform any element
any_circuit_element.parse({
/* ... */
})Base Units
When there is not a string unit provided, tscircuit assumes the a "base unit" is used.
You can specify circuit json with string units to avoid ambiguity around
units, for example by specifying { max_trace_length: "100mm" } avoids needing to know
the base unit. However if a number is specified, it should be in the base units in the
table below. In this case { max_trace_length: 100 } is equivalent.
The default units when reading a number are defined as follows:
| Measurement Type | Base Unit | Description | | ---------------- | --------- | ------------------ | | Length | mm | Millimeters | | Duration | ms | Milliseconds | | Timestamp | string | ISO 8601 Timestamp | | Mass | g | Grams | | Angle | deg | Degrees | | Frequency | Hz | Hertz | | Volume | ml | Milliliters | | Voltage | V | Volts | | Current | A | Amperes | | Resistance | Ω | Ohms | | Capacitance | F | Farads | | Inductance | H | Henries |
Element Prefixes
Element prefixes are used to separate data that's used in different contexts. This allows developers who use Circuit JSON to develop partial implementations with smaller targets in mind. It can also help simplify JSON elements because schematic and pcb information is not contained in the same object.
A single <resistor /> (in tscircuit) will have a corresponding source_component, schematic_component and pcb_component, as well as other elements that may be necessary
to represent it.
There are 3 main element prefixes:
source_- e.g.source_componentAn element that contains information from whatever originally defined the entity. You can think of this as a non-target representations.- For example, you might have
supplier_part_numbersas a property here, since that is not strictly related to thepcbor theschematic. - This category sometimes contains information that is relevant to both the
pcband theschematic - This is a somewhat a "Miscellaneous" category, because it contains things from the source definition that we wouldn't want to lose.
- For example, you might have
pcb_- e.g.pcb_component,pcb_port. Anything required to render the PCBschematic_- e.g.schematic_component. Anything required to render the Schematic
Source Components
SourceAmbiguousPortReference
/** Error emitted when a port hint matches multiple non-overlapping pads,
* making the port reference ambiguous (e.g. multiple pads all named "SH" */
interface SourceAmbiguousPortReference extends BaseCircuitJsonError {
type: "source_ambiguous_port_reference"
source_ambiguous_port_reference_id: string
error_type: "source_ambiguous_port_reference"
source_port_id?: string
source_component_id?: string
}SourceBoard
Defines a board in the source domain
/** Defines a board in the source domain */
interface SourceBoard {
type: "source_board"
source_board_id: string
source_group_id: string
title?: string
}SourceComponentBase
interface SourceComponentBase {
type: "source_component"
ftype?: string
source_component_id: string
name: string
manufacturer_part_number?: string
supplier_part_numbers?: Partial<Record<SupplierName, string[]>>
display_value?: string
display_name?: string
are_pins_interchangeable?: boolean
internally_connected_source_port_ids?: string[][]
source_group_id?: string
subcircuit_id?: string
}SourceComponentInternalConnection
interface SourceComponentInternalConnection {
type: "source_component_internal_connection"
source_component_internal_connection_id: string
source_component_id: string
source_port_ids: string[]
subcircuit_id?: string
}SourceComponentMisconfiguredError
Error emitted when one or more source components have an invalid or conflicting configuration
/** Error emitted when one or more source components have an invalid or conflicting configuration */
interface SourceComponentMisconfiguredError extends BaseCircuitJsonError {
type: "source_component_misconfigured_error"
source_component_misconfigured_error_id: string
error_type: "source_component_misconfigured_error"
source_component_ids: string[]
source_port_ids?: string[]
}SourceComponentPinsUnderspecifiedWarning
Warning emitted when all ports on a source component are underspecified
/** Warning emitted when all ports on a source component are underspecified */
interface SourceComponentPinsUnderspecifiedWarning {
type: "source_component_pins_underspecified_warning"
source_component_pins_underspecified_warning_id: string
warning_type: "source_component_pins_underspecified_warning"
message: string
source_component_id: string
source_port_ids: string[]
subcircuit_id?: string
}SourceFailedToCreateComponentError
/** Error emitted when a component fails to be constructed.
* Contains details about the failure and prevents the component from being rendered. */
interface SourceFailedToCreateComponentError extends BaseCircuitJsonError {
type: "source_failed_to_create_component_error"
source_failed_to_create_component_error_id: string
error_type: "source_failed_to_create_component_error"
component_name?: string
subcircuit_id?: string
parent_source_component_id?: string
pcb_center?: {
x?: number
y?: number
}
schematic_center?: {
x?: number
y?: number
}
}SourceGroup
interface SourceGroup {
type: "source_group"
source_group_id: string
subcircuit_id?: string
parent_subcircuit_id?: string
parent_source_group_id?: string
is_subcircuit?: boolean
show_as_schematic_box?: boolean
name?: string
was_automatically_named?: boolean
}SourceI2cMisconfiguredError
Error emitted when incompatible I2C pins (e.g. SDA and SCL) are connected to the same net
/** Error emitted when incompatible I2C pins (e.g. SDA and SCL) are connected to the same net */
interface SourceI2cMisconfiguredError extends BaseCircuitJsonError {
type: "source_i2c_misconfigured_error"
source_i2c_misconfigured_error_id: string
error_type: "source_i2c_misconfigured_error"
source_port_ids: string[]
}SourceInterconnect
Defines a generic interconnect component
/** Defines a generic interconnect component */
interface SourceInterconnect extends SourceComponentBase {
ftype: "interconnect"
}SourceInvalidComponentPropertyError
The source component property is invalid
/** The source component property is invalid */
interface SourceInvalidComponentPropertyError extends BaseCircuitJsonError {
type: "source_invalid_component_property_error"
source_invalid_component_property_error_id: string
source_component_id: string
property_name: string
property_value?: unknown
expected_format?: string
subcircuit_id?: string
error_type: "source_invalid_component_property_error"
}SourceManuallyPlacedVia
Defines a via that is manually placed in the source domain
/** Defines a via that is manually placed in the source domain */
interface SourceManuallyPlacedVia {
type: "source_manually_placed_via"
source_manually_placed_via_id: string
source_group_id: string
source_net_id: string
subcircuit_id?: string
source_trace_id?: string
}SourceMissingManufacturerPartNumberWarning
Warning emitted when a standard connector is missing manufacturer part number
/** Warning emitted when a standard connector is missing manufacturer part number */
interface SourceMissingManufacturerPartNumberWarning {
type: "source_missing_manufacturer_part_number_warning"
source_missing_manufacturer_part_number_warning_id: string
warning_type: "source_missing_manufacturer_part_number_warning"
message: string
source_component_id: string
standard: string
subcircuit_id?: string
}SourceMissingPropertyError
The source code is missing a property
/** The source code is missing a property */
interface SourceMissingPropertyError extends BaseCircuitJsonError {
type: "source_missing_property_error"
source_missing_property_error_id: string
source_component_id: string
property_name: string
subcircuit_id?: string
error_type: "source_missing_property_error"
}SourceNet
interface SourceNet {
type: "source_net"
source_net_id: string
name: string
member_source_group_ids: string[]
is_power?: boolean
is_ground?: boolean
is_digital_signal?: boolean
is_analog_signal?: boolean
is_positive_voltage_source?: boolean
trace_width?: number
subcircuit_id?: string
subcircuit_connectivity_map_key?: string
}SourceNoGroundPinDefinedWarning
Warning emitted when a chip has no source ports marked as ground pins
/** Warning emitted when a chip has no source ports marked as ground pins */
interface SourceNoGroundPinDefinedWarning {
type: "source_no_ground_pin_defined_warning"
source_no_ground_pin_defined_warning_id: string
warning_type: "source_no_ground_pin_defined_warning"
message: string
source_component_id: string
source_port_ids: string[]
subcircuit_id?: string
}SourceNoPowerPinDefinedWarning
Warning emitted when a chip has no source ports with requires_power=true
/** Warning emitted when a chip has no source ports with requires_power=true */
interface SourceNoPowerPinDefinedWarning {
type: "source_no_power_pin_defined_warning"
source_no_power_pin_defined_warning_id: string
warning_type: "source_no_power_pin_defined_warning"
message: string
source_component_id: string
source_port_ids: string[]
subcircuit_id?: string
}SourcePcbGroundPlane
Defines a ground plane in the source domain
/** Defines a ground plane in the source domain */
interface SourcePcbGroundPlane {
type: "source_pcb_ground_plane"
source_pcb_ground_plane_id: string
source_group_id: string
source_net_id: string
subcircuit_id?: string
}SourcePinAttributes
interface SourcePinAttributes {
must_be_connected?: boolean
provides_power?: boolean
requires_power?: boolean
provides_ground?: boolean
requires_ground?: boolean
provides_voltage?: string | number
requires_voltage?: string | number
do_not_connect?: boolean
include_in_board_pinout?: boolean
can_use_internal_pullup?: boolean
is_using_internal_pullup?: boolean
needs_external_pullup?: boolean
can_use_internal_pulldown?: boolean
is_using_internal_pulldown?: boolean
needs_external_pulldown?: boolean
can_use_open_drain?: boolean
is_using_open_drain?: boolean
can_use_push_pull?: boolean
is_using_push_pull?: boolean
should_have_decoupling_capacitor?: boolean
recommended_decoupling_capacitor_capacitance?: string | number
is_configured_for_i2c_sda?: boolean
is_configured_for_i2c_scl?: boolean
is_configured_for_spi_mosi?: boolean
is_configured_for_spi_miso?: boolean
is_configured_for_spi_sck?: boolean
is_configured_for_spi_cs?: boolean
is_configured_for_uart_tx?: boolean
is_configured_for_uart_rx?: boolean
supports_i2c_sda?: boolean
supports_i2c_scl?: boolean
supports_spi_mosi?: boolean
supports_spi_miso?: boolean
supports_spi_sck?: boolean
supports_spi_cs?: boolean
supports_uart_tx?: boolean
supports_uart_rx?: boolean
}SourcePinMissingTraceWarning
Warning emitted when a source component pin is missing a trace connection
/** Warning emitted when a source component pin is missing a trace connection */
interface SourcePinMissingTraceWarning {
type: "source_pin_missing_trace_warning"
source_pin_missing_trace_warning_id: string
warning_type: "source_pin_missing_trace_warning"
message: string
source_component_id: string
source_port_id: string
subcircuit_id?: string
}SourcePinMustBeConnectedError
Error emitted when a pin with mustBeConnected attribute is not connected to any trace
/** Error emitted when a pin with mustBeConnected attribute is not connected to any trace */
interface SourcePinMustBeConnectedError extends BaseCircuitJsonError {
type: "source_pin_must_be_connected_error"
source_pin_must_be_connected_error_id: string
error_type: "source_pin_must_be_connected_error"
source_component_id: string
source_port_id: string
subcircuit_id?: string
}SourcePort
Defines a source port that can be connected to other components
/** Defines a source port that can be connected to other components */
interface SourcePort extends SourcePinAttributes {
type: "source_port"
pin_number?: number
port_hints?: string[]
name: string
source_port_id: string
source_component_id?: string
source_group_id?: string
most_frequently_referenced_by_name?: string
subcircuit_id?: string
subcircuit_connectivity_map_key?: string
}SourceProjectMetadata
interface SourceProjectMetadata {
type: "source_project_metadata"
name?: string
software_used_string?: string
project_url?: string
created_at?: string // ISO8601 timestamp
}SourcePropertyIgnoredWarning
The source property was ignored
/** The source property was ignored */
interface SourcePropertyIgnoredWarning {
type: "source_property_ignored_warning"
source_property_ignored_warning_id: string
source_component_id: string
property_name: string
subcircuit_id?: string
error_type: "source_property_ignored_warning"
message: string
}SourceSimpleBattery
Defines a simple battery component
/** Defines a simple battery component */
interface SourceSimpleBattery extends SourceComponentBase {
ftype: "simple_battery"
capacity: number
}SourceSimpleCapacitor
Defines a simple capacitor component
/** Defines a simple capacitor component */
interface SourceSimpleCapacitor extends SourceComponentBase {
ftype: "simple_capacitor"
capacitance: number
max_voltage_rating?: number
display_capacitance?: string
max_decoupling_trace_length?: number
}SourceSimpleChip
Defines a simple integrated circuit component
/** Defines a simple integrated circuit component */
interface SourceSimpleChip extends SourceComponentBase {
ftype: "simple_chip"
}SourceSimpleConnector
Defines a simple connector component
/** Defines a simple connector component */
interface SourceSimpleConnector extends SourceComponentBase {
ftype: "simple_connector"
standard?: "usb_c" | "m2"
}SourceSimpleCrystal
Defines a simple crystal oscillator component
/** Defines a simple crystal oscillator component */
interface SourceSimpleCrystal extends SourceComponentBase {
ftype: "simple_crystal"
frequency: number
load_capacitance?: number
pin_variant?: "two_pin" | "four_pin"
}SourceSimpleCurrentSource
Defines a simple current source component
/** Defines a simple current source component */
interface SourceSimpleCurrentSource extends SourceComponentBase {
ftype: "simple_current_source"
current: number
frequency?: number
peak_to_peak_current?: number
wave_shape: "sine" | "square" | "triangle" | "sawtooth" | "dc"
phase?: number
duty_cycle?: number
}SourceSimpleDiode
Defines a simple diode component
/** Defines a simple diode component */
interface SourceSimpleDiode extends SourceComponentBase {
ftype: "simple_diode"
}SourceSimpleFiducial
Defines a simple fiducial component
/** Defines a simple fiducial component */
interface SourceSimpleFiducial extends SourceComponentBase {
ftype: "simple_fiducial"
}SourceSimpleFuse
interface SourceSimpleFuse extends SourceComponentBase {
ftype: "simple_fuse"
current_rating_amps: number
voltage_rating_volts: number
}SourceSimpleGround
Defines a simple ground component
/** Defines a simple ground component */
interface SourceSimpleGround extends SourceComponentBase {
ftype: "simple_ground"
}SourceSimpleInductor
Defines a simple inductor component
/** Defines a simple inductor component */
interface SourceSimpleInductor extends SourceComponentBase {
ftype: "simple_inductor"
inductance: number
display_inductance?: string
max_current_rating?: number
}SourceSimpleLed
Defines a simple led component
/** Defines a simple led component */
interface SourceSimpleLed extends Omit<SourceSimpleDiode, "ftype"> {
ftype: "simple_led"
color?: string
wavelength?: string
}SourceSimpleMosfet
/** Defines a simple mosfet component
* This is a three-pin semiconductor device (source, gate, drain)
* Pin configuration is handled by the schematic port system */
interface SourceSimpleMosfet extends SourceComponentBase {
ftype: "simple_mosfet"
channel_type: "n" | "p"
mosfet_mode: "enhancement" | "depletion"
}SourceSimpleOpAmp
Defines a simple op-amp component
/** Defines a simple op-amp component */
interface SourceSimpleOpAmp extends SourceComponentBase {
ftype: "simple_op_amp"
}SourceSimplePinHeader
interface SourceSimplePinHeader extends SourceComponentBase {
ftype: "simple_pin_header"
pin_count: number
gender: "male" | "female"
}SourceSimplePinout
Defines a simple pinout component
/** Defines a simple pinout component */
interface SourceSimplePinout extends SourceComponentBase {
ftype: "simple_pinout"
}SourceSimplePotentiometer
interface SourceSimplePotentiometer extends SourceComponentBase {
ftype: "simple_potentiometer"
max_resistance: number
display_max_resistance?: string
}SourceSimplePowerSource
Defines a simple power source component
/** Defines a simple power source component */
interface SourceSimplePowerSource extends SourceComponentBase {
ftype: "simple_power_source"
voltage: number
}SourceSimplePushButton
Defines a simple push button component
/** Defines a simple push button component */
interface SourceSimplePushButton extends SourceComponentBase {
ftype: "simple_push_button"
}SourceSimpleResistor
Defines a simple resistor component
/** Defines a simple resistor component */
interface SourceSimpleResistor extends SourceComponentBase {
ftype: "simple_resistor"
resistance: number
display_resistance?: string
}SourceSimpleResonator
Defines a simple resonator component
/** Defines a simple resonator component */
interface SourceSimpleResonator extends SourceComponentBase {
ftype: "simple_resonator"
load_capacitance: number
equivalent_series_resistance?: number
frequency: number
}SourceSimpleSwitch
Defines a simple switch component
/** Defines a simple switch component */
interface SourceSimpleSwitch extends SourceComponentBase {
ftype: "simple_switch"
}SourceSimpleTestPoint
/** Defines a simple test point component
* Can be surface-mount or through-hole.
* Pad shape and dimensions configurable for different use cases. */
interface SourceSimpleTestPoint extends SourceComponentBase {
ftype: "simple_test_point"
footprint_variant?: "pad" | "through_hole"
pad_shape?: "rect" | "circle"
pad_diameter?: number | string
hole_diameter?: number | string
width?: number | string
height?: number | string
}SourceSimpleTransistor
/** Defines a simple transistor component
* This is a three-pin semiconductor device (emitter, base, collector)
* Pin configuration is handled by the schematic port system */
interface SourceSimpleTransistor extends SourceComponentBase {
ftype: "simple_transistor"
transistor_type: "npn" | "pnp"
}SourceSimpleVoltageProbe
Defines a simple voltage probe component for simulation and measurement
/** Defines a simple voltage probe component for simulation and measurement */
interface SourceSimpleVoltageProbe extends SourceComponentBase {
ftype: "simple_voltage_probe"
}SourceSimpleVoltageSource
Defines a simple voltage source component
/** Defines a simple voltage source component */
interface SourceSimpleVoltageSource extends SourceComponentBase {
ftype: "simple_voltage_source"
voltage: number
frequency?: number
peak_to_peak_voltage?: number
wave_shape?: "sinewave" | "square" | "triangle" | "sawtooth"
phase?: number
duty_cycle?: number
}SourceTrace
interface SourceTrace {
type: "source_trace"
source_trace_id: string
connected_source_port_ids: string[]
connected_source_net_ids: string[]
subcircuit_id?: string
subcircuit_connectivity_map_key?: string
max_length?: number
display_name?: string
min_trace_thickness?: number
}SourceTraceNotConnectedError
Occurs when a source trace selector does not match any ports
/** Occurs when a source trace selector does not match any ports */
interface SourceTraceNotConnectedError extends BaseCircuitJsonError {
type: "source_trace_not_connected_error"
source_trace_not_connected_error_id: string
error_type: "source_trace_not_connected_error"
subcircuit_id?: string
source_group_id?: string
source_trace_id?: string
connected_source_port_ids?: string[]
selectors_not_found?: string[]
}UnknownErrorFindingPart
/** Error emitted when an unexpected error occurs while finding a part.
* This includes cases where the API returns HTML instead of JSON,
* network failures, or other unexpected responses. */
interface UnknownErrorFindingPart extends BaseCircuitJsonError {
type: "unknown_error_finding_part"
unknown_error_finding_part_id: string
error_type: "unknown_error_finding_part"
source_component_id?: string
subcircuit_id?: string
}CAD Components
CadComponent
interface CadComponent {
type: "cad_component"
cad_component_id: string
pcb_component_id: string
source_component_id: string
position: Point3
rotation?: Point3
size?: Point3
layer?: LayerRef
subcircuit_id?: string
footprinter_string?: string
model_obj_url?: string
model_stl_url?: string
model_3mf_url?: string
model_gltf_url?: string
model_glb_url?: string
model_step_url?: string
model_wrl_url?: string
model_asset?: Asset
model_unit_to_mm_scale_factor?: number
model_board_normal_direction?: CadModelAxisDirection
model_origin_position?: Point3
model_origin_alignment?:
| "unknown"
| "center"
| "center_of_component_on_board_surface"
| "bottom_center_of_component"
model_object_fit: "contain_within_bounds" | "fill_bounds"
model_jscad?: any
show_as_translucent_model?: boolean
show_as_bounding_box?: boolean
anchor_alignment: CadComponentAnchorAlignment
}PCB Elements
PcbAutoroutingError
interface PcbAutoroutingErrorInterface extends BaseCircuitJsonError {
type: "pcb_autorouting_error"
pcb_error_id: string
error_type: "pcb_autorouting_error"
subcircuit_id?: string
}PcbBoard
Defines the board outline of the PCB
/** Defines the board outline of the PCB */
interface PcbBoard extends ManufacturingDrcProperties {
type: "pcb_board"
pcb_board_id: string
pcb_panel_id?: string
carrier_pcb_board_id?: string
is_subcircuit?: boolean
subcircuit_id?: string
is_mounted_to_carrier_board?: boolean
width?: Length
height?: Length
display_offset_x?: string
display_offset_y?: string
thickness: Length
num_layers: number
center: Point
outline?: Point[]
shape?: "rect" | "polygon"
material: "fr4" | "fr1"
solder_mask_color?: string
silkscreen_color?: string
anchor_position?: Point
anchor_alignment?: NinePointAnchor
position_mode?: "relative_to_panel_anchor" | "none"
}PcbBreakoutPoint
Defines a routing target within a pcb_group for a source_trace or source_net
/** Defines a routing target within a pcb_group for a source_trace or source_net */
interface PcbBreakoutPoint {
type: "pcb_breakout_point"
pcb_breakout_point_id: string
pcb_group_id: string
subcircuit_id?: string
source_trace_id?: string
source_port_id?: string
source_net_id?: string
x: Distance
y: Distance
}PcbComponent
interface PcbComponentMetadata {
kicad_footprint?: KicadFootprintMetadata
}PcbComponentInvalidLayerError
Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)
/** Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers) */
interface PcbComponentInvalidLayerError extends BaseCircuitJsonError {
type: "pcb_component_invalid_layer_error"
pcb_component_invalid_layer_error_id: string
error_type: "pcb_component_invalid_layer_error"
pcb_component_id?: string
source_component_id: string
layer: LayerRef
subcircuit_id?: string
}PcbComponentNotOnBoardEdgeError
Error emitted when a component that must be placed on the board edge is centered away from the edge
/** Error emitted when a component that must be placed on the board edge is centered away from the edge */
interface PcbComponentNotOnBoardEdgeError extends BaseCircuitJsonError {
type: "pcb_component_not_on_board_edge_error"
pcb_component_not_on_board_edge_error_id: string
error_type: "pcb_component_not_on_board_edge_error"
pcb_component_id: string
pcb_board_id: string
component_center: Point
pad_to_nearest_board_edge_distance: number
source_component_id?: string
subcircuit_id?: string
}PcbComponentOutsideBoardError
Error emitted when a PCB component is placed outside the board boundaries
/** Error emitted when a PCB component is placed outside the board boundaries */
interface PcbComponentOutsideBoardError extends BaseCircuitJsonError {
type: "pcb_component_outside_board_error"
pcb_component_outside_board_error_id: string
error_type: "pcb_component_outside_board_error"
pcb_component_id: string
pcb_board_id: string
component_center: Point
component_bounds: {
min_x: number
max_x: number
min_y: number
max_y: number
}
subcircuit_id?: string
source_component_id?: string
}PcbConnectorNotInAccessibleOrientationWarning
Warning emitted when a connector PCB component is facing inward toward the board and should be reoriented
/** Warning emitted when a connector PCB component is facing inward toward the board and should be reoriented */
interface PcbConnectorNotInAccessibleOrientationWarning {
type: "pcb_connector_not_in_accessible_orientation_warning"
pcb_connector_not_in_accessible_orientation_warning_id: string
warning_type: "pcb_connector_not_in_accessible_orientation_warning"
message: string
pcb_component_id: string
source_component_id?: string
pcb_board_id?: string
facing_direction: ConnectorOrientationDirection
recommended_facing_direction: ConnectorOrientationDirection
subcircuit_id?: string
}PcbCopperPour
Defines a rectangular copper pour on the PCB.
/** Defines a rectangular copper pour on the PCB. */
interface PcbCopperPourRect {
type: "pcb_copper_pour"
pcb_copper_pour_id: string
covered_with_solder_mask: boolean
pcb_group_id?: string
subcircuit_id?: string
layer: LayerRef
source_net_id?: string
shape: "rect"
center: Point
width: Length
height: Length
rotation?: Rotation
}PcbCopperText
Defines copper text on the PCB
/** Defines copper text on the PCB */
interface PcbCopperText {
type: "pcb_copper_text"
pcb_copper_text_id: string
pcb_group_id?: string
subcircuit_id?: string
font: "tscircuit2024"
font_size: Length
pcb_component_id: string
text: string
is_knockout?: boolean
knockout_padding?: {
left: Length
top: Length
bottom: Length
right: Length
}
ccw_rotation?: number
layer: LayerRef
is_mirrored?: boolean
anchor_position: Point
anchor_alignment: NinePointAnchor
}PcbCourtyardCircle
Defines a courtyard circle on the PCB
/** Defines a courtyard circle on the PCB */
interface PcbCourtyardCircle {
type: "pcb_courtyard_circle"
pcb_courtyard_circle_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
radius: Length
layer: VisibleLayer
color?: string
}PcbCourtyardOutline
Defines a courtyard outline on the PCB
/** Defines a courtyard outline on the PCB */
interface PcbCourtyardOutline {
type: "pcb_courtyard_outline"
pcb_courtyard_outline_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
layer: VisibleLayer
outline: Point[]
}PcbCourtyardOverlapError
Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another
/** Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another */
interface PcbCourtyardOverlapError extends BaseCircuitJsonError {
type: "pcb_courtyard_overlap_error"
pcb_error_id: string
error_type: "pcb_courtyard_overlap_error"
pcb_component_ids: [string, string]
}PcbCourtyardPill
Defines a courtyard pill on the PCB
/** Defines a courtyard pill on the PCB */
interface PcbCourtyardPill {
type: "pcb_courtyard_pill"
pcb_courtyard_pill_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
width: Length
height: Length
radius: Length
layer: VisibleLayer
color?: string
}PcbCourtyardPolygon
Defines a courtyard polygon on the PCB
/** Defines a courtyard polygon on the PCB */
interface PcbCourtyardPolygon {
type: "pcb_courtyard_polygon"
pcb_courtyard_polygon_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
layer: VisibleLayer
points: Point[]
color?: string
}PcbCourtyardRect
Defines a courtyard rectangle on the PCB
/** Defines a courtyard rectangle on the PCB */
interface PcbCourtyardRect {
type: "pcb_courtyard_rect"
pcb_courtyard_rect_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
width: Length
height: Length
layer: VisibleLayer
ccw_rotation?: Rotation
color?: string
}PcbCutout
Defines a rectangular cutout on the PCB.
/** Defines a rectangular cutout on the PCB. */
interface PcbCutoutRect {
type: "pcb_cutout"
pcb_cutout_id: string
pcb_group_id?: string
subcircuit_id?: string
pcb_board_id?: string
pcb_panel_id?: string
shape: "rect"
center: Point
width: Length
height: Length
rotation?: Rotation
corner_radius?: Length
}PcbFabricationNoteDimension
Defines a measurement annotation within PCB fabrication notes
/** Defines a measurement annotation within PCB fabrication notes */
interface PcbFabricationNoteDimension {
type: "pcb_fabrication_note_dimension"
pcb_fabrication_note_dimension_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
layer: VisibleLayer
from: Point
to: Point
text?: string
text_ccw_rotation?: number
offset?: Length
offset_distance?: Length
offset_direction?: {
x: number
y: number
}
font: "tscircuit2024"
font_size: Length
color?: string
arrow_size: Length
}PcbFabricationNotePath
Defines a fabrication path on the PCB for fabricators or assemblers
/** Defines a fabrication path on the PCB for fabricators or assemblers */
interface PcbFabricationNotePath {
type: "pcb_fabrication_note_path"
pcb_fabrication_note_path_id: string
pcb_component_id: string
subcircuit_id?: string
layer: LayerRef
route: Point[]
stroke_width: Length
color?: string
}PcbFabricationNoteRect
Defines a fabrication note rectangle on the PCB
/** Defines a fabrication note rectangle on the PCB */
interface PcbFabricationNoteRect {
type: "pcb_fabrication_note_rect"
pcb_fabrication_note_rect_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
width: Length
height: Length
layer: VisibleLayer
stroke_width: Length
corner_radius?: Length
is_filled?: boolean
has_stroke?: boolean
is_stroke_dashed?: boolean
color?: string
}PcbFabricationNoteText
Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators
/** Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators */
interface PcbFabricationNoteText {
type: "pcb_fabrication_note_text"
pcb_fabrication_note_text_id: string
subcircuit_id?: string
pcb_group_id?: string
font: "tscircuit2024"
font_size: Length
pcb_component_id: string
text: string
ccw_rotation?: number
layer: VisibleLayer
anchor_position: Point
anchor_alignment:
| "center"
| "top_left"
| "top_right"
| "bottom_left"
| "bottom_right"
color?: string
}PcbFootprintOverlapError
Error emitted when a pcb footprint overlaps with another element
/** Error emitted when a pcb footprint overlaps with another element */
interface PcbFootprintOverlapError extends BaseCircuitJsonError {
type: "pcb_footprint_overlap_error"
pcb_error_id: string
error_type: "pcb_footprint_overlap_error"
pcb_smtpad_ids?: string[]
pcb_plated_hole_ids?: string[]
pcb_hole_ids?: string[]
pcb_keepout_ids?: string[]
}PcbGroundPlane
Defines a ground plane on the PCB
/** Defines a ground plane on the PCB */
interface PcbGroundPlane {
type: "pcb_ground_plane"
pcb_ground_plane_id: string
source_pcb_ground_plane_id: string
source_net_id: string
pcb_group_id?: string
subcircuit_id?: string
}PcbGroundPlaneRegion
Defines a polygon region of a ground plane
/** Defines a polygon region of a ground plane */
interface PcbGroundPlaneRegion {
type: "pcb_ground_plane_region"
pcb_ground_plane_region_id: string
pcb_ground_plane_id: string
pcb_group_id?: string
subcircuit_id?: string
layer: LayerRef
points: Point[]
}PcbGroup
Defines a group of components on the PCB
/** Defines a group of components on the PCB */
interface PcbGroup {
type: "pcb_group"
pcb_group_id: string
source_group_id: string
is_subcircuit?: boolean
subcircuit_id?: string
width?: Length
height?: Length
center: Point
display_offset_x?: string
display_offset_y?: string
outline?: Point[]
anchor_position?: Point
anchor_alignment: NinePointAnchor
position_mode?: "packed" | "relative_to_group_anchor" | "none"
positioned_relative_to_pcb_group_id?: string
positioned_relative_to_pcb_board_id?: string
pcb_component_ids: string[]
child_layout_mode?: "packed" | "none"
name?: string
description?: string
layout_mode?: string
autorouter_configuration?: {
trace_clearance: Length
}
autorouter_used_string?: string
}PcbHole
Defines a circular hole on the PCB
/** Defines a circular hole on the PCB */
interface PcbHoleCircle {
type: "pcb_hole"
pcb_hole_id: string
pcb_group_id?: string
subcircuit_id?: string
pcb_component_id?: string
hole_shape: "circle"
hole_diameter: number
x: Distance
y: Distance
is_covered_with_solder_mask?: boolean
soldermask_margin?: number
}PcbManualEditConflictWarning
Warning emitted when a component has both manual placement (via manualEdits) and explicit pcbX/pcbY coordinates
/** Warning emitted when a component has both manual placement (via manualEdits) and explicit pcbX/pcbY coordinates */
interface PcbManualEditConflictWarning {
type: "pcb_manual_edit_conflict_warning"
pcb_manual_edit_conflict_warning_id: string
warning_type: "pcb_manual_edit_conflict_warning"
message: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
source_component_id: string
}PcbMissingFootprintError
Defines a placement error on the PCB
/** Defines a placement error on the PCB */
interface PcbMissingFootprintError extends BaseCircuitJsonError {
type: "pcb_missing_footprint_error"
pcb_missing_footprint_error_id: string
pcb_group_id?: string
subcircuit_id?: string
error_type: "pcb_missing_footprint_error"
source_component_id: string
}PcbNet
Defines a net on the PCB
/** Defines a net on the PCB */
interface PcbNet {
type: "pcb_net"
pcb_net_id: string
source_net_id?: string
highlight_color?: string
}PcbNoteDimension
Defines a measurement annotation within PCB documentation notes
/** Defines a measurement annotation within PCB documentation notes */
interface PcbNoteDimension {
type: "pcb_note_dimension"
pcb_note_dimension_id: string
pcb_component_id?: string
pcb_group_id?: string
subcircuit_id?: string
name?: string
from: Point
to: Point
text?: string
text_ccw_rotation?: number
offset_distance?: Length
offset_direction?: {
x: number
y: number
}
font: "tscircuit2024"
font_size: Length
layer: VisibleLayer
color?: string
arrow_size: Length
}PcbNoteLine
Defines a straight documentation note line on the PCB
/** Defines a straight documentation note line on the PCB */
interface PcbNoteLine {
type: "pcb_note_line"
pcb_note_line_id: string
pcb_component_id?: string
pcb_group_id?: string
subcircuit_id?: string
name?: string
text?: string
x1: Distance
y1: Distance
x2: Distance
y2: Distance
layer: VisibleLayer
stroke_width: Distance
color?: string
is_dashed?: boolean
}PcbNotePath
Defines a polyline documentation note on the PCB
/** Defines a polyline documentation note on the PCB */
interface PcbNotePath {
type: "pcb_note_path"
pcb_note_path_id: string
pcb_component_id?: string
pcb_group_id?: string
subcircuit_id?: string
name?: string
text?: string
route: Point[]
layer: VisibleLayer
stroke_width: Length
color?: string
}PcbNoteRect
Defines a rectangular documentation note on the PCB
/** Defines a rectangular documentation note on the PCB */
interface PcbNoteRect {
type: "pcb_note_rect"
pcb_note_rect_id: string
pcb_component_id?: string
pcb_group_id?: string
subcircuit_id?: string
name?: string
text?: string
center: Point
width: Length
height: Length
layer: VisibleLayer
stroke_width: Length
corner_radius?: Length
is_filled?: boolean
has_stroke?: boolean
is_stroke_dashed?: boolean
color?: string
}PcbNoteText
Defines a documentation note in text on the PCB
/** Defines a documentation note in text on the PCB */
interface PcbNoteText {
type: "pcb_note_text"
pcb_note_text_id: string
pcb_component_id?: string
pcb_group_id?: string
subcircuit_id?: string
name?: string
font: "tscircuit2024"
font_size: Length
text?: string
anchor_position: Point
anchor_alignment:
| "center"
| "top_left"
| "top_right"
| "bottom_left"
| "bottom_right"
layer: VisibleLayer
is_mirrored_from_top_view?: boolean
color?: string
}PcbPadPadClearanceError
Error emitted when pads are closer than the allowed clearance
/** Error emitted when pads are closer than the allowed clearance */
interface PcbPadPadClearanceError extends BaseCircuitJsonError {
type: "pcb_pad_pad_clearance_error"
pcb_pad_pad_clearance_error_id: string
error_type: "pcb_pad_pad_clearance_error"
pcb_pad_ids: string[]
minimum_clearance?: Distance
actual_clearance?: Distance
center?: {
x?: number
y?: number
}
subcircuit_id?: string
}PcbPadTraceClearanceError
Error emitted when a pad and trace are closer than allowed clearance
/** Error emitted when a pad and trace are closer than allowed clearance */
interface PcbPadTraceClearanceError extends BaseCircuitJsonError {
type: "pcb_pad_trace_clearance_error"
pcb_pad_trace_clearance_error_id: string
error_type: "pcb_pad_trace_clearance_error"
pcb_pad_id: string
pcb_trace_id: string
minimum_clearance?: Distance
actual_clearance?: Distance
center?: {
x?: number
y?: number
}
subcircuit_id?: string
}PcbPanel
Defines a PCB panel that can contain multiple boards
/** Defines a PCB panel that can contain multiple boards */
interface PcbPanel {
type: "pcb_panel"
pcb_panel_id: string
width: Length
height: Length
center: Point
thickness: Length
covered_with_solder_mask: boolean
}PcbPanelizationPlacementError
Defines a panelization placement error on the PCB
/** Defines a panelization placement error on the PCB */
interface PcbPanelizationPlacementError extends BaseCircuitJsonError {
type: "pcb_panelization_placement_error"
pcb_panelization_placement_error_id: string
error_type: "pcb_panelization_placement_error"
pcb_panel_id?: string
pcb_board_id?: string
subcircuit_id?: string
}PcbPlacementError
Defines a placement error on the PCB
/** Defines a placement error on the PCB */
interface PcbPlacementError extends BaseCircuitJsonError {
type: "pcb_placement_error"
pcb_placement_error_id: string
error_type: "pcb_placement_error"
subcircuit_id?: string
}PcbPlatedHole
Defines a circular plated hole on the PCB
/** Defines a circular plated hole on the PCB */
interface PcbPlatedHoleCircle {
type: "pcb_plated_hole"
shape: "circle"
pcb_group_id?: string
subcircuit_id?: string
outer_diameter: number
hole_diameter: number
is_covered_with_solder_mask?: boolean
x: Distance
y: Distance
layers: LayerRef[]
port_hints?: string[]
pcb_component_id?: string
pcb_port_id?: string
pcb_plated_hole_id: string
soldermask_margin?: number
}
interface PcbHolePillWithRectPad {
type: "pcb_plated_hole"
shape: "pill_hole_with_rect_pad"
pcb_group_id?: string
subcircuit_id?: string
hole_shape: "pill"
pad_shape: "rect"
hole_width: number
hole_height: number
rect_pad_width: number
rect_pad_height: number
rect_border_radius?: number
hole_offset_x: Distance
hole_offset_y: Distance
is_covered_with_solder_mask?: boolean
x: Distance
y: Distance
layers: LayerRef[]
port_hints?: string[]
pcb_component_id?: string
pcb_port_id?: string
pcb_plated_hole_id: string
soldermask_margin?: number
}
interface PcbHoleRotatedPillWithRectPad {
type: "pcb_plated_hole"
shape: "rotated_pill_hole_with_rect_pad"
pcb_group_id?: string
subcircuit_id?: string
hole_shape: "rotated_pill"
pad_shape: "rect"
hole_width: number
hole_height: number
hole_ccw_rotation: Rotation
rect_pad_width: number
rect_pad_height: number
rect_border_radius?: number
rect_ccw_rotation: Rotation
hole_offset_x: Distance
hole_offset_y: Distance
is_covered_with_solder_mask?: boolean
x: Distance
y: Distance
layers: LayerRef[]
port_hints?: string[]
pcb_component_id?: string
pcb_port_id?: string
pcb_plated_hole_id: string
soldermask_margin?: number
}
interface PcbHoleCircularWithRectPad {
type: "pcb_plated_hole"
shape: "circular_hole_with_rect_pad"
pcb_group_id?: string
subcircuit_id?: string
hole_shape: "circle"
pad_shape: "rect"
hole_diameter: number
rect_pad_width: number
rect_pad_height: number
rect_border_radius?: number
hole_offset_x: Distance
hole_offset_y: Distance
is_covered_with_solder_mask?: boolean
x: Distance
y: Distance
layers: LayerRef[]
port_hints?: string[]
pcb_component_id?: string
pcb_port_id?: string
pcb_plated_hole_id: string
soldermask_margin?: number
rect_ccw_rotation?: Rotation
}
/** Defines a plated hole with a polygonal pad on the PCB */
interface PcbHoleWithPolygonPad {
type: "pcb_plated_hole"
shape: "hole_with_polygon_pad"
pcb_group_id?: string
subcircuit_id?: string
hole_shape: "circle" | "oval" | "pill" | "rotated_pill"
hole_diameter?: number
hole_width?: number
hole_height?: number
pad_outline: { x: Distance; y: Distance }[]
hole_offset_x: Distance
hole_offset_y: Distance
is_covered_with_solder_mask?: boolean
x: Distance
y: Distance
layers: LayerRef[]
port_hints?: string