### Test PcbDraw installation with --help Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/installation.md Verifies the installation by displaying the help menu. Run after installing PcbDraw. ```bash .bash pcbdraw --help ``` -------------------------------- ### Populate Markdown and HTML examples Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Populates Markdown and HTML source files into separate output directories. The two commands are alternatives for the same populate workflow. ```bash pcbraw populate examples/populate/source_md.md markdown_demo ``` ```bash pcbdraw populate examples/populate/source_html.md html_demo ``` -------------------------------- ### Install PcbDraw via pip (Linux/macOS) Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/installation.md Installs PcbDraw with pip or pip3 depending on distribution. Requires KiCad already installed. ```bash pip install PcbDraw # Use pip or pip3 based on your distribution ``` -------------------------------- ### Install librsvg on Debian/Ubuntu Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/faq.md Install librsvg2-bin to enable PNG conversion in PcbDraw. This is recommended as it is faster than Inkscape. ```bash sudo apt install librsvg2-bin ``` -------------------------------- ### Install upstream (unstable) PcbDraw from GitHub Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/installation.md Installs the latest development version directly from the repository on GitHub. ```bash pip3 install git+https://github.com/yaqwsx/PcbDraw@master ``` -------------------------------- ### Install PcbDraw on Windows via pip Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/installation.md Installs PcbDraw using pip in a command prompt (preferably the KiCad Command Prompt if kicad-cli is not in PATH). ```bash pip install PcbDraw ``` -------------------------------- ### Population step clause syntax Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/populate.md Clause to start a list item in the source markdown file. It specifies the board side and the components to add and highlight. ```markdown - [[ | ]] ``` -------------------------------- ### Render board with --remap Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Renders the board while remapping colors, e.g., for LEDs, using a remap JSON file. ```bash pcbdraw plot --remap examples/resources/remap.json examples/resources/ArduinoLearningKitStarter.kicad_pcb front.svg ``` -------------------------------- ### Render with --highlight L_R1,L_Y1 Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Renders the board and highlights the components L_R1 and L_Y1. ```bash pcbdraw plot --highlight L_R1,L_Y1 examples/resources/ArduinoLearningKitStarter.kicad_pcb front.svg ``` -------------------------------- ### Render with --style oshpark-purple Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Renders the board using the oshpark-purple style. ```bash pcbdraw plot --style oshpark-purple examples/resources/ArduinoLearningKitStarter.kicad_pcb front.svg ``` -------------------------------- ### Render board without components with --filter "" Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Renders only the board without any components by passing an empty filter. ```bash pcbdraw plot --filter "" examples/resources/ArduinoLearningKitStarter.kicad_pcb front.svg ``` -------------------------------- ### Load board scene and query annotations Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/annotations.md Loads a KiCad board file into a BoardScene and accesses components, pads, and features for a net. Requires KiCad 9 or 10's kicad-cli on PATH or via the KICAD_CLI environment variable; does not require pcbnew. ```python from pcbdraw import load_board_scene scene = load_board_scene("controller.kicad_pcb") connector = scene.components["J1"] pin_one = scene.pads[("J1", "1")] ground = list(scene.features_for_net("GND")) ``` -------------------------------- ### Render back side with --back Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Renders the back side of the board to back.svg. ```bash pcbdraw plot --back examples/resources/ArduinoLearningKitStarter.kicad_pcb back.svg ``` -------------------------------- ### Render board with pcbdraw plot Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Renders the board to an SVG file named front.svg using the default style. ```bash pcbdraw plot examples/resources/ArduinoLearningKitStarter.kicad_pcb front.svg ``` -------------------------------- ### Render with --filter L_R1,L_Y1 Source: https://github.com/yaqwsx/pcbdraw/blob/master/examples/readme.md Renders the board including only the components L_R1 and L_Y1. ```bash pcbdraw plot --filter L_R1,L_Y1 examples/resources/ArduinoLearningKitStarter.kicad_pcb front.svg ``` -------------------------------- ### BoardScene.features_for_net(net_name) Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/annotations.md Method on BoardScene that yields all electrical feature types (tracks, zones, pads, vias) for a given net. ```APIDOC ## features_for_net(net_name) ### Description Yields all four electrical feature types (tracks, zones, pads, vias) for a given net. Useful for retrieving all electrical data associated with a specific net. ### Method Method ### Endpoint `BoardScene.features_for_net(net_name)` ### Parameters - **net_name** (string) - Required - The name of the net to retrieve features for (e.g., `"GND"`). ### Returns - **Generator** - Yields `TrackAnnotation`, `ZoneAnnotation`, `PadAnnotation`, and `ViaAnnotation` objects for the specified net. ### Example ```python ground = list(scene.features_for_net("GND")) ``` ``` -------------------------------- ### load_board_scene(path) Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/annotations.md The primary function to load a board scene from a KiCad board file, returning a BoardScene object with components, pads, tracks, zones, vias, and net features. ```APIDOC ## load_board_scene(path) ### Description Loads a board scene from a KiCad board file, exposing electrical and placement data without requiring KiCad's Python bindings. Returns a stable, Python-native scene in board millimetres. ### Method Function ### Endpoint `load_board_scene(path)` ### Parameters - **path** (string) - Required - Path to the KiCad board file (e.g., `"controller.kicad_pcb"`). ### Returns - **BoardScene** - Contains the source path, board bounds, components, pads, tracks, zones, vias, and an index of pads by net. Components are keyed by reference and pads by `(reference, name)`. ### Example ```python from pcbdraw import load_board_scene scene = load_board_scene("controller.kicad_pcb") connector = scene.components["J1"] pin_one = scene.pads[("J1", "1")] ground = list(scene.features_for_net("GND")) ``` ``` -------------------------------- ### Source file YAML header Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/populate.md YAML header for the source markdown file. It specifies options like board, image name template, output type, and initial components. ```yaml --- params: - --style mystyle.json - --remap remapping.json imgname: img/populating_{}.png template: simple type: html board: ../ArduinoLearningKitStarter/ArduinoLearningKitStarter.kicad_pcb libs: KiCAD-6 initial_components: - C1 - R13 ... ``` -------------------------------- ### Custom PcbDraw style JSON Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/pcbdraw.md Defines a custom PcbDraw style as a JSON file. Colors are in HEX format and affect only the board substrate, not modules. The highlight-style uses SVG presentation attributes. ```json { "clad": "#9c6b28", "copper": "#417e5a", "board": "#4ca06c", "silk": "#f0f0f0", "pads": "#b5ae30", "outline": "#000000", "highlight-on-top": false, "highlight-style": "stroke:none;fill:#ff0000;opacity:0.5;", "highlight-padding": 1.5, "highlight-offset": 0 } ``` -------------------------------- ### Handlebars template data structure Source: https://github.com/yaqwsx/pcbdraw/blob/master/doc/populate.md Data structure fed to the Handlebars template for HTML output. Contains items of type 'comment' and 'step'. ```json { "items": [ { "type": "comment", "is_comment": true, "content": "Generated HTML from markdown of the comment" }, { "type": "step", "is_step": true, "steps": [ { "img": "path to generated image", "comment": "Generated HTML from markdown of the comment" } ] } ] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.