@typecad/kicad2typecad
v1.1.1
Published
Generate typeCAD code from KiCAD PCB files
Readme
@typecad/kicad2typecad
Parse KiCad PCB board files (.kicad_pcb) and generate typeCAD code. This tool is designed to convert KiCad PCB design data into typeCAD format with optional TypeScript variable name mapping.
Features
- Parses tracks and transforms them into typeCAD
TrackBuilderchains. - Parses components to generate component placement code, including rotation.
- Parses vias sections to generate via code.
- Optional TypeScript analysis: Automatically extracts variable names from existing TypeScript code
- Outputs ready-to-use typeCAD code
Installation
To use this package, ensure you have Node.js and npm installed. Then, install the package using npm:
npm install -g @typecad/kicad2typecadUsage
Basic Usage
Uses KiCad reference designators as-is:
kicad2typecad <path_to_kicad_pcb_file>With TypeScript Code Analysis
Automatically extract variable names from your existing TypeScript code:
kicad2typecad <path_to_kicad_pcb_file> circuit.tsThis will analyze your TypeScript file for component declarations like:
let r1 = new Resistor({ value: '1kohm' });
const decouplingCap = new Capacitor({ value: '100nF' });
this.microcontroller = new IC({ ... });Output
Without TypeScript Analysis
this.R1.pcb = { x: 10, y: 20, rotation: 0 };
this.C1.pcb = { x: 15, y: 25, rotation: 90 };
this.U1.pcb = { x: 30, y: 40, rotation: 180 };With TypeScript Analysis
this.r1.pcb = { x: 10, y: 20, rotation: 0 };
this.decouplingCap.pcb = { x: 15, y: 25, rotation: 90 };
this.microcontroller.pcb = { x: 30, y: 40, rotation: 180 };The TypeScript analysis automatically maps KiCad references to your actual variable names, allowing you to copy-paste the generated code directly into your typeCAD project.
