circuit-json 0.0.109 → 0.0.110

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 CHANGED
@@ -1,15 +1,90 @@
1
1
  # Circuit JSON Specification `circuit-json`
2
2
 
3
- [tscircuit](https://github.com/tscircuit/tscircuit) · [Soup Specification Docs](https://docs.tscircuit.com/api-reference/advanced/soup)
3
+ [tscircuit](https://github.com/tscircuit/tscircuit) · [discord](https://tscircuit.com/join)
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/circuit-json.svg)](https://badge.fury.io/js/circuit-json)
6
6
 
7
- Circuit JSON (formally “tscircuit soup”) is the name of the compiled intermediary low-level JSON 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.
7
+ Circuit JSON a compiled intermediary low-level JSON 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.
8
8
 
9
- This module has the zod definitions and conversion functions for using tscircuit soup.
9
+ You can think of Circuit JSON as a big JSON array of "Circuit Elements", each
10
+ element can have references to other elements, for example a `source_component`
11
+ has a corresponding `pcb_component` representation, which has a corresponding
12
+ set of `pcb_ports` and is connected via `pcb_traces`.
10
13
 
11
- > [!NOTE]
12
- > This is mostly an internal module, you probably want to use the [main tscircuit library](https://github.com/tscircuit/tscircuit) instead.
14
+ If you generated Circuit JSON, you can use a wide range of utilities and libraries
15
+ provided by tscircuit. For example, if you want to autoroute a PCB, you could
16
+ use Circuit JSON as an input to the [tscircuit dsn-converter](https://github.com/tscircuit/dsn-converter)
17
+ to generate a DSN file for [freerouting](https://github.com/freerouting/freerouting), you
18
+ could then read the DSN file back to Circuit JSON.
19
+
20
+ This module has the zod definitions and conversion functions for using circuit json,
21
+ and is the primary way that Circuit JSON is defined and maintained.
22
+
23
+ ## Things You Can Do With Circuit JSON
24
+
25
+ - Generate [Gerber files](https://github.com/tscircuit/circuit-json-to-gerber)
26
+ - Generate and read [DSN files](https://github.com/tscircuit/dsn-converter)
27
+ - Generate [Pick'n'Place Files](https://github.com/tscircuit/circuit-json-to-pnp)
28
+ - Generate [PCB and Schematic SVGs](https://github.com/tscircuit/circuit-to-svg)
29
+ - Generate [Bill of Materials](https://github.com/tscircuit/circuit-json-to-bom)
30
+ - Generate [SPICE netlists and simulations](https://github.com/tscircuit/circuit-json-to-spice)
31
+
32
+ ## Table of Contents
33
+
34
+ <!-- toc:start -->
35
+
36
+ - [Circuit JSON Specification `circuit-json`](#circuit-json-specification-circuit-json)
37
+ - [Things You Can Do With Circuit JSON](#things-you-can-do-with-circuit-json)
38
+ - [Table of Contents](#table-of-contents)
39
+ - [Typescript Usage](#typescript-usage)
40
+ - [Source Components](#source-components)
41
+ - [SourceComponentBase](#sourcecomponentbase)
42
+ - [SourceLed](#sourceled)
43
+ - [SourcePort](#sourceport)
44
+ - [SourceSimpleBattery](#sourcesimplebattery)
45
+ - [SourceSimpleCapacitor](#sourcesimplecapacitor)
46
+ - [SourceSimpleChip](#sourcesimplechip)
47
+ - [SourceSimpleCrystal](#sourcesimplecrystal)
48
+ - [SourceSimpleDiode](#sourcesimplediode)
49
+ - [SourceSimpleGround](#sourcesimpleground)
50
+ - [SourceSimpleInductor](#sourcesimpleinductor)
51
+ - [SourceSimplePowerSource](#sourcesimplepowersource)
52
+ - [SourceSimplePushButton](#sourcesimplepushbutton)
53
+ - [SourceSimpleResistor](#sourcesimpleresistor)
54
+ - [SourceTrace](#sourcetrace)
55
+ - [PCB Elements](#pcb-elements)
56
+ - [PcbBoard](#pcbboard)
57
+ - [PcbComponent](#pcbcomponent)
58
+ - [PcbFabricationNotePath](#pcbfabricationnotepath)
59
+ - [PcbFabricationNoteText](#pcbfabricationnotetext)
60
+ - [PcbMissingFootprintError](#pcbmissingfootprinterror)
61
+ - [PcbPlacementError](#pcbplacementerror)
62
+ - [PcbPort](#pcbport)
63
+ - [PcbPortNotMatchedError](#pcbportnotmatchederror)
64
+ - [PcbSilkscreenCircle](#pcbsilkscreencircle)
65
+ - [PcbSilkscreenLine](#pcbsilkscreenline)
66
+ - [PcbSilkscreenOval](#pcbsilkscreenoval)
67
+ - [PcbSilkscreenPath](#pcbsilkscreenpath)
68
+ - [PcbSilkscreenPill](#pcbsilkscreenpill)
69
+ - [PcbSilkscreenRect](#pcbsilkscreenrect)
70
+ - [PcbSilkscreenText](#pcbsilkscreentext)
71
+ - [PcbText](#pcbtext)
72
+ - [PcbTrace](#pcbtrace)
73
+ - [PcbTraceError](#pcbtraceerror)
74
+ - [PcbTraceHint](#pcbtracehint)
75
+ - [PcbVia](#pcbvia)
76
+ - [Schematic Elements](#schematic-elements)
77
+ - [SchematicBox](#schematicbox)
78
+ - [SchematicComponent](#schematiccomponent)
79
+ - [SchematicError](#schematicerror)
80
+ - [SchematicLine](#schematicline)
81
+ - [SchematicPath](#schematicpath)
82
+ - [SchematicPort](#schematicport)
83
+ - [SchematicText](#schematictext)
84
+ - [SchematicTrace](#schematictrace)
85
+ - [SchematicVoltageProbe](#schematicvoltageprobe)
86
+
87
+ ## Typescript Usage
13
88
 
14
89
  ```ts
15
90
  import { any_circuit_element, simple_source_resistor } from "circuit-json"
@@ -30,3 +105,816 @@ any_circuit_element.parse({
30
105
  /* ... */
31
106
  })
32
107
  ```
108
+
109
+ <!-- circuit-json-docs:start -->
110
+
111
+ ## Source Components
112
+
113
+ ### SourceComponentBase
114
+
115
+ ```typescript
116
+ export interface SourceComponentBase {
117
+ type: "source_component"
118
+ ftype?: string
119
+ source_component_id: string
120
+ name: string
121
+ manufacturer_part_number?: string
122
+ supplier_part_numbers?: Partial<Record<SupplierName, string[]>>
123
+ display_value?: string
124
+ }
125
+ ```
126
+
127
+ ### SourceLed
128
+
129
+ - Defines an LED component that extends the simple diode
130
+
131
+ ```typescript
132
+ /**
133
+ * Defines an LED component that extends the simple diode
134
+ */
135
+ export interface SourceLed extends SourceComponentBase {
136
+ ftype: "led"
137
+ }
138
+ ```
139
+
140
+ ### SourcePort
141
+
142
+ - Defines a source port that can be connected to other components
143
+
144
+ ```typescript
145
+ /**
146
+ * Defines a source port that can be connected to other components
147
+ */
148
+ export interface SourcePort {
149
+ type: "source_port"
150
+ pin_number?: number
151
+ port_hints?: string[]
152
+ name: string
153
+ source_port_id: string
154
+ source_component_id: string
155
+ }
156
+ ```
157
+
158
+ ### SourceSimpleBattery
159
+
160
+ - Defines a simple battery component
161
+
162
+ ```typescript
163
+ /**
164
+ * Defines a simple battery component
165
+ */
166
+ export interface SourceSimpleBattery extends SourceComponentBase {
167
+ ftype: "simple_battery"
168
+ capacity: number
169
+ }
170
+ ```
171
+
172
+ ### SourceSimpleCapacitor
173
+
174
+ - Defines a simple capacitor component
175
+
176
+ ```typescript
177
+ /**
178
+ * Defines a simple capacitor component
179
+ */
180
+ export interface SourceSimpleCapacitor extends SourceComponentBase {
181
+ ftype: "simple_capacitor"
182
+ capacitance: number
183
+ }
184
+ ```
185
+
186
+ ### SourceSimpleChip
187
+
188
+ - Defines a simple integrated circuit component
189
+
190
+ ```typescript
191
+ /**
192
+ * Defines a simple integrated circuit component
193
+ */
194
+ export interface SourceSimpleChip extends SourceComponentBase {
195
+ ftype: "simple_chip"
196
+ }
197
+ ```
198
+
199
+ ### SourceSimpleCrystal
200
+
201
+ - Defines a simple crystal oscillator component
202
+
203
+ ```typescript
204
+ /**
205
+ * Defines a simple crystal oscillator component
206
+ */
207
+ export interface SourceSimpleCrystal extends SourceComponentBase {
208
+ ftype: "simple_crystal"
209
+ frequency: number
210
+ load_capacitance?: number
211
+ }
212
+ ```
213
+
214
+ ### SourceSimpleDiode
215
+
216
+ - Defines a simple diode component
217
+
218
+ ```typescript
219
+ /**
220
+ * Defines a simple diode component
221
+ */
222
+ export interface SourceSimpleDiode extends SourceComponentBase {
223
+ ftype: "simple_diode"
224
+ }
225
+ ```
226
+
227
+ ### SourceSimpleGround
228
+
229
+ - Defines a simple ground component
230
+
231
+ ```typescript
232
+ /**
233
+ * Defines a simple ground component
234
+ */
235
+ export interface SourceSimpleGround extends SourceComponentBase {
236
+ ftype: "simple_ground"
237
+ }
238
+ ```
239
+
240
+ ### SourceSimpleInductor
241
+
242
+ - Defines a simple inductor component
243
+
244
+ ```typescript
245
+ /**
246
+ * Defines a simple inductor component
247
+ */
248
+ export interface SourceSimpleInductor extends SourceComponentBase {
249
+ ftype: "simple_inductor"
250
+ inductance: number
251
+ }
252
+ ```
253
+
254
+ ### SourceSimplePowerSource
255
+
256
+ - Defines a simple power source component
257
+
258
+ ```typescript
259
+ /**
260
+ * Defines a simple power source component
261
+ */
262
+ export interface SourceSimplePowerSource extends SourceComponentBase {
263
+ ftype: "simple_power_source"
264
+ voltage: number
265
+ }
266
+ ```
267
+
268
+ ### SourceSimplePushButton
269
+
270
+ - Defines a simple push button component
271
+
272
+ ```typescript
273
+ /**
274
+ * Defines a simple push button component
275
+ */
276
+ export interface SourceSimplePushButton extends SourceComponentBase {
277
+ ftype: "simple_push_button"
278
+ }
279
+ ```
280
+
281
+ ### SourceSimpleResistor
282
+
283
+ - Defines a simple resistor component
284
+
285
+ ```typescript
286
+ /**
287
+ * Defines a simple resistor component
288
+ */
289
+ export interface SourceSimpleResistor extends SourceComponentBase {
290
+ ftype: "simple_resistor"
291
+ resistance: number
292
+ }
293
+ ```
294
+
295
+ ### SourceTrace
296
+
297
+ ```typescript
298
+ export interface SourceTrace {
299
+ type: "source_trace"
300
+ source_trace_id: string
301
+ connected_source_port_ids: string[]
302
+ connected_source_net_ids: string[]
303
+ subcircuit_connectivity_map_key?: string
304
+ }
305
+ ```
306
+
307
+ ## PCB Elements
308
+
309
+ ### PcbBoard
310
+
311
+ - Defines the board outline of the PCB
312
+
313
+ ```typescript
314
+ /**
315
+ * Defines the board outline of the PCB
316
+ */
317
+ export interface PcbBoard {
318
+ type: "pcb_board"
319
+ pcb_board_id: string
320
+ width: Length
321
+ height: Length
322
+ thickness: Length
323
+ num_layers: number
324
+ center: Point
325
+ outline?: Point[]
326
+ }
327
+ ```
328
+
329
+ ### PcbComponent
330
+
331
+ - Defines a component on the PCB
332
+
333
+ ```typescript
334
+ /**
335
+ * Defines a component on the PCB
336
+ */
337
+ export interface PcbComponent {
338
+ type: "pcb_component"
339
+ pcb_component_id: string
340
+ source_component_id: string
341
+ center: Point
342
+ layer: LayerRef
343
+ rotation: Rotation
344
+ width: Length
345
+ height: Length
346
+ }
347
+ ```
348
+
349
+ ### PcbFabricationNotePath
350
+
351
+ - Defines a fabrication path on the PCB for fabricators or assemblers
352
+
353
+ ```typescript
354
+ /**
355
+ * Defines a fabrication path on the PCB for fabricators or assemblers
356
+ */
357
+ export interface PcbFabricationNotePath {
358
+ type: "pcb_fabrication_note_path"
359
+ pcb_fabrication_note_path_id: string
360
+ pcb_component_id: string
361
+ layer: LayerRef
362
+ route: Point[]
363
+ stroke_width: Length
364
+ color?: string
365
+ }
366
+ ```
367
+
368
+ ### PcbFabricationNoteText
369
+
370
+ - Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators
371
+
372
+ ```typescript
373
+ /**
374
+ * Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators
375
+ */
376
+ export interface PcbFabricationNoteText {
377
+ type: "pcb_fabrication_note_text"
378
+ pcb_fabrication_note_text_id: string
379
+ font: "tscircuit2024"
380
+ font_size: Length
381
+ pcb_component_id: string
382
+ text: string
383
+ layer: VisibleLayer
384
+ anchor_position: Point
385
+ anchor_alignment:
386
+ | "center"
387
+ | "top_left"
388
+ | "top_right"
389
+ | "bottom_left"
390
+ | "bottom_right"
391
+ color?: string
392
+ }
393
+ ```
394
+
395
+ ### PcbMissingFootprintError
396
+
397
+ - Defines a placement error on the PCB
398
+
399
+ ```typescript
400
+ /**
401
+ * Defines a placement error on the PCB
402
+ */
403
+ export interface PcbMissingFootprintError {
404
+ type: "pcb_missing_footprint_error"
405
+ pcb_missing_footprint_error_id: string
406
+ error_type: "pcb_missing_footprint_error"
407
+ source_component_id: string
408
+ message: string
409
+ }
410
+ ```
411
+
412
+ ### PcbPlacementError
413
+
414
+ - Defines a placement error on the PCB
415
+
416
+ ```typescript
417
+ /**
418
+ * Defines a placement error on the PCB
419
+ */
420
+ export interface PcbPlacementError {
421
+ type: "pcb_placement_error"
422
+ pcb_placement_error_id: string
423
+ message: string
424
+ }
425
+ ```
426
+
427
+ ### PcbPort
428
+
429
+ - Defines a port on the PCB
430
+
431
+ ```typescript
432
+ /**
433
+ * Defines a port on the PCB
434
+ */
435
+ export interface PcbPort {
436
+ type: "pcb_port"
437
+ pcb_port_id: string
438
+ source_port_id: string
439
+ pcb_component_id: string
440
+ x: Distance
441
+ y: Distance
442
+ layers: LayerRef[]
443
+ }
444
+ ```
445
+
446
+ ### PcbPortNotMatchedError
447
+
448
+ - Defines a trace error on the PCB where a port is not matched
449
+
450
+ ```typescript
451
+ /**
452
+ * Defines a trace error on the PCB where a port is not matched
453
+ */
454
+ export interface PcbPortNotMatchedError {
455
+ type: "pcb_port_not_matched_error"
456
+ pcb_error_id: string
457
+ message: string
458
+ pcb_component_ids: string[]
459
+ }
460
+ ```
461
+
462
+ ### PcbSilkscreenCircle
463
+
464
+ - Defines a silkscreen circle on the PCB
465
+
466
+ ```typescript
467
+ /**
468
+ * Defines a silkscreen circle on the PCB
469
+ */
470
+ export interface PcbSilkscreenCircle {
471
+ type: "pcb_silkscreen_circle"
472
+ pcb_silkscreen_circle_id: string
473
+ pcb_component_id: string
474
+ center: Point
475
+ radius: Length
476
+ layer: VisibleLayer
477
+ }
478
+ ```
479
+
480
+ ### PcbSilkscreenLine
481
+
482
+ - Defines a silkscreen line on the PCB
483
+
484
+ ```typescript
485
+ /**
486
+ * Defines a silkscreen line on the PCB
487
+ */
488
+ export interface PcbSilkscreenLine {
489
+ type: "pcb_silkscreen_line"
490
+ pcb_silkscreen_line_id: string
491
+ pcb_component_id: string
492
+ stroke_width: Distance
493
+ x1: Distance
494
+ y1: Distance
495
+ x2: Distance
496
+ y2: Distance
497
+ layer: VisibleLayer
498
+ }
499
+ ```
500
+
501
+ ### PcbSilkscreenOval
502
+
503
+ - Defines a silkscreen oval on the PCB
504
+
505
+ ```typescript
506
+ /**
507
+ * Defines a silkscreen oval on the PCB
508
+ */
509
+ export interface PcbSilkscreenOval {
510
+ type: "pcb_silkscreen_oval"
511
+ pcb_silkscreen_oval_id: string
512
+ pcb_component_id: string
513
+ center: Point
514
+ radius_x: Distance
515
+ radius_y: Distance
516
+ layer: VisibleLayer
517
+ }
518
+ ```
519
+
520
+ ### PcbSilkscreenPath
521
+
522
+ - Defines a silkscreen path on the PCB
523
+
524
+ ```typescript
525
+ /**
526
+ * Defines a silkscreen path on the PCB
527
+ */
528
+ export interface PcbSilkscreenPath {
529
+ type: "pcb_silkscreen_path"
530
+ pcb_silkscreen_path_id: string
531
+ pcb_component_id: string
532
+ layer: VisibleLayerRef
533
+ route: Point[]
534
+ stroke_width: Length
535
+ }
536
+ ```
537
+
538
+ ### PcbSilkscreenPill
539
+
540
+ - Defines a silkscreen pill on the PCB
541
+
542
+ ```typescript
543
+ /**
544
+ * Defines a silkscreen pill on the PCB
545
+ */
546
+ export interface PcbSilkscreenPill {
547
+ type: "pcb_silkscreen_pill"
548
+ pcb_silkscreen_pill_id: string
549
+ pcb_component_id: string
550
+ center: Point
551
+ width: Length
552
+ height: Length
553
+ layer: LayerRef
554
+ }
555
+ ```
556
+
557
+ ### PcbSilkscreenRect
558
+
559
+ - Defines a silkscreen rect on the PCB
560
+
561
+ ```typescript
562
+ /**
563
+ * Defines a silkscreen rect on the PCB
564
+ */
565
+ export interface PcbSilkscreenRect {
566
+ type: "pcb_silkscreen_rect"
567
+ pcb_silkscreen_rect_id: string
568
+ pcb_component_id: string
569
+ center: Point
570
+ width: Length
571
+ height: Length
572
+ layer: LayerRef
573
+ }
574
+ ```
575
+
576
+ ### PcbSilkscreenText
577
+
578
+ - Defines silkscreen text on the PCB
579
+
580
+ ```typescript
581
+ /**
582
+ * Defines silkscreen text on the PCB
583
+ */
584
+ export interface PcbSilkscreenText {
585
+ type: "pcb_silkscreen_text"
586
+ pcb_silkscreen_text_id: string
587
+ font: "tscircuit2024"
588
+ font_size: Length
589
+ pcb_component_id: string
590
+ text: string
591
+ layer: LayerRef
592
+ is_mirrored?: boolean
593
+ anchor_position: Point
594
+ anchor_alignment:
595
+ | "center"
596
+ | "top_left"
597
+ | "top_right"
598
+ | "bottom_left"
599
+ | "bottom_right"
600
+ }
601
+ ```
602
+
603
+ ### PcbText
604
+
605
+ - Defines text on the PCB
606
+
607
+ ```typescript
608
+ /**
609
+ * Defines text on the PCB
610
+ */
611
+ export interface PcbText {
612
+ type: "pcb_text"
613
+ pcb_text_id: string
614
+ text: string
615
+ center: Point
616
+ layer: LayerRef
617
+ width: Length
618
+ height: Length
619
+ lines: number
620
+ align: "bottom-left"
621
+ }
622
+ ```
623
+
624
+ ### PcbTrace
625
+
626
+ - Defines a trace on the PCB
627
+
628
+ ```typescript
629
+ /**
630
+ * Defines a trace on the PCB
631
+ */
632
+ export interface PcbTrace {
633
+ type: "pcb_trace"
634
+ source_trace_id?: string
635
+ pcb_component_id?: string
636
+ pcb_trace_id: string
637
+ /**
638
+ * The order that this trace was routed in. This can be used to debug the
639
+ * autorouter and to understand the trace path better
640
+ *
641
+ * The route_order_index should be relative to a subcircuit
642
+ */
643
+ route_order_index?: number
644
+ route_thickness_mode?: "constant" | "interpolated"
645
+ should_round_corners?: boolean
646
+ route: Array<PcbTraceRoutePoint>
647
+ }
648
+
649
+ export interface PcbTraceRoutePointWire {
650
+ route_type: "wire"
651
+ x: Distance
652
+ y: Distance
653
+ width: Distance
654
+ start_pcb_port_id?: string
655
+ end_pcb_port_id?: string
656
+ layer: LayerRef
657
+ }
658
+
659
+ export interface PcbTraceRoutePointVia {
660
+ route_type: "via"
661
+ x: Distance
662
+ y: Distance
663
+ from_layer: string
664
+ to_layer: string
665
+ }
666
+ ```
667
+
668
+ ### PcbTraceError
669
+
670
+ - Defines a trace error on the PCB
671
+
672
+ ```typescript
673
+ /**
674
+ * Defines a trace error on the PCB
675
+ */
676
+ export interface PcbTraceError {
677
+ type: "pcb_trace_error"
678
+ pcb_trace_error_id: string
679
+ error_type: "pcb_trace_error"
680
+ message: string
681
+ center?: Point
682
+ pcb_trace_id: string
683
+ source_trace_id: string
684
+ pcb_component_ids: string[]
685
+ pcb_port_ids: string[]
686
+ }
687
+ ```
688
+
689
+ ### PcbTraceHint
690
+
691
+ - A hint that can be used during generation of a PCB trace.
692
+
693
+ ```typescript
694
+ /**
695
+ * A hint that can be used during generation of a PCB trace.
696
+ */
697
+ export interface PcbTraceHint {
698
+ type: "pcb_trace_hint"
699
+ pcb_trace_hint_id: string
700
+ pcb_port_id: string
701
+ pcb_component_id: string
702
+ route: RouteHintPoint[]
703
+ }
704
+ ```
705
+
706
+ ### PcbVia
707
+
708
+ @deprecated
709
+
710
+ ```typescript
711
+ /** @deprecated */
712
+ from_layer: layer_ref.optional(),
713
+ /** @deprecated */
714
+ to_layer: layer_ref.optional(),
715
+ layers: z.array(layer_ref),
716
+ pcb_trace_id: z.string().optional(),
717
+ })
718
+ .describe("Defines a via on the PCB")
719
+
720
+ export type PcbViaInput = z.input<typeof pcb_via>
721
+ type InferredPcbVia = z.infer<typeof pcb_via>
722
+
723
+ /**
724
+ * Defines a via on the PCB
725
+ */
726
+ export interface PcbVia {
727
+ type: "pcb_via"
728
+ pcb_via_id: string
729
+ x: Distance
730
+ y: Distance
731
+ outer_diameter: Distance
732
+ hole_diameter: Distance
733
+ /** @deprecated */
734
+ from_layer?: LayerRef
735
+ /** @deprecated */
736
+ to_layer?: LayerRef
737
+ layers: LayerRef[]
738
+ pcb_trace_id?: string
739
+ }
740
+ ```
741
+
742
+ ## Schematic Elements
743
+
744
+ ### SchematicBox
745
+
746
+ ```typescript
747
+ export interface SchematicBox {
748
+ type: "schematic_box"
749
+ schematic_component_id: string
750
+ width: number
751
+ height: number
752
+ x: number
753
+ y: number
754
+ }
755
+ ```
756
+
757
+ ### SchematicComponent
758
+
759
+ ```typescript
760
+ export interface SchematicComponent {
761
+ type: "schematic_component"
762
+ rotation: number
763
+ size: Size
764
+ center: Point
765
+ source_component_id: string
766
+ schematic_component_id: string
767
+ pin_spacing?: number
768
+ pin_styles?: Record<
769
+ string,
770
+ {
771
+ left_margin?: number
772
+ right_margin?: number
773
+ top_margin?: number
774
+ bottom_margin?: number
775
+ }
776
+ >
777
+ box_width?: number
778
+ symbol_name?: string
779
+ port_arrangement?: SchematicPortArrangement
780
+ port_labels?: Record<string, string>
781
+ symbol_display_value?: string
782
+ }
783
+
784
+ export interface SchematicPortArrangementBySize {
785
+ left_size: number
786
+ right_size: number
787
+ top_size?: number
788
+ bottom_size?: number
789
+ }
790
+
791
+ export interface SchematicPortArrangementBySides {
792
+ left_side?: { pins: number[]; direction?: "top-to-bottom" | "bottom-to-top" }
793
+ right_side?: { pins: number[]; direction?: "top-to-bottom" | "bottom-to-top" }
794
+ top_side?: { pins: number[]; direction?: "left-to-right" | "right-to-left" }
795
+ bottom_side?: {
796
+ pins: number[]
797
+ direction?: "left-to-right" | "right-to-left"
798
+ }
799
+ }
800
+ ```
801
+
802
+ ### SchematicError
803
+
804
+ ```typescript
805
+ export interface SchematicError {
806
+ type: "schematic_error"
807
+ schematic_error_id: string
808
+ error_type: "schematic_port_not_found"
809
+ message: string
810
+ }
811
+ ```
812
+
813
+ ### SchematicLine
814
+
815
+ ```typescript
816
+ /**
817
+ * Defines a line on the schematic, this can be used for adding arbitrary lines
818
+ * to a schematic, but don't use it for drawing traces, schematic boxes or where
819
+ * other schematic elements are more appropriate.
820
+ */
821
+ export interface SchematicLine {
822
+ type: "schematic_line"
823
+ schematic_component_id: string
824
+ x1: number
825
+ x2: number
826
+ y1: number
827
+ y2: number
828
+ }
829
+ ```
830
+
831
+ ### SchematicPath
832
+
833
+ ```typescript
834
+ export interface SchematicPath {
835
+ type: "schematic_path"
836
+ schematic_component_id: string
837
+ fill_color?: "red" | "blue"
838
+ is_filled?: boolean
839
+ points: Point[]
840
+ }
841
+ ```
842
+
843
+ ### SchematicPort
844
+
845
+ ```typescript
846
+ export interface SchematicPort {
847
+ type: "schematic_port"
848
+ schematic_port_id: string
849
+ source_port_id: string
850
+ schematic_component_id?: string
851
+ center: Point
852
+ facing_direction?: "up" | "down" | "left" | "right"
853
+ distance_from_component_edge?: number
854
+ side_of_component?: "top" | "bottom" | "left" | "right"
855
+ true_ccw_index?: number
856
+ pin_number?: number
857
+ display_pin_label?: string
858
+ }
859
+ ```
860
+
861
+ ### SchematicText
862
+
863
+ ```typescript
864
+ export interface SchematicText {
865
+ type: "schematic_text"
866
+ schematic_component_id: string
867
+ schematic_text_id: string
868
+ text: string
869
+ position: {
870
+ x: number
871
+ y: number
872
+ }
873
+ rotation: number
874
+ anchor: "center" | "left" | "right" | "top" | "bottom"
875
+ color: string
876
+ }
877
+ ```
878
+
879
+ ### SchematicTrace
880
+
881
+ ```typescript
882
+ export interface SchematicTrace {
883
+ type: "schematic_trace"
884
+ schematic_trace_id: string
885
+ source_trace_id: string
886
+ junctions: {
887
+ x: number
888
+ y: number
889
+ }[]
890
+ edges: SchematicTraceEdge[]
891
+ }
892
+
893
+ export interface SchematicTraceEdge {
894
+ from: {
895
+ x: number
896
+ y: number
897
+ }
898
+ to: {
899
+ x: number
900
+ y: number
901
+ }
902
+ is_crossing?: boolean
903
+ from_schematic_port_id?: string
904
+ to_schematic_port_id?: string
905
+ }
906
+ ```
907
+
908
+ ### SchematicVoltageProbe
909
+
910
+ ```typescript
911
+ export interface SchematicVoltageProbe {
912
+ type: "schematic_voltage_probe"
913
+ schematic_voltage_probe_id: string
914
+ position: Point
915
+ schematic_trace_id: string
916
+ voltage?: number
917
+ }
918
+ ```
919
+
920
+ <!-- circuit-json-docs:end -->