configure_netclasses
Create or update net classes and assign nets in a .kicad_pro file, deriving track widths from IPC-2221 current rules or fixed values. Close the KiCad project first so settings are not overwritten.
Instructions
Create/update net classes and assign nets to them in the .kicad_pro file. Widths can be derived from current (IPC-2221) instead of fixed numbers.
The project must be CLOSED in KiCad (both editors): KiCad keeps project settings in memory and would overwrite this change on its next save. Reopen it afterwards and the nets pick up their classes.
Args: classes: One object per class, e.g. [{"name": "Power", "current_a": 1.5, "nets": ["+5V", "VMOT"]}, {"name": "Motor", "current_a": 2.5, "nets": ["AO1", "AO2"]}, {"name": "Signal", "track_width_mm": 0.25, "nets": ["/*"]}] Keys: name (required); nets (names or KiCad wildcard patterns - plain names also match their '/NAME' root-sheet form); current_a (sizes the track via IPC-2221) or track_width_mm; clearance_mm; via_diameter_mm; via_drill_mm; priority (lower wins when patterns overlap). project_path: .kicad_pro file or its folder; default = project of the open board. temp_rise_c: Temperature rise used for current-based widths. copper_oz: Copper weight used for current-based widths. replace_patterns: Drop all existing net-class patterns first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| classes | Yes | ||
| copper_oz | No | ||
| temp_rise_c | No | ||
| project_path | No | ||
| replace_patterns | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||