|
| 1 | +# PCB Pinout Diagram Generator |
| 2 | + |
| 3 | +This project generates Scalable Vector Graphics (SVG) pinout diagrams for Printed Circuit Boards (PCBs) based on configuration files written in YAML or JSON. It provides both a web-based editor for interactive diagram creation and a command-line interface (CLI) for batch processing. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +* **SVG Output:** Generates clean, scalable SVG diagrams. |
| 8 | +* **Configuration:** Define pinouts, board dimensions, labels, and types using simple YAML or JSON files. |
| 9 | +* **Web Editor:** |
| 10 | + * Real-time preview of the diagram as you edit the configuration. |
| 11 | + * Syntax highlighting for YAML. |
| 12 | + * Load configurations from local files, URLs, or browser storage. |
| 13 | + * Download generated SVG diagrams (front and back views). |
| 14 | +* **CLI Tool:** Process multiple configuration files or entire directories to generate SVG diagrams programmatically. |
| 15 | +* **Image Embedding:** Embed background images (e.g., photos of the PCB) from local paths or URLs directly into the SVG. Supports front and back images. |
| 16 | +* **Customization:** Define custom types for pins with specific background and foreground colors, automatically generating a legend. |
| 17 | +* **Front & Back Views:** Automatically generates diagrams for both the front and back sides of the PCB. |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +### Web Editor |
| 22 | + |
| 23 | +1. Open `public/index.html` in your web browser (requires a local web server or building the project). |
| 24 | +2. Edit the YAML configuration in the editor pane. |
| 25 | +3. The SVG diagram preview will update automatically. |
| 26 | +4. Use the "Download SVG" buttons below each preview to save the front or back view. |
| 27 | + |
| 28 | +### Command-Line Interface (CLI) |
| 29 | + |
| 30 | +1. Ensure you have Node.js installed. |
| 31 | +2. Run the CLI tool with configuration files or directories as arguments: |
| 32 | + |
| 33 | + ```bash |
| 34 | + node src/cli.js path/to/your/config.yaml path/to/another/config.json some/directory/ |
| 35 | + ``` |
| 36 | +3. The tool will generate corresponding `.svg` files (e.g., `config.front.svg`, `config.back.svg`) in the same directory as the input files. |
| 37 | + |
| 38 | +## Configuration |
| 39 | + |
| 40 | +Diagrams are configured using YAML or JSON files. Key sections include: |
| 41 | + |
| 42 | +* `title`: The title displayed on the diagram. |
| 43 | +* `width`, `height`: Board dimensions in number of pins. |
| 44 | +* `pins`: Defines pin labels and types for `left`, `right`, `top`, `bottom` rows. |
| 45 | +* `types`: Custom pin type definitions (colors). |
| 46 | +* `image`: Configuration for embedding background images (front/back). |
| 47 | + |
| 48 | +See the example files in `public/pinouts/` for detailed structure. |
| 49 | + |
| 50 | +## Development |
| 51 | + |
| 52 | +1. Install dependencies: |
| 53 | + ```bash |
| 54 | + npm install |
| 55 | + ``` |
| 56 | +2. Build the project (for web editor and CLI): |
| 57 | + ```bash |
| 58 | + node build.js |
| 59 | + ``` |
| 60 | +3. Start the development server with hot reloading for the web editor: |
| 61 | + ```bash |
| 62 | + node build.js --serve |
| 63 | + ``` |
| 64 | + |
| 65 | +``` |
0 commit comments