KiCad Workbench
v0.2.0Gives KiCad 10 projects to LLM agents: schematics, boards, ERC, DRC, BOM, edits
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_libraries
List the symbol or footprint libraries of KiCad and of a project. The libraries come from the library tables: the global table of the installed KiCad version (with its nested tables), then the table of the project. When more than one row has the same library name, KiCad uses the last one: a project library replaces a global library.
| Parameter | Type | Description |
|---|---|---|
kind | string | "symbol" or "footprint". |
project_path | string | Optional .kicad_pro, .kicad_sch or .kicad_pcb file, or the project directory. |
search_library_symbols
Search the symbols of the KiCad libraries by name, description and keywords. Each word of the query must be in the library ID ("Device:R"), the description, the keywords or the default footprint. A derived symbol gets the empty fields from its parent. The order is that of the symbol chooser of KiCad: an exact name first, then the best score. The first search reads all libraries (some seconds); then an index in the user cache directory is used until a library file changes. The tool searches only libraries of the type KiCad, not a disabled library, and not a hidden library unless include_hidde…
| Parameter | Type | Description |
|---|---|---|
query * | string | Words to find, for example "op amp rail-to-rail". |
include_hidden | boolean | Also search libraries that are hidden in KiCad. |
library | string | Optional name of one library to search (also when it is hidden). |
limit | integer | The maximum number of results in the table. |
project_path | string | Optional project (.kicad_pro, .kicad_sch, .kicad_pcb or its directory), to include its libraries. |
search_library_footprints
Search the footprints of the KiCad libraries by name, description and tags. Each word of the query must be in the library ID ("Resistor_SMD:R_0603_1608Metric"), the description or the tags. The order is that of the footprint chooser of KiCad: an exact name first, then the best score. The first search reads all libraries (some seconds); then an index in the user cache directory is used until a library file changes. The tool searches only libraries of the type KiCad, not a disabled library, and not a hidden library unless include_hidden or library asks for it. A library file of a newer version…
| Parameter | Type | Description |
|---|---|---|
query * | string | Words to find, for example "0603 resistor". |
include_hidden | boolean | Also search libraries that are hidden in KiCad. |
library | string | Optional name of one library to search (also when it is hidden). |
limit | integer | The maximum number of results in the table. |
project_path | string | Optional project (.kicad_pro, .kicad_sch, .kicad_pcb or its directory), to include its libraries. |
get_library_symbol
Show the content of a symbol of a KiCad library: fields, units and pins. The library comes from the library tables of the installed KiCad and of the project, as in the symbol chooser of KiCad. A derived symbol (extends ...) is shown as KiCad places it: the fields of the symbol and of its parents, the flags of its parent, and the units and pins of its root symbol. The tool reads symbol libraries of KiCad 8 and later. An older library gives an error with the step for the user (kicad-cli sym upgrade), and a library of a newer version than the installed KiCad gives an error.
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The library ID, for example "Device:R" or "MCU_ST_STM32F4:STM32F405RGTx". |
project_path | string | Optional project (.kicad_pro, .kicad_sch, .kicad_pcb or its directory), to include its libraries. |
get_library_footprint
Show the content of a footprint of a KiCad library: pads, courtyard, attributes, 3D models. The library comes from the library tables of the installed KiCad and of the project, as in the footprint chooser of KiCad. pcbnew of the installed KiCad reads the footprint, thus the values are those of KiCad. The tool finds the file of each 3D model as KiCad finds it.
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The library ID, for example "Resistor_SMD:R_0603_1608Metric". |
project_path | string | Optional project (.kicad_pro, .kicad_sch, .kicad_pcb or its directory), to include its libraries and to set ${KIPRJMOD} for the 3D models. |
check_pin_pad_mapping
Compare the pin numbers of a library symbol with the pad numbers of a footprint. The tool uses the rules of "Update PCB from Schematic" of the installed KiCad. A pin number that no pad has, and a pin with no number, are errors. A pad with a number that no pin has gets no net: this is a warning. KiCad 10 reads a stacked pin number ("[1-4]") as more than one pad number. The check uses the pins of all units, for each body style. A power symbol gives an error: KiCad puts no power symbol into the netlist.
| Parameter | Type | Description |
|---|---|---|
symbol_lib_id * | string | The library ID of the symbol, for example "Device:R". |
footprint_lib_id | string | Optional library ID of the footprint, for example "Resistor_SMD:R_0603_1608Metric". If empty, the tool uses the Footprint field of the symbol. |
project_path | string | Optional project (.kicad_pro, .kicad_sch, .kicad_pcb or its directory), to include its libraries. |
check_schematic_pin_pad_mapping
Compare the pins of each symbol of a schematic with the pads of its footprint. The tool uses the netlist that "Update PCB from Schematic" gives pcbnew (kicad-cli of the installed KiCad), and the rules of that update. A pin number that no pad has, a pin with no number, and a symbol whose footprint KiCad does not find are errors. A pad with a number that no pin has gets no net: this is a warning. A symbol has the pins of the units that the schematic has. The pads come from the library footprints, as a new footprint on the board gets them. For a board that has the footprints, run_drc with the sc…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A schematic of the project (.kicad_sch). For a sub-sheet or an other top-level sheet, the tool uses the project. |
references | Optional references to check, for example ["U1", "J3"]. All symbols of the netlist if empty. |
render_library_item
Render a symbol or a footprint of a KiCad library as PNG images. Use the images for a visual check: the layout, the texts, the pin 1 mark, the silkscreen on the pads, items that overlap. get_library_symbol and get_library_footprint give the exact values. kicad-cli of the installed KiCad draws the item as SVG, with the color theme "KiCad Default". The tool draws each SVG as PNG images with the background of that theme. The library comes from the library tables of the installed KiCad and of the project, as in the chooser of KiCad.
| Parameter | Type | Description |
|---|---|---|
item_type * | string | "symbol" or "footprint". |
lib_id * | string | The library ID, for example "Device:R" or "Resistor_SMD:R_0603_1608Metric". |
max_height_px * | integer | The largest image height that your vision input reads with no reduction. If your input also has a limit of the pixel count, give a width and a height whose product is in that limit. |
max_width_px * | integer | The largest image width that your vision input reads with no reduction, from 64 to 8192 pixels. |
include_hidden | boolean | Symbol only: also draw the hidden pins and the hidden fields. |
layout | string | "tiles": the smallest text gets at least 15 pixels (the height of a 1.27 mm text at 300 DPI), never less than 300 DPI. An item that does not fit in one image at that scale is divided into tiles that o… |
max_images | integer | The tool gives an error, not images, when the item needs more images than this. |
output_dir | string | Optional directory to keep the SVG and PNG files. The tool replaces files with the same names, and does not delete other files. The summary gives the files that it wrote. |
pages | Optional names of the pages to draw, from the summary or from an error (a symbol has one page for each unit and body style, for example "74HC00_unit2"). All pages if empty. | |
project_path | string | Optional project (.kicad_pro, .kicad_sch, .kicad_pcb or its directory), to include its libraries. |
region | Optional [x, y, width, height] in mm, a part of the page to draw (the origin is the top left corner of the page; the summary gives the page sizes). Use it to see a part in more detail. The region appl… |
export_bom
Give the bill of materials (BOM) of a schematic, as KiCad makes it. The tool runs "kicad-cli sch export bom" for the full project of the schematic, and gives its lines as a table. Without group_by, each reference is one line. KiCad does not put the power symbols and the symbols that are excluded from the BOM into the BOM. The units of one package (one reference, U1A and U1B) must have the same Value, MPN, Value_Confirmed and MPN_Confirmed. When they do not, the output starts with an error of the design: the BOM line of the package joins the values, and the joined MPNs look like an MPN and it…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. The BOM is the BOM of the full project, also for a sub-sheet. |
all_variants | boolean | True to export the default variant and each variant of the project (KiCad 10 and later), one kicad-cli run and one CSV file for each: the default variant into output_path, the variant X into <stem>-X<… |
exclude_dnp | boolean | True to remove the symbols that have DNP. |
fields | The fields of the BOM, in their order. "*" adds all other fields. A generated field has the form "${QUANTITY}" or "${DNP}". Default: Reference, Value, Footprint, Datasheet, ${QUANTITY}, ${DNP} and "*"… | |
group_by | The fields whose equal values put symbols into one line. Each name must be an item of fields: a field that "*" adds does not group the symbols. Default: no groups. | |
output_path | string | The CSV file to write, as kicad-cli writes it. A relative path is relative to the project directory. The tool does not expand variables. The tool replaces an existing file. Empty: the tool keeps no fi… |
variant | string | The name of a variant of the project (KiCad 10 and later). Empty: the default variant. |
check_symbol_fields
Check the MPNs of the symbols: the fields Value, MPN, Value_Confirmed and MPN_Confirmed. Use this tool only when the MCP server datasheet-lens is not available: its tool project_check does the same check, and also checks the datasheets. The two tools give the same messages (a datasheet-lens with the model of the four fields, of 2026-11-07 or later: an older one reads the MPNs from the parentheses of Value). The convention: Value holds the general value ("2N7002", "100nF 10V"), the field MPN the MPNs, the fitted part first ("2N7002LT1G, BSS138LT1G"; the separators are "," and ";", an MPN with…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. The tool checks the full project. |
generate_netlist
Make the netlist of a schematic with kicad-cli, and give the path of its file. kicad-cli writes the netlist (KiCad XML) of the full project into a file in the temporary folder of the system. Give this file to trace_netlist_connection, get_netlist_nets and get_netlist_components. Make the netlist again after a change of the schematic. The file name comes from the root schematic: each call replaces the netlist file of an earlier call for the same project.
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. |
trace_netlist_connection
Give the nets of the pins of a component, and the pins on each net. The netlist of kicad-cli is the most exact source for the connections. Make it with generate_netlist, and again after a change of the schematic. The pins on a net are the pins of the other components: a pin of the same component on the net is not in the list. Give no pin_number to see each pin of the component. The reference and the pin number are case-sensitive.
| Parameter | Type | Description |
|---|---|---|
netlist_path * | string | A netlist file of generate_netlist. |
reference * | string | The reference of the component, for example "R16". |
pin_number | string | Optional pin number, for example "1". Empty: all pins. |
get_netlist_nets
Give the nets of a netlist file with their pins. Total Nets counts all nets of the netlist, also with filter_pattern. Each net shows its first 10 pins. The netlist of KiCad has a net "unconnected-(...)" for each unconnected pin: these nets are in the list.
| Parameter | Type | Description |
|---|---|---|
netlist_path * | string | A netlist file of generate_netlist. |
filter_pattern | string | Optional regular expression for the net names (the syntax of the Python module re, no difference of case), found in a part of the full name with the sheet path. Empty: all nets. A pattern that is not… |
get_netlist_components
Give the components of a netlist file with the nets of their pins. Total Components counts all components of the netlist, also with filter_ref. The netlist has no power symbols.
| Parameter | Type | Description |
|---|---|---|
netlist_path * | string | A netlist file of generate_netlist. |
filter_ref | string | Optional start of the references to give, for example "R", "U" or "C" (the case is important). Empty: all components. |
trace_hierarchical_connection
Trace the connections of a component across the full schematic hierarchy. The tool reads the netlist that kicad-cli writes now: it has each component of each sheet path, at each level of the hierarchy, with the reference of that path (a sheet that the hierarchy uses two times gives two references). The netlist has no power symbols and no symbol with no library symbol. The tool needs kicad-cli. The connected pins of a net are the pins of the other components: a pin of the same component on the net is not in the list. Each net shows 15 pins or less.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | A .kicad_sch file of the project (the root schematic or a sub-sheet: the tool uses the netlist of the root schematic). |
reference * | string | The reference of the component, for example "U1". |
pin_number | string | Optional pin number. Empty: all pins. |
analyze_hierarchical_nets
Analyze all nets of the full schematic hierarchy. The tool reads the netlist that kicad-cli writes now: the nets of all sheets at each level of the hierarchy. It groups them as power, interface and signal nets (by their names), and gives the sheet paths of the hierarchy. The groups come from parts of the net names (heuristic): power has VDD, VSS, GND, VCC, VBAT, VPP, +3V or +5V, interface has I2C, SPI, UART, SDA, SCL, MOSI, MISO, TX or RX, and signal is each other net. The tool lists at most 20 power nets, 30 interface nets and 20 signal nets, sorted by name: use filter_pattern for the other…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | A .kicad_sch file of the project (the root schematic or a sub-sheet: the tool uses the netlist of the root schematic). |
filter_pattern | string | Optional regular expression for the net names (no difference of case), found in a part of the full name with the sheet path ("/Power/VIN"), with the syntax of the Python module re. Empty: all nets. A… |
show_hierarchy | boolean | True (default): list the sheet paths of the hierarchy with their files. |
check_library_links
Check the links of a project to its symbol and footprint libraries and 3D models. The tool uses the checks of KiCad: ERC for the symbols of the schematic (a library or a symbol that KiCad does not find, a symbol that is not equal to its library symbol) and DRC for the footprints of the board. It finds the footprints of the schematic as "Update PCB from Schematic" does, and the 3D models of the footprints as the STEP export does (KiCad does not check them).
| Parameter | Type | Description |
|---|---|---|
project_path * | string | The project: a .kicad_pro, .kicad_sch or .kicad_pcb file, or its directory. |
search_parts_registry
Search an open registry of KiCad parts (no login). The tool compares the query with the ID, the name, the family, the category, the manufacturer and the keywords of each part. Example queries: "usb c connector", "0402 capacitor", "nrf9151". The results are the first matches in the order of the registry index, with no ranking.
| Parameter | Type | Description |
|---|---|---|
query * | string | The words to find. Each word must match. "*" is a wildcard. |
limit | integer | The maximum number of results (default 20). |
get_registry_part
Give the full record of one part of the parts registry. The record has the download URLs (footprint, symbol, 3D model), the link to the datasheet, the origin of the dimensions, and the reports of real builds.
| Parameter | Type | Description |
|---|---|---|
part_id * | string | The ID of the part (search_parts_registry gives it). |
download_registry_part
Download the files of a part of the parts registry into a local folder. The tool downloads only through HTTPS, only from the hosts of the registry, at most 50 MB for each file, and only the file extensions of each format. The tool replaces a file with the same name in save_dir. It does not check the file version, and does not add the files to a library table: KiCad reads a .kicad_mod file only in a footprint library folder (.pretty). Add the library with add_library_to_table: then copy_symbol_to_library and copy_footprint_to_library can copy its items into a project library.
| Parameter | Type | Description |
|---|---|---|
part_id * | string | The ID of the part (search_parts_registry gives it). |
save_dir * | string | A folder that exists, for example the library folder of the project: in the working folder, the home folder or a folder of PARTS_REGISTRY_SAVE_ROOTS. |
formats | The files to download: "footprint", "symbol", "step", "preview" (.glb), "footprint_svg" and "symbol_svg". Default: the footprint and the symbol. |
list_pcb_footprints
Give the footprints of a board. The layer of a footprint is the standard name of its copper layer, F.Cu or B.Cu, also when the layer table of the board has a user name for it ("Top"): KiCad shows the user name in its GUI.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_pcb file. |
filter_layer | Optional layer of the footprints to give: "F.Cu" or "B.Cu" (a user name of the layer gives an error). Empty: all footprints. |
get_pcb_statistics
Give the size, the layers, the counts and the design rules of a board. The zone count is the count of the copper zones, as the Zone Manager of KiCad lists them: no rule area (keepout), no teardrop, and no zone on non-copper layers only. The size is the bounding box of the Edge.Cuts shapes of the board and of its footprints, with the line width (BOARD::ComputeBoundingBox): an outline of 100 x 100 mm with lines of 0.15 mm gives 100.15 x 100.15 mm. The pad count is all pads of the footprints, also NPTH (FOOTPRINT::GetPadCount). With the text reader (no pcbnew), the answer has no size, no net co…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_pcb file. |
analyze_pcb_nets
Give the routing of a board: track widths, vias, net lengths and layers. The tool gives the distribution of the track widths and of the via drills, the layer spans of the vias, the tracks of each layer, the nets by the length of their tracks, and a comparison with the design rules of the board. The zone count is the count of the copper zones, as the Zone Manager of KiCad lists them: no rule area (keepout), no teardrop, and no zone on non-copper layers only. The tool lists the 20 nets with the longest tracks. The warning about narrow tracks is a rule of the tool (a track narrower than half of…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_pcb file. |
find_tracks_by_net
Give the tracks and the vias of one net of a board, with their lengths and widths. The tool also gives the copper zones of the net (no rule area, no teardrop), each with all of its copper layers on the board, from the top. "Track Layers" is the layers of the tracks only. For a net with no tracks, vias or zones, the tool gives the nets whose name contains the name (no difference between upper and lower case). The layers are the standard names of the copper layers (F.Cu, In1.Cu, B.Cu), also when the layer table of the board has user names for them ("Top"): KiCad shows the user names in its GUI…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_pcb file. |
net_name * | string | The name of the net. |
analyze_pcb_signal_integrity
Give the differential pairs, the RF tracks and the longest signal nets of a board (heuristic). The tool finds a differential pair from the ends of two net names, case-sensitive: _P/_N, _DP/_DN, _TXP/_TXN, _RXP/_RXN, _M/_S and _POS/_NEG (for example USB_DP and USB_DN). It does not find + and - (USB_D+ and USB_D-). The status of a pair uses fixed limits of the tool (OK below 0.127 mm, Marginal below 0.5 mm, else Mismatch), not the rules of the board. The length is the sum of the track segments, with no vias and no pads. An RF net has ANT, RF or FEED in its name, and not VDD or GND. The longest…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_pcb file. |
net_name | string | Optional name of one net to analyze in detail. |
analyze_pcb_power_integrity
Give the copper zones of a board and the routing of its power nets (heuristic). The tool finds a power net and a ground net from its name, and gives the copper zones of each and the tracks of the power nets. A power net has VDD, VCC, VSS, 3V3, 5V, 1V8, VBUS, LDO or DCDC in its name; a ground net has GND, PGND, AGND, DGND or CHASSIS (no difference between upper and lower case). The copper zones are the zones of the Zone Manager of KiCad: no rule area (keepout), no teardrop, and no zone on non-copper layers only. A zone can be on more than one copper layer: the tool gives all of its copper lay…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_pcb file. |
setup_pcb_layout
Make a new board with an outline, next to the schematic. The board has the name of the schematic, a rectangle of four lines on Edge.Cuts, two copper layers and the default design rules. It has no footprints, tracks or nets: use "Update PCB from Schematic" of KiCad for the footprints. The rectangle goes from (0, 0) to (width, height): its top left corner is at the top left corner of the page. pcbnew of the installed KiCad makes the board (a Python with pcbnew is necessary), thus the board has the file format of the installed KiCad, as when the user makes it in the PCB editor. When that is new…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | The .kicad_sch file. The board gets its name and its title. |
height | number | The height of the board in the unit (default 100). |
overwrite | boolean | True replaces an existing .kicad_pcb file. Set it only after the user agreed to lose the existing board. |
unit | string | "mm" (default) or "mil". |
width | number | The width of the board in the unit (default 100). |
export_gerber
Export the Gerber and drill files of a board with kicad-cli, for fabrication. The tool runs "kicad-cli pcb export gerbers", then "kicad-cli pcb export drill", and gives the files that kicad-cli wrote. The Gerber files use the plot settings that the board saves, as the Plot dialog of KiCad (--board-plot-params, PCBNEW_JOBS_HANDLER::JobExportGerbers): the options of the dialog and its selection of the layers that are not copper. kicad-cli plots each copper layer of the board, also a copper layer that the dialog does not select. The output folder of the dialog has no effect: the files go to out…
| Parameter | Type | Description |
|---|---|---|
pcb_path * | string | The .kicad_pcb file. |
output_dir | string | Optional folder of the files. Default: the folder "gerber" next to the board. |
refill_zones | boolean | True: kicad-cli fills all zones again before the plot (--check-zones), as the Plot dialog of KiCad does by default (its check box "Check zone fills before plotting" is on). The fill is only in memory:… |
run_erc
Run the ERC of kicad-cli on a schematic, with the annotation check of the ERC dialog. The tool uses the severities of the project. It also runs the annotation check of the ERC dialog of KiCad (symbols that are not annotated, duplicate references, units with different values), which kicad-cli does not run. For a sub-sheet, the tool checks the root schematic of the project (the answer tells it). The table shows the first 20 violations, with the description cut to 50 characters: first the violations of the annotation check, then the violations of the report of kicad-cli in its order. get_erc_vi…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. |
run_drc
Run the DRC of kicad-cli on a board. The tool uses the severities of the project. When the schematic of the board name is next to the board, the DRC also checks the parity of the schematic and the board. The answer tells if the DRC used new zone fills or the fills of the file. The table shows 20 violations: the errors first, and in each severity the unconnected items and the schematic parity items before the other violations (they are at the end of the report). The description is cut to 40 characters: get_drc_violations gives all of them. The table also has the violations that the project ex…
| Parameter | Type | Description |
|---|---|---|
pcb_path * | string | The .kicad_pcb file. |
refill_zones | boolean | True: kicad-cli fills all zones again before the DRC (--refill-zones), as the DRC dialog of KiCad does by default (its check box "Refill all zones before performing DRC" is on). The fill is only in me… |
get_erc_violations
Give the ERC violations of a schematic, with a filter by severity. The tool uses the last ERC report until a schematic file or a project file changes: then it runs the ERC again (as run_erc, with the annotation check of the ERC dialog). The list has all violations of the severity. An excluded violation shows with "(excluded)" and does not count.
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. |
severity | string | Optional severity: "error" or "warning". Empty: all violations. |
get_drc_violations
Give the DRC violations of a board, with a filter by type. The tool uses the last DRC report of the same zone mode until the board, a project file, a .kicad_dru file or a schematic of the project changes: then it runs the DRC again (run_drc). The list has all violations of the type. An excluded violation shows with "(excluded)" and does not count. A filter that matches no active violation gives "✅" only when the board has no active violation of an other type, else "⚠️" with their count (also for a type with a typing error).
| Parameter | Type | Description |
|---|---|---|
pcb_path * | string | The .kicad_pcb file. |
refill_zones | boolean | True: kicad-cli fills all zones again before the DRC (--refill-zones), as the DRC dialog of KiCad does by default (its check box "Refill all zones before performing DRC" is on). The fill is only in me… |
violation_type | string | Optional type of the violations, as the DRC report of KiCad gives it, for example "clearance". Empty: all violations. |
export_erc_report
Run the ERC of kicad-cli on a schematic and copy its JSON report into a file. The tool replaces an existing output file. The JSON report is the report of kicad-cli: it has the excluded violations ("excluded": true), and not the annotation errors of the ERC dialog (the answer tells them).
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. |
output_path | string | Optional file of the report. Default: <schematic>_erc_report.json next to the schematic. |
export_drc_report
Run the DRC of kicad-cli on a board and copy its JSON report into a file. The tool replaces an existing output file. The JSON report is the report of kicad-cli: it has the excluded violations ("excluded": true).
| Parameter | Type | Description |
|---|---|---|
pcb_path * | string | The .kicad_pcb file. |
output_path | string | Optional file of the report. Default: <board>_drc_report.json next to the board, or <board>_drc_refill_report.json with refill_zones (the JSON report of kicad-cli does not tell the zone mode). |
refill_zones | boolean | True: kicad-cli fills all zones again before the DRC (--refill-zones), as the DRC dialog of KiCad does by default (its check box "Refill all zones before performing DRC" is on). The fill is only in me… |
detect_pin_conflicts
Give the pin conflicts of a schematic: the items of the ERC of kicad-cli about the connections of the symbol pins. The tool runs the ERC of kicad-cli on the full project (as run_erc, with the severities, the pin map and the exclusions of the project) and gives only these items of the ERC of KiCad 10: - pin_to_pin: two connected pins whose electrical types conflict in the pin map of the project (an error or a warning). In the default pin map of KiCad, two open collector pins, two open emitter pins or two tri-state pins are OK: a wired OR or a tri-state bus is not a conflict. - pin_not_d…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. |
severity | string | Optional severity: "error" or "warning". Empty: all violations. |
create_kicad_project
Create a new KiCad project, as the project manager of the installed KiCad (8, 9 or 10) makes it. With no template ("empty"), the project gets the files of "New Project" of KiCad: KiCad 8 and 9 copy the project file kicad.kicad_pro of KiCad and write an empty schematic and board. KiCad 10 makes the project from its template "default" (it makes that template when it is not there). With a template, the project gets the files of "New Project from Template": the files of the template with the project name in the place of the template name, then the files that are missing. KiCad does not change the…
| Parameter | Type | Description |
|---|---|---|
project_name * | string | Name of the project. As in the file dialog of KiCad, the extension ".kicad_pro" (or a last ".") goes: "board.kicad_pro" gives "board". |
project_path * | string | The folder of the project. |
company | string | Optional name of the company. |
overwrite | boolean | True after the user confirmed: with a template, the files of the template replace the files with the same names; with no template, the tool makes the project in a folder that is not empty (the files o… |
template | string | "empty" (default) for a blank project, or a KiCad template: a name on the template pages of KiCad (KICAD_USER_TEMPLATE_DIR and KICAD<version>_TEMPLATE_DIR, for example "Arduino_Uno") or the path of a… |
title | string | Optional title of the project. Default: project_name. |
list_schematic_components
Give the components of a schematic file. Each placed symbol of the file is in the list one time for each sheet path of the file, with the reference and the unit that KiCad gives that path (a sheet that the hierarchy uses two times gives two references). Power symbols are not components. The tool needs kicad-cli (the rules of the KiCad version). Each placed unit of a package is a row of its own with the same reference (U1 four times for four units), and the table has no unit column. This is correct, not a duplicate reference. Total counts the rows (the placed units), not the packages.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | A .kicad_sch file of the project. |
filter_dnp | Optional: True gives only the DNP components, False only the components that are not DNP. | |
filter_type | Optional start of the references, for example "R", "C" or "U" (no difference of case). "R" also gives RV1 and RN1. | |
filter_value | Optional text in the Value field (no difference of case). |
get_symbol_details
Give the fields and the pins of one component of a schematic. The fields are each field of the placed symbol as KiCad 10 loads it: the mandatory fields (Reference, Value, Footprint, Datasheet, Description), then the user fields (for example MPN) in the order of the file. Each text is a JSON string: "" is an empty field, and "\n" in it is a line feed. Some properties of the result come from the load of KiCad and are correct: - "~" of a file older than KiCad 10 is an empty text. KiCad removes the white space at the two ends of the text of a mandatory field, not of a user field. - A user fiel…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | A .kicad_sch file of the project. |
reference * | string | The reference of the component, for example "R1" or "U1". |
search_symbols
Find the components of a schematic whose reference, value or library ID match a pattern. The tool searches only the components of this file (in each of its sheet paths), not the sheets below it. A component matches when the pattern is in a part of the text (Python re.search). The table shows the first 50 matches, and the count of the others.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | A .kicad_sch file of the project. |
pattern * | string | A regular expression with the syntax of the Python module re (no difference of case). Empty: all components. A pattern that is not a regular expression gives an error, and a search that takes longer t… |
search_fields | string | The fields to search: "all" (default), "reference", "value" or "library". |
list_schematic_nets
Give the names of the labels and of the power symbols of a schematic file. The table gives the names of the labels and of the power symbols of this file, not the nets of KiCad: KiCad adds the sheet path to a local label of a sub-sheet ("/Power/VIN"), gives one name to a net with more labels, and names a net with no label. A label with no connection is in the list too. Each name is in the list one time. Type is the first kind that has the name, in this sequence: global, local, hierarchical, power. Code is the index of the name when the tool reads the kinds in this sequence, each in the order o…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | A .kicad_sch file of the project. |
filter_power | boolean | True gives only the nets whose name has "gnd", "vcc", "vdd", "vss", "+" or "-" (heuristic). |
get_schematic_info
Give the title block, the counts and the sheets of a schematic file. The components and the sheet symbols are the ones that KiCad loads for the project of the file (the references of each sheet path). The tool needs kicad-cli (the rules of the KiCad version). A package with more units is one component. Total Nets is the number of the names of the labels and of the power symbols of the file (as list_schematic_nets gives them), not the number of the nets of the netlist.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | A .kicad_sch file of the project. |
add_hierarchical_label
Add a hierarchical label on a pin of a component. A hierarchical label in a sub-sheet connects its net to the pin with the same name of the sheet symbol in the parent sheet. The tool puts the label on the connection point of the pin (with the rotation and the mirror of the symbol). The angle comes from the direction of the pin, as KiCad orients a label that "Update Schematic from PCB" adds on a pin: the label points away from the body, also on the long side of a tall symbol. The text goes from the point to the right at 0 degrees, up at 90, to the left at 180 and down at 270, as KiCad draws it…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_sch file of the sub-sheet. |
pin * | string | The pin number. |
reference * | string | The reference of the component, for example "U1". |
label_name | string | The text of the label. Empty: "<reference>.<pin>" (also with x and y). |
shape | string | The electrical type of the label: "input" (default), "output", "bidirectional", "tri_state" or "passive". ERC uses it. |
snap_to_grid | boolean | Only for x and y. True: move the label to the nearest point of the connection grid of the project (default 1.27 mm), except on a connection point of the sheet (a pin, a wire, a label). |
x | ||
y |
add_global_label
Add a global label on a pin of a component. A global label connects the nets with its name in all sheets of the project. The tool puts the label on the connection point of the pin (with the rotation and the mirror of the symbol). The angle comes from the direction of the pin, as KiCad orients a label that "Update Schematic from PCB" adds on a pin: the label points away from the body, also on the long side of a tall symbol. The text goes from the point to the right at 0 degrees, up at 90, to the left at 180 and down at 270, as KiCad draws it: a label at 180 has its text to the left of the poin…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_sch file. |
label_name * | string | The name of the net. |
pin * | string | The pin number. |
reference * | string | The reference of the component, for example "U1". |
shape | string | The electrical type of the label: "input" (default), "output", "bidirectional", "tri_state" or "passive". ERC uses it. |
snap_to_grid | boolean | Only for x and y. True: move the label to the nearest point of the connection grid of the project (default 1.27 mm), except on a connection point of the sheet (a pin, a wire, a label). |
x | ||
y |
add_component_from_library
Add a symbol of a KiCad symbol library to the schematic. The library comes from the library tables of the installed KiCad and of the project, as in the symbol chooser of KiCad: a library of the project table replaces a global library with the same name. A derived symbol gets the units, the pins and the drawings of its parents. When the schematic has the symbol in its lib_symbols section, the tool uses that definition. The tool gets the version of the installed KiCad from kicad-cli, to find the global library table. The placed symbol gets the fields of the library symbol (Datasheet, Descripti…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_sch file. |
library_name * | string | The library name of the library tables. |
reference * | string | The reference, for example "R1". |
symbol_name * | string | The symbol name in the library. |
value * | string | The text of the Value field. |
footprint | string | The footprint. Empty: the footprint of the library symbol. |
sheet_path | string | Only for a sheet file that the hierarchy uses more than one time: the sheet that gets the reference, as the sheet names ("/Power/") or the UUID path. The error lists the sheet paths. |
snap_to_grid | boolean | True: move the symbol to the nearest position that puts its pins on the connection grid. When the move takes a pin away from a connection point of the sheet (a pin, a wire, a label), the symbol stays… |
unit | integer | The unit, from 1 to the number of units of the symbol. |
x | number | |
y | number |
add_wire
Add a wire to the schematic: a line through two or more points. A KiCad wire has two points (SCH_LINE). The tool adds one wire for each segment, as KiCad saves a line with corners. As the schematic editor of KiCad, the tool merges the segments that are on one straight line, merges a new wire with a wire of the sheet on the same straight line that it touches, removes the part of a new wire between the two pins of a symbol with two pins, and adds a junction where three or more wire directions meet (a wire end or a pin in the middle of a wire). The output tells each junction and each changed wi…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_sch file. |
points * | array | The points (x, y) in mm. Each point after the first ends a segment. |
snap_to_grid | boolean | True: move each point to the nearest point of the connection grid. A point on a connection point of the sheet (a pin, a wire end, a junction, a label) stays. A point in the middle of a wire moves only… |
add_label
Add a local label (text label) to the schematic. The text goes from the point to the right at 0 degrees, up at 90, to the left at 180 and down at 270, and KiCad keeps it upright: a label at 180 has its text to the left of the point (right justified), as KiCad draws it. This is correct, not a defect. The point is the connection point: put it on the end of a wire or on a pin. A label connects at each point of a wire, also in its middle: the tool adds no junction for it. A label on a bus names the bus. KiCad must not have the schematic open: the tool refuses the write (the lock file of KiCad).…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | The .kicad_sch file. |
text * | string | The label text. |
x * | number | |
y * | number | |
orientation | number | The angle: 0, 90, 180 or 270 (KiCad reads no other angle of a label). Use the angle that points away from the wire or the pin, thus the text does not cover them. |
snap_to_grid | boolean | True: move the label to the nearest point of the connection grid of the project (default 1.27 mm), except on a connection point of the sheet (a pin, a wire, a label). A label in the middle of a wire m… |
search_components_by_type
Find the components of a type, for example OLED, sensor or display (heuristic). The tool searches the value, the footprint and the net names of each component. It reads the netlist that kicad-cli writes now: each component of each sheet path, at each level of the hierarchy, with the reference of that path. The netlist has no power symbols and no symbol with no library symbol. The tool needs kicad-cli. The types OLED, sensor, display, SPI, I2C, UART, power, memory and wireless search a list of words (for example SPI: spi, mosi, miso, sck, cs). An other type is one word to search. The tool fin…
| Parameter | Type | Description |
|---|---|---|
component_type * | string | The type of component, for example "OLED", "sensor", "display", "SPI" or "I2C". |
file_path * | string | A .kicad_sch file of the project. |
search_in_subsheets | boolean | True (default): the components of the file and of all sheets below it (for the root schematic: the full project). False: only the components that are placed in the file. |
set_symbol_fields
Write the fields of placed symbols, as KiCad writes them. The tool writes each field into each unit of the reference (one package has one Value and one MPN). A field that the symbol does not have becomes a new field, hidden as KiCad 9 and 10 make it (a file of KiCad 8: visible; Value_Confirmed and MPN_Confirmed: always hidden). With a variant (KiCad 10), the tool writes the fields of that variant into each unit: a value equal to the field of the symbol removes the field from the variant. The tool checks all changes and all files first, and writes no file when a check fails. It writes all file…
| Parameter | Type | Description |
|---|---|---|
changes * | array | One item for each reference (and variant): the reference, the fields by name, and the variant name (empty: the symbol). |
schematic_path * | string | A .kicad_sch file of the project. The tool finds the references in the full project. |
set_symbol_attributes
Write the attributes of placed symbols, as the Symbol Properties dialog of KiCad 10 sets them: "Do not populate" (dnp), "Exclude from bill of materials", "Exclude from board", "Exclude from position files" and "Exclude from simulation". The tool writes each attribute into each unit of the reference. KiCad 10.0.6 gives the other units the same DNP and Exclude from BOM, board and position files, but not Exclude from simulation (it keeps that one for each unit): the tool sets each unit, as the dialog on each unit does. The tool changes only the attributes. The OK of the dialog also copies the fi…
| Parameter | Type | Description |
|---|---|---|
changes * | array | One item for each reference (and variant): the reference, the attributes to set (a missing attribute does not change), and the variant name (empty: the symbol). |
schematic_path * | string | A .kicad_sch file of the project. The tool finds the references in the full project. |
render_pcb
Render a 3D view of a board as an image with kicad-cli (KiCad 9 or later). The image has the board and the 3D models of the footprints: a footprint with no 3D model has no body in the image. Use the image for a visual review of the layout. The tool replaces an existing image file with the same name.
| Parameter | Type | Description |
|---|---|---|
pcb_path * | string | The .kicad_pcb file. |
height | integer | The height of the image in pixels (default 900). |
output_path | string | Optional image file: .png, or .jpg or .jpeg for a JPEG image. Default: <board>_render_<side>.png next to the board. |
quality | string | "basic" (default, fast), "high" (ray tracing, slower), "user" or "job_settings" (the settings of KiCad). |
rotate | string | Optional rotation of the board "X,Y,Z" in degrees, for example "-30,0,25". |
side | string | The side of the camera: "top" (default), "bottom", "left", "right", "front" or "back". |
width | integer | The width of the image in pixels (default 1600). |
export_pcb_3d
Export a board as a STEP 3D model with kicad-cli, for mechanical CAD. The model has the board and the 3D models of its footprints. kicad-cli does not add a 3D model that it cannot find or read: the tool then gives a warning with the footprints and the reason. Tell the user about each such footprint. The tool replaces an existing STEP file with the same name.
| Parameter | Type | Description |
|---|---|---|
pcb_path * | string | The .kicad_pcb file. |
board_only | boolean | True gives only the board, with no models of the footprints. |
output_path | string | Optional .step or .stp file. Default: <board>.step next to the board. |
export_schematic_svg
Export the pages of a schematic as SVG files with kicad-cli. kicad-cli renders the pages of the project with the hierarchy of its root schematic (the schematic of the project name), thus each page has the references of its sheet path. For the root schematic, the files are all pages of the project. For an other file (a sub-sheet), the files are the pages of its sheet paths (a sheet that the hierarchy uses two times gives two pages). An SVG file is a vector image: a zoom shows each detail with no loss. The tool needs kicad-cli. The tool replaces a file with the same name in output_dir; the othe…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. |
output_dir | string | Optional folder of the files. Default: <schematic>_svg next to the schematic. |
assign_footprint
Assign footprints to placed symbols, as CvPcb ("Assign Footprints") of KiCad 10 does it when it saves. The tool writes the footprint into the Footprint field of each unit of the reference, in the symbol, not in a variant. A variant with a Footprint of its own keeps it (the tool gives a warning; set_symbol_fields with the variant changes it). When the old footprint is empty and the field is visible, the field becomes hidden, as the save of CvPcb does ("Footprint field visible" in the table), also when the footprint stays empty. CvPcb hides such a field in each symbol of the netlist; the tool c…
| Parameter | Type | Description |
|---|---|---|
assignments * | array | One item for each reference: the reference and the footprint ("<library>:<footprint>", or empty to remove it). |
schematic_path * | string | A .kicad_sch file of the project. The tool finds the references in the full project. |
ipc_status
Show the state of the IPC connection to the running KiCad. The IPC tools change the board that is open in the PCB editor of a running KiCad. Use this tool first: it shows if the IPC tools can operate now, and the limits of the running KiCad version.
| Parameter | Type | Description |
|---|---|---|
board_path | string | The path of a .kicad_pcb file (optional). The tool then shows if the PCB editor has this board. |
ipc_get_selection
Show the items that the user selected in the PCB editor of the running KiCad.
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
ipc_select_items
Select items in the PCB editor of the running KiCad, by reference or by net. The selection is no change of the board: KiCad makes no undo step for it. The selection filter of the PCB editor does not apply: the API cannot read it.
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
mode | string | "replace" (clear the selection, then select the items), "add", "remove" (remove the items from the selection), or "clear" (no references and no nets). |
nets | The net names, for example ["GND", "/SDA"]. They are case-sensitive. A net gives its tracks, arcs, vias and shapes: the item types of "Select All Tracks in Net" of KiCad. | |
references | The references of footprints, for example ["R1", "U3"]. They are case-sensitive. |
ipc_place_footprints
Place footprints on the board in the PCB editor of the running KiCad. KiCad does the change. One call is one undo step. The tool checks all placements first, and changes nothing when a check fails. The tool can only change the side: a change of the position, the rotation or the lock gives an error (the limits footprint_update_loses_data and footprint_move_children of ipc_status). A footprint that is not on F.Cu or B.Cu gives an error.
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
flip_direction * | string | The flip of a footprint to the other side: "left_right" (around the Y axis) or "top_bottom" (around the X axis). KiCad flips around the position of the footprint. The API cannot read the flip directio… |
placements * | array | For each footprint: the reference, and the side ("top" or "bottom"). x_mm, y_mm, rotation_deg and locked give an error. |
override_locks | boolean | Flip also a locked footprint, as the PCB editor does with "Override locks". With false, a locked footprint that must change its side gives an error. |
ipc_save_board
Save the board of the PCB editor of the running KiCad into its file. KiCad saves the board as File > Save does, also the project file. KiCad writes the file version of the running KiCad.
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
ipc_refill_zones
Fill all zones of the board in the PCB editor of the running KiCad. KiCad fills the zones as "Fill All Zones" does, with its progress dialog. The tool waits for the end of the fill.
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
timeout_s | number | The longest time to wait for the end of the fill, 1 to 3600 s. |
ipc_add_tracks
Add straight tracks and through vias on one net of the board in the PCB editor. KiCad adds the items in one undo step. The sizes come from the netclass of the net, or from the arguments (the router of the PCB editor uses the sizes that the user selected in the editor, which can be other sizes). KiCad checks no clearance: the answer tells the user to run DRC. The tool refuses a net that the board does not have. KiCad 10.0.6 must have the schematic editor closed (KiCad bug #24966). When the running KiCad has the limit free_via (ipc_status), each via must be at an end of a new track of the same…
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
net * | string | The name of the net, for example "GND" or "/SDA" (case-sensitive). |
tracks | The tracks: start, end (mm) and copper layer of each one. | |
via_drill_mm | The via drill. Default: the via drill of the netclass. | |
via_size_mm | The via diameter. Default: the via size of the netclass. | |
vias | The positions of the through vias (mm). | |
width_mm | The track width. Default: the track width of the netclass. |
ipc_add_zone
Add a copper zone with a solid fill on one net and one copper layer of the board in the PCB editor. The API gives no default zone settings: the settings are required arguments. When the user did not give them, ask the user. KiCad adds the zone in one undo step, with no fill: fill it with ipc_refill_zones. KiCad checks no clearance: the answer tells the user to run DRC. KiCad 10.0.6 must have the schematic editor closed (KiCad bug #24966). An outline that crosses itself, has the same point two times one after the other, or has no area gives an error.
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
border_pitch_mm * | number | The pitch of the border hatch, 0.1 to 2 mm. |
border_style * | string | The border of the zone in the editor: "solid", "hatched_edge" or "hatched_full". |
connection * | string | The connection of pads: "thermal" (thermal reliefs), "solid", "none", or "thermal_pth" (thermal reliefs for through-hole pads only). |
island_removal * | string | Remove isolated islands of the fill: "always" or "never". (The mode with a minimum area is not possible: the API gives no unit for it.) |
layer * | string | A copper layer of the board, for example F.Cu. |
min_thickness_mm * | number | The minimum width of the fill, 0.025 mm or more. |
net * | string | The name of the net, for example "GND" (case-sensitive). |
outline * | array | The corners of the zone outline in mm (3 or more points, the first point not again at the end). |
priority * | integer | The zone priority (0 or more). |
thermal_gap_mm * | number | The thermal relief gap (KiCad keeps it also for a solid connection: a pad can have its own thermal connection). |
thermal_spoke_width_mm * | number | The thermal spoke width, not smaller than min_thickness_mm. |
clearance_mm | An own clearance of the zone, 0 to 100 mm: KiCad uses the larger of it and the current clearance of the netclass and the rules. Default: none (0), thus only the netclass and the rules apply. | |
name | string | The name of the zone (optional, not the name of an other zone). |
ipc_add_board_outline
Add the board outline: one closed polygon on Edge.Cuts of the board in the PCB editor, when the board has no Edge.Cuts shapes. KiCad adds the outline in one undo step. A board that has Edge.Cuts shapes gives an error: the tools delete no items (KiCad 10.0.6 gives no result of a delete, limit delete_results); the user deletes the old outline in the PCB editor. Footprints can have Edge.Cuts shapes too: the tool does not count them. KiCad 10.0.6 must have the schematic editor closed (KiCad bug #24966). An outline that crosses itself, has the same point two times one after the other, or has no ar…
| Parameter | Type | Description |
|---|---|---|
board_path * | string | The path of the .kicad_pcb file that is open in the PCB editor. |
outline * | array | The corners of the outline in mm (3 or more points, the first point not again at the end). |
line_width_mm | The line width. Default: the graphics defaults of the board for Edge.Cuts. |
job_status
Give the background jobs of the tool calls, the state or the result of one job, or cancel a job. A tool call that takes longer than 20 s becomes a background job: its answer starts with "⏳" and gives the job ID, and the work continues (also when the client stops to wait for the call). This tool gives the result of the job: the same text that the tool gives, or the same error. A call of the same tool with the same arguments while its job runs starts no second run: it waits for that job again (up to 20 s) and gives its result or its ID. The list also has the calls that run in their first 20 s…
| Parameter | Type | Description |
|---|---|---|
cancel | boolean | True: cancel the running job job_id. |
job_id | string | The ID of a job. Empty: the list of the jobs of the server process. |
create_project_library
Make a new, empty library and add it to the project library table, as "New Library" of the symbol editor and of the footprint editor of KiCad 10 does. A symbol library is a .kicad_sym file with no symbols, in the format of KiCad 10.0. A footprint library is an empty .pretty folder. The new row has the nickname name, the type KiCad, and a URI with a path variable of KiCad or ${KIPRJMOD} when one holds the library. The tool does not replace a library that exists. KiCad must not have the project open: KiCad reads the project tables only when it opens the project. The installed KiCad must be KiCa…
| Parameter | Type | Description |
|---|---|---|
kind * | string | "symbol" or "footprint". |
name * | string | The name of the library: the file name with no extension, and the nickname in the table. |
project_path * | string | The .kicad_pro file or the project folder. |
folder | The folder of the new library: an absolute path, or a path relative to the project folder. Default: the project folder. |
add_library_to_table
Add a KiCad library that exists to the project library table, as the table dialog of KiCad 10 does. The library must be of the KiCad format: a .kicad_sym file or a folder with .kicad_sym files (symbols), a folder with .kicad_mod files (footprints). The tool refuses other formats. A nickname that the project table has is an error. A nickname of the global table gives a warning: the project row hides the global library. A library of an older file version gives a warning with the step for its upgrade; a library of a newer file version is an error. KiCad must not have the project open. The instal…
| Parameter | Type | Description |
|---|---|---|
kind * | string | "symbol" or "footprint". |
library_path * | string | The library file or folder: an absolute path, or a path relative to the project folder. |
project_path * | string | The .kicad_pro file or the project folder. |
description | string | The description of the row. |
nickname | The nickname in the table. Default: the name of the library with no extension, as KiCad gives it. |
remove_library_from_table
Remove a library from the project library table, as the table dialog of KiCad 10 does. The library files stay: KiCad does not delete them. KiCad must not have the project open. The installed KiCad must be KiCad 10.0.
| Parameter | Type | Description |
|---|---|---|
kind * | string | "symbol" or "footprint". |
nickname * | string | The nickname of the row. |
project_path * | string | The .kicad_pro file or the project folder. |
set_library_table_row
Enable, disable, show or hide a library of the project library table, as the table dialog of KiCad 10 does. KiCad does not load a disabled library. A hidden symbol library is loaded, but the symbol chooser and the library tree do not show it. Only a symbol table has the visible flag. KiCad must not have the project open. The installed KiCad must be KiCad 10.0.
| Parameter | Type | Description |
|---|---|---|
kind * | string | "symbol" or "footprint". |
nickname * | string | The nickname of the row. |
project_path * | string | The .kicad_pro file or the project folder. |
enabled | True enables the library, False disables it. None: no change. | |
visible | True shows the library, False hides it (symbol tables only). None: no change. |
upgrade_project_libraries
Convert the libraries of the project tables to the file version of the installed KiCad 10, with kicad-cli (`kicad-cli sym upgrade`, `kicad-cli fp upgrade`). KiCad converts each library of an older version into a temporary folder. Then KiCad saves the result again: the bytes must not change, and the names of the symbols or the footprints must stay. Only then the tool writes the files of that library, all or none. The tool makes no backup: git gives the way back, and the output names a library that git cannot give back. A converted library cannot be read by an older KiCad. A library outside the…
| Parameter | Type | Description |
|---|---|---|
project_path * | string | The .kicad_pro file or the project folder. |
include_outside | boolean | True also converts the libraries outside the project folder. |
libraries | The nicknames of the libraries to convert. Default: all libraries of the project tables. |
copy_symbol_to_library
Copy a symbol into a library of the project table, as "Save As" of the symbol editor of KiCad 10 does. To an other library, a derived symbol goes with its parents (KiCad copies the full parent chain; only the symbol gets the new name). flatten=True saves only the flattened symbol, as the "Flatten" check box. The Value gets the new name when it was equal to the old name. The copy starts from the symbols as KiCad loads them: the text of a save of the library in kicad-cli (about 0.2 s, a cache keeps the last saves). Thus a library that KiCad did not save gives the texts of KiCad: no blanks at t…
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The symbol, "<library>:<symbol>", for example "Device:R". |
project_path * | string | The .kicad_pro file or the project folder. |
target_library * | string | The nickname of the target in the project symbol table. |
flatten | boolean | True saves only the flattened symbol, with no parent. |
new_name | The new name. KiCad changes spaces to "_". Default: the old name. | |
overwrite | boolean | True replaces the symbols with the same names in the target (KiCad: Overwrite / Overwrite All). False refuses them. |
copy_footprint_to_library
Copy a footprint into a library of the project table, as "Save As" of the footprint editor of KiCad 10 does. The Value gets the new name when it was equal to the old name. KiCad saves the footprint (kicad-cli), and a second save must give the same bytes. The target must be a footprint library of the project table in the version of the installed KiCad (else: upgrade_project_libraries first). A footprint that is not on F.Cu is refused. KiCad must not have the project open. The installed KiCad must be KiCad 10.0.
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The footprint, "<library>:<footprint>". |
project_path * | string | The .kicad_pro file or the project folder. |
target_library * | string | The nickname of the target in the project footprint table. |
new_name | The new name. Default: the old name. | |
overwrite | boolean | True replaces a footprint with the same name in the target (KiCad: Overwrite). False refuses it. |
set_library_symbol_properties
Change the properties of a symbol of a project library, as the Symbol Properties dialog of the symbol editor of KiCad 10 does. A field name that the symbol has gets the new text (a mandatory name in any case). A new name gives a new hidden field at (0, 0), with the text size of the symbol editor settings. A text of None removes a user field (the five mandatory fields cannot be removed). As in the dialog, a text that is a path to a file that exists ("/", "${", "./", "../") gets "file://" before it, the escapes ("{slash}") become characters, and the text of a mandatory field has no white space…
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The symbol, "<library>:<symbol>", of a library of the project table. |
project_path * | string | The .kicad_pro file or the project folder. |
fields | The field texts by name. None as a text removes the user field. | |
footprint_filters | The new list of footprint filters. None: no change. | |
keywords | The new keywords. None: no change. "" removes them. |
create_derived_symbol
Make a new symbol that extends a symbol of the same project library, as "Derive from existing symbol" of the symbol editor of KiCad 10 does. The new symbol has the units, the pins and the drawings of its parent (extends). Its mandatory fields are copies of the fields of the parent: the Footprint and the Datasheet are empty unless keep_footprint and keep_datasheet; the Value of a power symbol is the new name. With transfer_user_fields, the new symbol gets a copy of each user field of the parent (MPN, for example), with an empty text unless keep_user_field_content. The arguments have the defaul…
| Parameter | Type | Description |
|---|---|---|
name * | string | The name of the new symbol. |
parent_lib_id * | string | The parent, "<library>:<symbol>", of a library of the project table. The new symbol goes into the same library. |
project_path * | string | The .kicad_pro file or the project folder. |
keep_datasheet | boolean | Keep the Datasheet of the parent ("Keep linked datasheet"). |
keep_footprint | boolean | Keep the Footprint of the parent ("Keep linked footprint"). |
keep_user_field_content | boolean | With transfer_user_fields, keep their texts ("Keep content of user-defined fields"). |
transfer_user_fields | boolean | Copy the user fields of the parent ("Transfer user-defined fields"). |
rename_library_symbol
Give a symbol of a project library an other name, as "Rename" of the library tree of the symbol editor of KiCad 10 does. As the rename dialog, the tool removes the white space at the two ends of the name and writes the escapes of the name ("{colon}" for ":"). A space stays a space (not "_", as in create_derived_symbol). The Value gets the new name when it was equal to the old name. The symbols derived from the symbol extend the new name. A name that the library has already is an error, also with an other case (KiCad compares the names with no difference of case): the tool does not replace a…
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The symbol, "<library>:<symbol>", of a library of the project table. |
new_name * | string | The new name. |
project_path * | string | The .kicad_pro file or the project folder. |
delete_library_symbol
Delete a symbol from a project library, as "Delete" of the library tree of the symbol editor of KiCad 10 does. KiCad deletes a symbol together with all symbols derived from it (also the derived symbols of a derived symbol). With delete_derived=False, a symbol with derived symbols is an error that gives their names. delete_derived=True deletes them all, as "Delete All Listed Symbols" of KiCad. KiCad does not change the schematics that use a deleted symbol, and neither does the tool: the answer gives the placed symbols with a deleted lib_id as a warning. The schematic keeps its copy of each sy…
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The symbol, "<library>:<symbol>", of a library of the project table. |
project_path * | string | The .kicad_pro file or the project folder. |
delete_derived | boolean | True deletes the symbols derived from the symbol too. |
rename_library_footprint
Give a footprint of a project library an other name, as "Rename" of the library tree of the footprint editor of KiCad 10 does. KiCad saves the footprint as "<new name>.kicad_mod", then removes the old file. The Value gets the new name when it was equal to the old name. As the rename dialog, the tool removes the white space at the two ends of the name. A name with one of the characters \ / : " < > | * ? is an error: KiCad changes them to "_" in the file name, and reads the name from the file name. A name that the library has already is an error: the tool does not replace a footprint. On a fil…
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The footprint, "<library>:<footprint>", of a library of the project table. |
new_name * | string | The new name. |
project_path * | string | The .kicad_pro file or the project folder. |
delete_library_footprint
Delete a footprint from a project library, as "Delete" of the library tree of the footprint editor of KiCad 10 does: KiCad removes the file of the footprint. KiCad does not change the uses of the footprint, and neither does the tool: the answer gives as a warning the Footprint fields of the placed symbols (also of their variants) and of the symbols of the project symbol libraries, and the footprints of the board of the project, that have its library ID. The board keeps its copy of each footprint. The library must be a footprint library of the project table, in the version of the installed Ki…
| Parameter | Type | Description |
|---|---|---|
lib_id * | string | The footprint, "<library>:<footprint>", of a library of the project table. |
project_path * | string | The .kicad_pro file or the project folder. |
update_symbols_from_library
Update placed symbols from their library symbols, as "Update Symbols from Library" of the schematic editor of KiCad 10 does it. Each matching symbol gets the library symbol of its library ID (from the global and the project symbol library tables, flattened): the new shape and pins, the keywords and the footprint filters (always, as the dialog). The fields, the attributes and the alternate pins follow the options, with the defaults of the dialog. The library symbol is the text of a save in kicad-cli, as KiCad loads it: kicad-cli saves each library symbol with its parents one time (about 0.2 s)…
| Parameter | Type | Description |
|---|---|---|
schematic_path * | string | A .kicad_sch file of the project. The tool finds the symbols in the full project. |
fields | The names of the fields to update, or none for the dialog defaults. The names of the user fields have case. | |
match | string | "all" (each symbol), "reference" or "value" (pattern with "*" and "?", no case), or "lib_id" (pattern is "<library>:<symbol>"). |
options | The update options of the dialog; a missing option has the default of the dialog. | |
pattern | string | The text of the match "reference", "value" or "lib_id". |