sphinx-pcbdraw¶
This is a basic Sphinx extension for creating board views from KiCAD .kicad_pcb files and embedding them into a Sphinx document. Utilizes PcbDraw created by yaqwsx. Requires KiCAD and KiKit.
pcbdraw directive¶
Here are some examples.
.. pcbdraw:: UPduino_v3.0.kicad_pcb
.. pcbdraw:: UPduino_v3.0.kicad_pcb
:back:
:mirror:
:placeholder:
:no-drillholes:
.. pcbdraw:: NINA-W102_minimal_breakout.kicad_pcb
.. pcbdraw:: ThisFileDoesntExist.kicad_pcb
Error
sphinx-pcbdraw: File does not exist: ThisFileDoesntExist.kicad_pcb
options¶
.. pcbdraw:: path/to/pcb.kicad_pcb
:style: path/to/style.json # select a path/to/style.json
# or selects a builtin style if not a proper path
:placeholder: # place red squares in place of missing components
:remap: path/to/remap.json # use path/to/remap.json to remap components
:no-drillholes: # don't make drillholes transparent
:back: # draw the back of the board
:mirror: # mirror board on x-axis
:highlight: comma, separated, list # highlight these components
:filter: comma, separated, list # only show these components
:hidden: comma, separated, list # don't show these components
:width: # width of the resulting image, defaults to 100%
pcb-components directive¶
A list of all the components on a board can be created using this directive. It will default to only showing the components on the front side:
.. pcb-components:: UPduino_v3.0.kicad_pcb
| Library | Component |
|---|---|
| Capacitor_SMD | C_0603_1608Metric |
| Connector_PinHeader_2.54mm | PinHeader_1x02_P2.54mm_Vertical |
| Fiducial | Fiducial_0.75mm_Mask1.5mm |
| Inductor_SMD | L_0603_1608Metric |
| LED_SMD | LED_0603_1608Metric |
| Package_DFN_QFN | QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mm |
| Package_SO | SOIC-8_5.23x5.23mm_P1.27mm |
| Resistor_SMD | R_0603_1608Metric |
| TestPoint | TestPoint_Pad_D1.0mm |
| VS.preety | LED_Cree-PLCC4_2x2mm_CW |
| vs | MountingHole_2.5mm_M3 |
| vs | Oscillator_SMD_Abracon_ASDMB-4Pin_2.5x2.0mm |
| vs | PinHeader_1x24_P2.54mm_Vertical |
| vs | QFN-48-1EP_8x8mm_P0.5mm_EP6.2x6.2mm |
| vs | SOT-23-6 |
| vs | ShortedJumper-2_P1.3mm_Bridged_Pad1.0x1.0mm |
| vs | SolderJumper-2_0603_Open_TrianglePad1.0x1.5mm |
| vs | Tiny4 |
| vs | USB_Micro_AB_Female_0475890001 |
Components from only the back side can be specified:
.. pcb-components:: UPduino_v3.0.kicad_pcb
:side: back
| Library | Component |
|---|---|
| Capacitor_SMD | C_0603_1608Metric |
| Diode_SMD | D_SOD-523 |
| Fiducial | Fiducial_0.75mm_Mask1.5mm |
| Inductor_SMD | L_0603_1608Metric |
| Package_SO | VSSOP-8_2.3x2mm_P0.5mm |
| Resistor_SMD | R_0603_1608Metric |
| Symbol | WEEE-Logo_4.2x6mm_SilkScreen |
| TestPoint | TestPoint_Pad_D1.0mm |
| vs | SOT-23-5 |
| vs | ShortedJumper-2_P1.3mm_Bridged_Pad1.0x1.0mm |
| vs | SolderJumper-2_0603_Open_TrianglePad1.0x1.5mm |
Components from both sides can be specificed.:
.. pcb-components:: NINA-W102_minimal_breakout.kicad_pcb
:side: both
| Library | Component |
|---|---|
| 6_PIN_SERIAL_TARGET_SIDE_W_SILK | |
| Aesthetics | OSHW-LOGO-MINI |
| Capacitors_SMD | C_1206_HandSoldering |
| LEDs | LED_1206_HandSoldering |
| Resistors_SMD | R_1206_HandSoldering |
| lib | 1X15_LOCK |
| lib | BREADBOARD_SPACING_80mm |
| lib | DuckTapeApproved-MIT |
| lib | GDG-logo-mono-withouttext-h5.6 |
| lib | MakeZurich-15x11-silk |
| lib | NINA-W102 |
| lib | SMT-JUMPER_2_NC_TRACE_SILK |
| switchessilicone | TACTILE_SWITCH_SMD_6.0X6.0MM |
TODO¶
pcbdraw global options
sphinx_pcbdraw_libs = ["lib/folder/one", "lib/folder/two"] # library folders to include for generation
sphinx_pcbdraw_style = "path/to/style.json" # default style path or builtin
sphinx_pcbdraw_remap = "path/to/remap.json" # default for remapping components
sphinx_pcbdraw_hidden = ["component1", "component2"] # list of components to hide from all designs
License¶
sphinx-pcbdraw is under the MIT license. Source code is avaiable at https://github.com/nobodywasishere/sphinx-pcbdraw.
Example kicad_pcb file UPduino_v3.0.kicad_pcb from https://github.com/tinyvision-ai-inc/UPduino-v3.0, Copyright tinyvision-ai-inc under the MIT License.
Example kicad_pcb file NINA-W102_minimal_breakout.kicad_pcb from https://github.com/rac2030/breakout-boards, Copyright Michel Racic under the MIT License.