参考手册

本文档的版权归 (C) 2023-2024 所有,由下列贡献者提供。您可以根据 GNU 通用公共许可证 (http://www.gnu.org/licenses/gpl.html) 版本 3 或更高版本或知识共享署名许可证 (http://creativecommons.org/licenses/by/3.0/) 版本 3.0 或更高版本的条款分发和/或修改它。

本指南中的所有商标均属于其合法所有者。

Contributors

Graham Keeth

翻译人员

taotieren <[email protected]>, 2019-2024.

Feedback

KiCad 项目欢迎与软件或其文档相关的反馈、错误报告和建议。有关如何提交反馈或报告问题的更多信息,请参阅 https://www.kicad.org/help/report-an-issue/ 上的说明

KiCad 命令行界面简介

KiCad 提供了一个命令行界面,可以通过运行 kicad-cli 二进制文件来使用。使用命令行界面,您可以以自动化方式对原理图、PCB、符号和封装执行许多操作,例如绘制 PCB 设计中的 Gerber 文件或将符号库从传统文件格式升级到现代格式。

在 macOS 上,kicad-cli 可执行文件位于 /Applications/KiCad/KiCad.app/Contents/MacOS/kicad-cli

The kicad-cli command has 6 subcommands: fp, jobset, pcb, sch, sym, and version. Each subcommand may have its own subcommands and arguments. For example, to export Gerber files from a PCB you could run kicad-cli pcb export gerbers example.kicad_pcb.

您可以添加 --help-h 标志来查看有关每个子命令的信息。例如,运行 kicad-cli pcb -h 打印有关 pcb 子命令的使用信息,而 kicad-cli pcb export gerbers -h 专门打印 pcb export gerbers 子命令的使用信息。

封装命令

fp 子命令将封装导出为另一种格式,或将封装库升级到 KiCad 封装文件格式的当前版本。

封装导出

fp export svg 命令将指定库中的一个或多个封装导出到 SVG 文件中。

Usage: kicad-cli fp export svg [--help] [--output OUTPUT_DIR] [--layers LAYER_LIST] [--define-var KEY=VALUE] [--theme VAR] [--footprint FOOTPRINT_NAME] [--sketch-pads-on-fab-layers] [--hide-DNP-footprints-on-fab-layers] [--sketch-DNP-footprints-on-fab-layers] [--crossout-DNP-footprints-on-fab-layers] [--black-and-white] INPUT_DIR

位置参数:

INPUT_DIR

要导出的封装库目录 (.pretty)。

可选参数:

-h, --help

Show help for the footprint SVG export command.

-o <output dir>, --output <output dir>

The output directory for the exported files. When this argument is not used, the files are exported to the current directory.

-l <layer list>, --layers <layer list>

A comma-separated list of layer names to export from the footprint, such as F.Cu,B.Cu. If no layers are given, all layers are exported.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-t <theme name>, --theme <theme name>

The name of the theme to use for export. If no theme is given, the footprint editor’s currently selected theme is used.

--fp <footprint>, --footprint <footprint>

The name of the specific footprint to export from the library. When this argument is not used, all footprints in the library are exported.

--sp, --sketch-pads-on-fab-layers

Draw pad outlines and their numbers on front and back fab layers.

--hdnp, --hide-DNP-footprints-on-fab-layers

Don’t plot text and graphics of DNP footprints on fab layers.

--sdnp, --sketch-DNP-footprints-on-fab-layers

Plot graphics of DNP footprints in sketch mode on fab layers.

--cdnp, --crossout-DNP-footprints-on-fab-layers

Plot an 'X' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators.

--black-and-white

Export footprints in black and white.

封装升级

The fp upgrade command converts the the specified footprint library from a legacy KiCad footprint format or a non-KiCad footprint format to the native format for the current version of KiCad. If the input library is already in the current file format, no action is taken.

Supported input footprint formats are:

  • KiCad footprint library (.pretty folder with .kicad_mod files)

  • KiCad (pre-5.0) footprint library (.mod, .emp)

  • Altium footprint library (.PcbLib)

  • Altium integrated library (.IntLib)

  • CADSTAR PCB archive (.cpa)

  • EAGLE XML library (.lbr)

  • EasyEDA (JLCEDA) Std file (.json)

  • EasyEDA (JLCEDA) Pro file (.elibz, .epro, .zip)

  • GEDA/PCB library (folder with .fp files)

Usage: kicad-cli fp upgrade [--help] [--output OUTPUT_DIR] [--force] INPUT_DIR

位置参数:

INPUT_DIR

Footprint library directory to upgrade. For KiCad format footprint libraries, this is the .pretty directory, not a .kicad_mod file.

可选参数:

-h--help

显示封装升级命令的帮助。

-o <output dir>--output <output dir>

升级后封装的输出目录。不使用此参数时,升级后的封装会保存在原始封装之上。

--force

强制保存输入库,即使它已经是当前文件格式。

Jobset commands

The jobset run command runs a predefined jobset.

Usage: kicad-cli jobset run [--help] [--stop-on-error] [--file JOB_FILE] [--output OUTPUT] INPUT_FILE

位置参数:

INPUT_FILE

Project file to use with the jobset.

可选参数:

-h, --help

Show help for the jobset command.

--stop-on-error

As jobs are executed in sequence, stop running after a job fails. If not given, jobs will continue executing after any job fails.

-f <jobset file>, --file <jobset file>

The jobset file (.kicad_jobset) to run.

--output <output ID>

The jobset output to generate. If no output is specified, all outputs will be generated. The output is specified as a unique ID. The ID for each output is printed by the jobset run command when --output is not used. It can also be found in the .kicad_jobset file under the output’s id key.

PCB 命令

pcb 命令运行设计规则检查或将电路板导出为各种其他文件格式,包括制造和 3D 文件。

PCB DRC

pcb drc 命令在电路板上运行设计规则检查并生成报告。

用法:kicad-cli pcb drc [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--format FORMAT] [--all-track-errors] [--schematic-parity] [--units UNITS] [--severity-all] [--severity-error] [--severity-warning] [--severity-exclusions] [--exit-code-violations] INPUT_FILE

位置参数:

INPUT_FILE

要在其上运行 DRC 的电路板文件。

-h--help

显示 DRC 命令的帮助。

-o <output filename>--output <output filename>

生成的 DRC 报告的输出文件名。不使用该参数时,输出文件名将与输入文件相同,根据所选格式,文件扩展名为 .rpt.json

-D <variable name>=<value>, --define-var <variable_name>=<value>

添加或覆盖工程变量定义。可多次使用以定义多个变量。

--format <format>

报告文件格式。选项为 report (默认)或 json

--all-track-errors

报告每个布线的所有错误。

--schematic-parity

测试 PCB 和原理图之间的奇偶校验。

--units <unit>

要在报表中使用的单位。选项为 mm(默认)、inmils

--severity-all

报告所有 DRC 违规行为。这相当于使用所有其他 DRC 严重性选项。

--severity-error

报告所有错误级别的 DRC 违规行为。该选项可与其他 DRC 严重性选项结合使用。

--severity-warning

报告所有警告级别的 DRC 违规行为。该选项可与其他 DRC 严重性选项结合使用。

--severity-exclusions

报告所有排除在外的 DRC 违规行为。该选项可与其他 DRC 严重性选项结合使用。

--exit-code-violations

根据是否存在 DRC 违规,返回退出代码。如果没有发现违规,则退出代码为 0;如果发现违规,则退出代码为 5。

PCB BREP (OCCT) export

The pcb export brep command exports a board design to a BREP (OCCT-native boundary representation) 3D model file.

Usage: kicad-cli pcb export brep [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--force] [--no-unspecified] [--no-dnp] [--grid-origin] [--drill-origin] [--subst-models] [--board-only] [--cut-vias-in-body] [--no-board-body] [--no-components] [--component-filter VAR] [--include-tracks] [--include-pads] [--include-zones] [--include-inner-copper] [--include-silkscreen] [--include-soldermask] [--fuse-shapes] [--fill-all-vias] [--min-distance MIN_DIST] [--net-filter VAR] [--user-origin VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the BREP export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .brep file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --force

Overwrite output file.

--no-unspecified

Exclude 3D models of components with 'unspecified' footprint type.

--no-dnp

Exclude 3D models of components with 'Do not populate' attribute.

--grid-origin

Use grid origin as origin of output file.

--drill-origin

Use drill origin as origin of output file.

--subst-models

Replace VRML models in footprints with STEP or IGS models of the same name, if they exist.

--board-only

Only include the board itself in the generated model; exclude all component models.

--cut-vias-in-body

Cut via holes in board body even if conductor layers are not exported.

--no-board-body

Exclude board body.

--no-components

Exclude 3D models for components.

--component-filter <reference designator list>

Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported)

--include-tracks

Include tracks and vias on outer conductor layers in export (time consuming).

--include-pads

Include pads in export (time consuming).

--include-zones

Include zones in export (time consuming).

--include-inner-copper

Include elements on inner conductor layers in export.

--include-silkscreen

Include silkscreen graphics in export as a set of flat faces.

--include-soldermask

Include solder mask layers in export as a set of flat faces.

--fuse-shapes

Fuse overlapping geometry together in export (time consuming).

--fill-all-vias

Don’t cut via holes in conductor layers.

--min-distance <min distance>

Tolerance for considering two points to be in the same location. Default: 0.01mm.

--net-filter <net filter>

Only include copper items belonging to nets matching this wildcard.

--user-origin <output origin>

Specify a custom origin for the output file, with X and Y coordinates. For example, 1x1in, 1x1inch, or 25.4x25.4mm. The default unit is millimeters.

PCB 钻孔文件导出

pcb export drill 命令从电路板导出钻孔文件。

用法:kicad-cli pcb export drill [--help] [--output OUTPUT_DIR] [--format FORMAT] [--drill-origin DRILL_ORIGIN] [--excellon-zeros-format ZEROS_FORMAT] [--excellon-oval-format OVAL_FORMAT] [--excellon-units UNITS] [--excellon-mirror-y] [--excellon-min-header] [--excellon-separate-th] [--generate-map] [--map-format MAP_FORMAT] [--gerber-precision VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h--help

显示钻孔文件导出命令的帮助。

-o <output dir>--output <output dir>

钻孔文件的输出目录。不使用此参数时,钻孔文件保存在当前目录下。

--format <format>

钻取文件格式。选项为 excellon(默认)或 gerber

--drill-origin <origin>

钻孔文件的坐标原点。选项有 absolute (默认),用于使用电路板的绝对原点;或 plot ,用于使用电路板的钻孔/置位原点。

--excellon-zeros-format <format>

钻孔文件中零的表示格式。提供四种选项:decimal(默认,采用十进制格式)、suppressleading(省略前导零)、suppresstrailing(省略尾随零)、以及 keep(保留所有零)。这些设置仅在 Excellon 格式的钻孔文件中有效。

--excellon-oval-format <format>

控制椭圆形通孔的钻孔策略。提供两种模式:route(布线模式)和 alternate(备用模式,默认选项)。这些设置仅在 Excellon 格式的钻孔文件中生效。

-U <units>--excellon-units <units>

钻孔文件的单位。选项为 mm(默认)或 in。仅适用于 Excellon 格式的钻孔文件。

--excellon-mirror-y

沿 Y 方向镜像钻孔文件。仅适用于 Excellon 格式的钻孔文件。

--excellon-min-header

在钻孔文件中使用最小的钻头。仅适用于 Excellon 格式的钻孔文件。

--excellon-separate-th

为电镀通孔和非电镀通孔生成不同的钻孔文件。 仅适用于 Excellon 格式的钻孔文件。

--generate-map

除了钻取文件之外,还生成映射文件。

--map-format <format>

映射文件格式。选项包括 pdf(默认)、gerberx2psdxfsvg

--gerber-precision <precision>

钻孔文件的精度(位数)。有效选项为 56(默认)。 仅适用于 Gerber 格式的钻孔文件。

PCB DXF 导出

pcb export dxf 命令将电路板设计导出为 DXF 文件。

Usage: kicad-cli pcb export dxf [--help] [--output OUTPUT_FILE] [--layers LAYER_LIST] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--exclude-refdes] [--exclude-value] [--use-contours] [--use-drill-origin] [--include-border-title] [--output-units UNITS] [--drill-shape-opt VAR] [--common-layers COMMON_LAYER_LIST] [--mode-single] [--mode-multi] [--plot-invisible-text] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the DXF export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .dxf file extension.

-l <layer list>, --layers <layer list>

A comma-separated list of layer names to export from the footprint, such as F.Cu,B.Cu. At least one layer must be given.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the board file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

--erd, --exclude-refdes

Exclude footprint reference designators from plot.

--ev, --exclude-value

Exclude footprint values from plot.

--uc, --use-contours

Plot graphic items using their contours.

--udo, --use-drill-origin

Plot using the drill/place file origin.

-ibt, --include-border-title

Include sheet border and title block in plot.

--ou <unit>, --output-units <unit>

Output units. Options are mm or in (default).

--drill-shape-opt <shape>

The shape of drill marks in the plot. Options are 0 for no drill marks, 1 for small marks, or 2 for actual size marks (default).

--cl <layer list>, --common-layers <layer list>

A comma-separated list of layer names to plot on all layers, such as F.Cu,B.Cu.

--mode-single

Generates a single file with the output arg path acting as the complete directory and filename path. COMMON_LAYER_LIST does not function in this mode. Instead LAYER_LIST controls all layers plotted.

--mode-multi

Generates one or more files with behavior similar to the KiCad GUI plotting. The given output path specifies a directory in which files may be output.

--plot-invisible-text

Force plotting of values and references, even if they are invisible.

PCB GenCAD export

The pcb export gencad command exports a board design to a GenCAD file.

Usage: kicad-cli pcb export gencad [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--flip-bottom-pads] [--unique-pins] [--unique-footprints] [--use-drill-origin] [--store-origin-coord] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the DXF export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .cad file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --flip-bottom-pads

Flip bottom footprint padstacks.

--unique-pins

Generate unique pin names.

--unique-footprints

Generate a new shape for each footprint instance (do not reuse shapes).

--use-drill-origin

Use drill/place file origin as origin.

--store-origin-coord

Save the origin coordinates in the file.

PCB Gerber 导出:每个文件一层

pcb export gerbers 命令将电路板设计导出到 Gerber 文件,每个文件一层。

请注意有两种不同的 Gerber 导出命令,即 gerbergerbersgerber 命令将多个 PCB 层绘制到单个 Gerber 文件中,而 gerbers 命令将多个 Gerber 文件绘制到单个 Gerber 文件中。在制作 PCB 时,通常应使用 gerbers 命令。

Usage: kicad-cli pcb export gerbers [--help] [--output OUTPUT_FILE] [--layers LAYER_LIST] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--exclude-refdes] [--exclude-value] [--include-border-title] [--no-x2] [--no-netlist] [--subtract-soldermask] [--disable-aperture-macros] [--use-drill-file-origin] [--precision PRECISION] [--no-protel-ext] [--plot-invisible-text] [--common-layers COMMON_LAYER_LIST] [--board-plot-params] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the Gerber export command.

-o <output dir>, --output <output dir>

The output folder for the exported files. When this argument is not used, the files are exported to the current directory.

-l <layer list>, --layers <layer list>

A comma-separated list of layer names to plot from the board, such as F.Cu,B.Cu. If this argument is not used, all layers will be plotted.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the board file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

--erd, --exclude-refdes

Exclude footprint reference designators from plot.

--ev, --exclude-value

Exclude footprint values from plot.

--ibt, --include-border-title

Include the sheet border and title block.

--no-x2

Do not use the extended X2 format.

--no-netlist

Do not include netlist attributes.

--subtract-soldermask

Remove silkscreen from areas without soldermask.

--disable-aperture-macros

Disable aperture macros.

--use-drill-file-origin

Use drill/place file origin instead of absolute origin.

--precision <precision>

The precision (number of digits) for the Gerber files. Valid options are 5 or 6 (default).

--no-protel-ext

Use .gbr file extension instead of Protel file extensions (.gbl, .gtl, etc.).

--plot-invisible-text

Force plotting of values and references, even if they are invisible.

--cl <layer list>, --common-layers <layer list>

A comma-separated list of layer names to plot on all layers, such as F.Cu,B.Cu.

--board-plot-params

Use the Gerber plot settings already configured in the board file.

导出 PCB Gerber:每个文件可导出多个层

pcb export gerber 命令将一个或多个板层导出到单个 Gerber 文件。

请注意有两种不同的 Gerber 导出命令,即 gerbergerbersgerber 命令将多个 PCB 层绘制到单个 Gerber 文件中,而 gerbers 命令将多个 Gerber 文件绘制到单个 Gerber 文件中。在制作 PCB 时,通常应使用 gerbers 命令。
the pcb export gerber command is deprecated in KiCad 9.0 and will be removed in KiCad 10.0. Please use the pcb export gerbers command instead.

Usage: kicad-cli pcb export gerber [--help] [--output OUTPUT_FILE] [--layers LAYER_LIST] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--exclude-refdes] [--exclude-value] [--include-border-title] [--no-x2] [--no-netlist] [--subtract-soldermask] [--disable-aperture-macros] [--use-drill-file-origin] [--precision PRECISION] [--no-protel-ext] [--plot-invisible-text] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the Gerber export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .gbr file extension.

-l <layer list>, --layers <layer list>

A comma-separated list of layer names to plot from the board, such as F.Cu,B.Cu. All layers will be plotted in the output file. At least one layer must be given.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the board file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

--erd, --exclude-refdes

Exclude footprint reference designators from plot.

--ev, --exclude-value

Exclude footprint values from plot.

--ibt, --include-border-title

Include the sheet border and title block.

--no-x2

Do not use the extended X2 format.

--no-netlist

Do not include netlist attributes.

--subtract-soldermask

Remove silkscreen from areas without soldermask.

--disable-aperture-macros

Disable aperture macros.

--use-drill-file-origin

Use drill/place file origin instead of absolute origin.

--precision <precision>

The precision (number of digits) for the Gerber files. Valid options are 5 or 6 (default).

--no-protel-ext

Use .gbr file extension instead of Protel file extensions (.gbl, .gtl, etc.).

--plot-invisible-text

Force plotting of values and references, even if they are invisible.

PCB GLB 导出

The pcb export glb command exports a board design to a GLB (binary glTF) 3D model file.

Usage: kicad-cli pcb export glb [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--force] [--no-unspecified] [--no-dnp] [--grid-origin] [--drill-origin] [--subst-models] [--board-only] [--cut-vias-in-body] [--no-board-body] [--no-components] [--component-filter VAR] [--include-tracks] [--include-pads] [--include-zones] [--include-inner-copper] [--include-silkscreen] [--include-soldermask] [--fuse-shapes] [--fill-all-vias] [--min-distance MIN_DIST] [--net-filter VAR] [--user-origin VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the GLB export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .glb file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --force

Overwrite output file.

--no-unspecified

Exclude 3D models of components with 'unspecified' footprint type.

--no-dnp

Exclude 3D models of components with 'Do not populate' attribute.

--grid-origin

Use grid origin as origin of output file.

--drill-origin

Use drill origin as origin of output file.

--subst-models

Replace VRML models in footprints with STEP or IGS models of the same name, if they exist.

--board-only

Only include the board itself in the generated model; exclude all component models.

--cut-vias-in-body

Cut via holes in board body even if conductor layers are not exported.

--no-board-body

Exclude board body.

--no-components

Exclude 3D models for components.

--component-filter <reference designator list>

Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported)

--include-tracks

Include tracks and vias on outer conductor layers in export (time consuming).

--include-pads

Include pads in export (time consuming).

--include-zones

Include zones in export (time consuming).

--include-inner-copper

Include elements on inner conductor layers in export.

--include-silkscreen

Include silkscreen graphics in export as a set of flat faces.

--include-soldermask

Include solder mask layers in export as a set of flat faces.

--fuse-shapes

Fuse overlapping geometry together in export (time consuming).

--fill-all-vias

Don’t cut via holes in conductor layers.

--min-distance <min distance>

Tolerance for considering two points to be in the same location. Default: 0.01mm.

--net-filter <net filter>

Only include copper items belonging to nets matching this wildcard.

--user-origin <output origin>

Specify a custom origin for the output file, with X and Y coordinates. For example, 1x1in, 1x1inch, or 25.4x25.4mm. The default unit is millimeters.

PCB IPC-2581 导出

pcb export ipc2581 命令以 IPC-2581 格式导出电路板设计。

用法: kicad-cli pcb export ipc2581 [--help] [--output OUTPUT_FILE] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--precision PRECISION] [--compress] [--version VAR] [--units VAR] [--bom-col-int-id FIELD_NAME] [--bom-col-mfg-pn FIELD_NAME] [--bom-col-mfg FIELD_NAME] [--bom-col-dist-pn FIELD_NAME] [--bom-col-dist FIELD_NAME] INPUT_FILE

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the IPC-2581 export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .xml file extension.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the board file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

--precision <precision>

The precision (number of digits after the decimal separator) for the exported file. The default is 6.

--compress

Compress output file as a ZIP file.

--version <IPC-2581 standard version>

IPC-2581 standard version to use. Options are B or C (default).

--units

Units to use in export. Options are mm (default) or in.

--bom-col-int-id

Name of the part field to use for the Bill of Materials Internal ID column. This can be any footprint field, or blank to omit this column.

--bom-col-mfg-pn

Name of the part field to use for the Bill of Materials Manufacturer Part Number column. This can be any footprint field, or blank to omit this column.

--bom-col-mfg

Name of the part field to use for the Bill of Materials Manufacturer column. This can be any footprint field, or blank to omit this column.

--bom-col-dist-pn

Name of the part field to use for the Bill of Materials Distributor Part Number column. This can be any footprint field, or blank to omit this column.

--bom-col-dist

Name of the part field to use for the Bill of Materials Distributor column. This can be any footprint field, or blank to omit this column.

PCB ODB++ export

The pcb export odb command exports a board design in ODB++ format.

Usage: kicad-cli pcb export odb [--help] [--output OUTPUT_FILE] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--precision PRECISION] [--compression VAR] [--units VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the ODB++ export command.

-o <output filename>, --output <output filename>

The output filename, or folder name if no compression is used.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the board file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

--precision <precision>

The precision (number of digits after the decimal separator) for the exported file. The default is 2.

--compression <mode>

Compression mode. Options are none, zip (default), or tgz.

--units <unit>

Units to use in the output file. Options are mm (default) or in.

PCB PDF 导出

The pcb export pdf command exports a board design to a PDF file. Each layer can be plotted as its own file or as a sheet within a single file.

Usage: kicad-cli pcb export pdf [--help] [--output OUTPUT_FILE] [--layers LAYER_LIST] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--mirror] [--exclude-refdes] [--exclude-value] [--include-border-title] [--sketch-pads-on-fab-layers] [--hide-DNP-footprints-on-fab-layers] [--sketch-DNP-footprints-on-fab-layers] [--crossout-DNP-footprints-on-fab-layers] [--negative] [--black-and-white] [--theme THEME_NAME] [--drill-shape-opt VAR] [--common-layers COMMON_LAYER_LIST] [--plot-invisible-text] [--mode-single] [--mode-separate] [--mode-multipage] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the PDF export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .pdf file extension.

-l <layer list>, --layers <layer list>

A comma-separated list of layer names to export from the board, such as F.Cu,B.Cu. At least one layer must be given.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the board file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-m, --mirror

Mirror the board. This can be useful for showing bottom layers.

--erd, --exclude-refdes

Exclude footprint reference designators from plot.

--ev, --exclude-value

Exclude footprint values from plot.

--ibt, --include-border-title

Include the sheet border and title block.

--sp, --sketch-pads-on-fab-layers

Draw pad outlines and their numbers on front and back fab layers.

--hdnp, --hide-DNP-footprints-on-fab-layers

Don’t plot text and graphics of DNP footprints on fab layers.

--sdnp, --sketch-DNP-footprints-on-fab-layers

Plot graphics of DNP footprints in sketch mode on fab layers.

--cdnp, --crossout-DNP-footprints-on-fab-layers

Plot an 'X' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators.

-n, --negative

Plot in negative.

--black-and-white

Plot in black and white.

-t <theme name>, --theme <theme name>

The name of the theme to use for export. If no theme is given, the board editor’s currently selected theme is used.

--drill-shape-opt

The shape of drill marks in the plot. Options are 0 for no drill marks, 1 for small marks, or 2 for actual size marks (default).

--cl <layer list>, --common-layers <layer list>

A comma-separated list of layer names to plot on all layers, such as F.Cu,B.Cu.

--plot-invisible-text

Force plotting of values and references, even if they are invisible.

--mode-single

Generates a single file with the output arg path acting as the complete directory and filename path. COMMON_LAYER_LIST does not function in this mode. Instead LAYER_LIST controls all layers plotted.

--mode-separate

Plot the layers to individual PDF files.

--mode-multipage

Plot the layers to a single PDF file with multiple pages.

PCB PLY file export

The pcb export ply command exports a board design to a PLY 3D model file.

Usage: kicad-cli pcb export ply [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--force] [--no-unspecified] [--no-dnp] [--grid-origin] [--drill-origin] [--subst-models] [--board-only] [--cut-vias-in-body] [--no-board-body] [--no-components] [--component-filter VAR] [--include-tracks] [--include-pads] [--include-zones] [--include-inner-copper] [--include-silkscreen] [--include-soldermask] [--fuse-shapes] [--fill-all-vias] [--min-distance MIN_DIST] [--net-filter VAR] [--user-origin VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the PLY export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .ply file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --force

Overwrite output file.

--no-unspecified

Exclude 3D models of components with 'unspecified' footprint type.

--no-dnp

Exclude 3D models of components with 'Do not populate' attribute.

--grid-origin

Use grid origin as origin of output file.

--drill-origin

Use drill origin as origin of output file.

--subst-models

Replace VRML models in footprints with STEP or IGS models of the same name, if they exist.

--board-only

Only include the board itself in the generated model; exclude all component models.

--cut-vias-in-body

Cut via holes in board body even if conductor layers are not exported.

--no-board-body

Exclude board body.

--no-components

Exclude 3D models for components.

--component-filter <reference designator list>

Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported)

--include-tracks

Include tracks and vias on outer conductor layers in export (time consuming).

--include-pads

Include pads in export (time consuming).

--include-zones

Include zones in export (time consuming).

--include-inner-copper

Include elements on inner conductor layers in export.

--include-silkscreen

Include silkscreen graphics in export as a set of flat faces.

--include-soldermask

Include solder mask layers in export as a set of flat faces.

--fuse-shapes

Fuse overlapping geometry together in export (time consuming).

--fill-all-vias

Don’t cut via holes in conductor layers.

--min-distance <min distance>

Tolerance for considering two points to be in the same location. Default: 0.01mm.

--net-filter <net filter>

Only include copper items belonging to nets matching this wildcard.

--user-origin <output origin>

Specify a custom origin for the output file, with X and Y coordinates. For example, 1x1in, 1x1inch, or 25.4x25.4mm. The default unit is millimeters.

PCB 位置文件导出

pcb export pos 命令从电路板设计中导出位置文件。

用法: kicad-cli pcb export pos [--help] [--output OUTPUT_FILE] [--side VAR] [--format FORMAT] [--units UNITS] [--bottom-negate-x] [--use-drill-file-origin] [--smd-only] [--exclude-fp-th] [--exclude-dnp] [--gerber-board-edge] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

显示位置文件导出命令的帮助信息。

-o <output filename>, --output <output filename>

设置输出文件名。如果不使用此参数,输出文件名将与输入文件相同,但后缀为 .pos

--side <side>

指定要导出的电路板面。选项有 front(正面)、back(背面)或 both(双面,默认)。Gerber 格式不支持 both 选项。

--format <format>

位置文件的格式。选项有 ascii(默认)、csvgerber

--units <unit>

位置文件中的单位。选项有 in(英寸,默认)或 mm(毫米)。此选项对 Gerber 格式无效。

--bottom-negate-x

对底层的元件封装使用负 X 坐标。此选项对 Gerber 格式无效。

--use-drill-file-origin

使用钻孔/放置文件的原点而非绝对原点。此选项对 Gerber 格式无效。

--smd-only

只包含表面贴装技术 (SMT) 元件。此选项对 Gerber 格式无效。

--exclude-fp-th

排除所有带有通孔焊盘的封装。此选项对 Gerber 格式无效。

--exclude-dnp

排除所有具有 “不安装” (DNP) 属性的封装。

--gerber-board-edge

导出时包含电路板边缘层(仅限 Gerber 格式)。

PCB STEP 导出

pcb export step 命令将电路板设计导出为 STEP 文件。

Usage: kicad-cli pcb export step [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--force] [--no-unspecified] [--no-dnp] [--grid-origin] [--drill-origin] [--subst-models] [--board-only] [--cut-vias-in-body] [--no-board-body] [--no-components] [--component-filter VAR] [--include-tracks] [--include-pads] [--include-zones] [--include-inner-copper] [--include-silkscreen] [--include-soldermask] [--fuse-shapes] [--fill-all-vias] [--min-distance MIN_DIST] [--net-filter VAR] [--no-optimize-step] [--user-origin VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the STEP file export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .step file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --force

Overwrite output file.

--no-unspecified

Exclude 3D models of components with 'unspecified' footprint type.

--no-dnp

Exclude 3D models of components with 'Do not populate' attribute.

--grid-origin

Use grid origin as origin of output file.

--drill-origin

Use drill origin as origin of output file.

--subst-models

Replace VRML models in footprints with STEP or IGS models of the same name, if they exist.

--board-only

Only include the board itself in the generated model; exclude all component models.

--cut-vias-in-body

Cut via holes in board body even if conductor layers are not exported.

--no-board-body

Exclude board body.

--no-components

Exclude 3D models for components.

--component-filter <reference designator list>

Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported)

--include-tracks

Include tracks and vias on outer conductor layers in export (time consuming).

--include-pads

Include pads in export (time consuming).

--include-zones

Include zones in export (time consuming).

--include-inner-copper

Include elements on inner conductor layers in export.

--include-silkscreen

Include silkscreen graphics in export as a set of flat faces.

--include-soldermask

Include solder mask layers in export as a set of flat faces.

--fuse-shapes

Fuse overlapping geometry together in export (time consuming).

--fill-all-vias

Don’t cut via holes in conductor layers.

--min-distance <min distance>

Tolerance for considering two points to be in the same location. Default: 0.01mm.

--net-filter <net filter>

Only include copper items belonging to nets matching this wildcard.

--no-optimize-step

Do not optimize STEP file. This enables writing parametric curves, which reduces file sizes and write/read times, but may reduce compatibility with other software.

--user-origin <output origin>

Specify a custom origin for the output file, with X and Y coordinates. For example, 1x1in, 1x1inch, or 25.4x25.4mm. The default unit is millimeters.

PCB STL export

The pcb export stl command exports a board design to an STL 3D model file.

Usage: kicad-cli pcb export stl [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--force] [--no-unspecified] [--no-dnp] [--grid-origin] [--drill-origin] [--subst-models] [--board-only] [--cut-vias-in-body] [--no-board-body] [--no-components] [--component-filter VAR] [--include-tracks] [--include-pads] [--include-zones] [--include-inner-copper] [--include-silkscreen] [--include-soldermask] [--fuse-shapes] [--fill-all-vias] [--min-distance MIN_DIST] [--net-filter VAR] [--user-origin VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the STL export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .stl file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --force

Overwrite output file.

--no-unspecified

Exclude 3D models of components with 'unspecified' footprint type.

--no-dnp

Exclude 3D models of components with 'Do not populate' attribute.

--grid-origin

Use grid origin as origin of output file.

--drill-origin

Use drill origin as origin of output file.

--subst-models

Replace VRML models in footprints with STEP or IGS models of the same name, if they exist.

--board-only

Only include the board itself in the generated model; exclude all component models.

--cut-vias-in-body

Cut via holes in board body even if conductor layers are not exported.

--no-board-body

Exclude board body.

--no-components

Exclude 3D models for components.

--component-filter <reference designator list>

Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported)

--include-tracks

Include tracks and vias on outer conductor layers in export (time consuming).

--include-pads

Include pads in export (time consuming).

--include-zones

Include zones in export (time consuming).

--include-inner-copper

Include elements on inner conductor layers in export.

--include-silkscreen

Include silkscreen graphics in export as a set of flat faces.

--include-soldermask

Include solder mask layers in export as a set of flat faces.

--fuse-shapes

Fuse overlapping geometry together in export (time consuming).

--fill-all-vias

Don’t cut via holes in conductor layers.

--min-distance <min distance>

Tolerance for considering two points to be in the same location. Default: 0.01mm.

--net-filter <net filter>

Only include copper items belonging to nets matching this wildcard.

--user-origin <output origin>

Specify a custom origin for the output file, with X and Y coordinates. For example, 1x1in, 1x1inch, or 25.4x25.4mm. The default unit is millimeters.

PCB SVG 导出

pcb export svg 命令将电路板设计导出为 SVG 文件。

Usage: kicad-cli pcb export svg [--help] [--output OUTPUT_FILE] [--layers LAYER_LIST] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--mirror] [--theme THEME_NAME] [--negative] [--black-and-white] [--sketch-pads-on-fab-layers] [--hide-DNP-footprints-on-fab-layers] [--sketch-DNP-footprints-on-fab-layers] [--crossout-DNP-footprints-on-fab-layers] [--page-size-mode MODE] [--exclude-drawing-sheet] [--drill-shape-opt SHAPE_OPTION] [--common-layers COMMON_LAYER_LIST] [--mode-single] [--mode-multi] [--plot-invisible-text] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the SVG file export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .svg file extension.

-l <layer list>, --layers <layer list>

A comma-separated list of layer names to export from the board, such as F.Cu,B.Cu. At least one layer must be given.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the board file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-m, --mirror

Mirror the board. This can be useful for showing bottom layers.

-t <theme name>, --theme <theme name>

The name of the theme to use for export. If no theme is given, the board editor’s currently selected theme is used.

-n, --negative

Plot in negative.

--black-and-white

Plot in black and white.

--sp, --sketch-pads-on-fab-layers

Draw pad outlines and their numbers on front and back fab layers.

--hdnp, --hide-DNP-footprints-on-fab-layers

Don’t plot text and graphics of DNP footprints on fab layers.

--sdnp, --sketch-DNP-footprints-on-fab-layers

Plot graphics of DNP footprints in sketch mode on fab layers.

--cdnp, --crossout-DNP-footprints-on-fab-layers

Plot an 'X' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators.

--page-size-mode <mode>

Set page sizing mode. Options are 0 (default), 1, or 2. 0 sets the output page size to fit the entire sheet, including drawing sheet frame and title block. 1 sets the output page size to match the current page size. 2 sets the output page size to the size of the board itself.

--exclude-drawing-sheet

Plot SVG without a drawing sheet.

--drill-shape-opt

The shape of drill marks in the plot. Options are 0 for no drill marks, 1 for small marks, or 2 for actual size marks (default).

--cl <layer list>, --common-layers <layer list>

A comma-separated list of layer names to plot on all layers, such as F.Cu,B.Cu.

--mode-single

Generates a single file with the output arg path acting as the complete directory and filename path. COMMON_LAYER_LIST does not function in this mode. Instead LAYER_LIST controls all layers plotted.

--mode-multi

Generates one or more files with behavior similar to the KiCad GUI plotting. The given output path specifies a directory in which files may be output.

--plot-invisible-text

Force plotting of values and references, even if they are invisible.

PCB VRML 导出

The pcb export vrml command exports a board design to a VRML 3D model file.

Usage: kicad-cli pcb export vrml [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--force] [--no-unspecified] [--no-dnp] [--user-origin VAR] [--units VAR] [--models-dir VAR] [--models-relative] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the VRML export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .wrl file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --force

Overwrite output file.

--no-unspecified

Exclude 3D models of components with 'unspecified' footprint type.

--no-dnp

Exclude 3D models of components with 'Do not populate' attribute.

--user-origin <output origin>

Specify a custom origin for the output file, with X and Y coordinates. For example, 1x1in, 1x1inch, or 25.4x25.4mm. The default unit is millimeters. If this option is not given, the board center is used.

--units <units>

Units to use in the output file. Options are mm, m, in (default), or tenths (tenths of an inch).

--models-dir <output model directory>

Name of output directory to copy component models into. If not used, component models are embedded into the output file.

--models-relative

With --models-dir, use relative paths in the output file.

PCB XAO export

The pcb export xao command exports a board design to an XAO (SALOME/Gmsh) 3D model file.

Usage: kicad-cli pcb export xao [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--force] [--no-unspecified] [--no-dnp] [--grid-origin] [--drill-origin] [--subst-models] [--board-only] [--cut-vias-in-body] [--no-board-body] [--no-components] [--component-filter VAR] [--include-tracks] [--include-pads] [--include-zones] [--include-inner-copper] [--include-silkscreen] [--include-soldermask] [--fuse-shapes] [--fill-all-vias] [--min-distance MIN_DIST] [--net-filter VAR] [--user-origin VAR] INPUT_FILE

位置参数:

INPUT_FILE

要导出的电路板文件。

可选参数:

-h, --help

Show help for the XAO export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with the .xao file extension.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-f, --force

Overwrite output file.

--no-unspecified

Exclude 3D models of components with 'unspecified' footprint type.

--no-dnp

Exclude 3D models of components with 'Do not populate' attribute.

--grid-origin

Use grid origin as origin of output file.

--drill-origin

Use drill origin as origin of output file.

--subst-models

Replace VRML models in footprints with STEP or IGS models of the same name, if they exist.

--board-only

Only include the board itself in the generated model; exclude all component models.

--cut-vias-in-body

Cut via holes in board body even if conductor layers are not exported.

--no-board-body

Exclude board body.

--no-components

Exclude 3D models for components.

--component-filter <reference designator list>

Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported)

--include-tracks

Include tracks and vias on outer conductor layers in export (time consuming).

--include-pads

Include pads in export (time consuming).

--include-zones

Include zones in export (time consuming).

--include-inner-copper

Include elements on inner conductor layers in export.

--include-silkscreen

Include silkscreen graphics in export as a set of flat faces.

--include-soldermask

Include solder mask layers in export as a set of flat faces.

--fuse-shapes

Fuse overlapping geometry together in export (time consuming).

--fill-all-vias

Don’t cut via holes in conductor layers.

--min-distance <min distance>

Tolerance for considering two points to be in the same location. Default: 0.01mm.

--net-filter <net filter>

Only include copper items belonging to nets matching this wildcard.

--user-origin <output origin>

Specify a custom origin for the output file, with X and Y coordinates. For example, 1x1in, 1x1inch, or 25.4x25.4mm. The default unit is millimeters.

PCB render

The pcb render command generates a raytraced rendering of the 3D model of the board and saves it to a PNG or JPEG file.

Usage: kicad-cli pcb render [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--width WIDTH] [--height HEIGHT] [--side SIDE] [--background BG] [--quality QUALITY] [--preset PRESET] [--floor] [--perspective] [--zoom ZOOM] [--pan VECTOR] [--pivot PIVOT] [--rotate ANGLES] [--light-top COLOR] [--light-bottom COLOR] [--light-side COLOR] [--light-camera COLOR] [--light-side-elevation ANGLE] INPUT_FILE

位置参数:

INPUT_FILE

Board file to render.

可选参数:

-h, --help

Show help for the render command.

-o <output filename>, --output <output filename>

The output filename. This argument must be given. The file extension given in this argument determines the output image file format. The filename must end with either .png (for PNG files) or .jpg/.jpeg (for JPG files).

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-w <width>, --width <width>

Image width in pixels. Default: 1600.

-h <height>, --height <height>

Image height in pixels. Default: 900.

--side <side>

The side of the board to render. Options are top (default), bottom, left, right, front, or back.

--background <background>

Image background. Options are default (default), transparent, or opaque. For PNG files, default is transparent. For JPG files, default is opaque.

--quality <quality>

Render quality. Options are basic (default), high, user. When user is specified, the render settings stored in the project are used.

--preset <color preset>

Color preset. Options are follow_pcb_editor, follow_plot_settings (default), or legacy_preset_flag.

--floor

Enables floor, shadows and post-processing, even if disabled in quality preset.

--perspective

Use perspective projection instead of orthogonal.

--zoom <zoom level>

Camera zoom factor as an integer. Default: 1.

--pan <camera pan>

Set camera pan location, in millimeters, with the format 'X,Y,Z', e.g. '3,0,0'.

--pivot <pivot>

Set pivot point relative to the board center in centimeters, with the format 'X,Y,Z' e.g. '-10,2,0'.

--rotate <rotation>

Set board rotation around pivot point, in degrees, with the format 'X,Y,Z', e.g. '-45,0,45' for isometric view.

--light-top <intensity>

Top light intensity, format ’R,G,B'' or a single number, range: 0-1.

--light-bottom <intensity>

Bottom light intensity, format ’R,G,B'' or a single number, range: 0-1.

--light-side <intensity>

Side lights intensity, format ’R,G,B'' or a single number, range: 0-1.

--light-camera <intensity>

Camera light intensity, format ’R,G,B'' or a single number, range: 0-1.

--light-side-elevation <elevation>

Side lights elevation angle in degrees, range: 0-90.

原理图命令

sch 命令用于运行电气规则检查,将原理图导出为其他各种文件格式,或导出物料清单或网表。每个子命令都有自己的选项。

原理图 ERC

sch erc 命令对原理图运行电气规则检查并生成报告。

用法: kicad-cli sch erc [--help] [--output OUTPUT_FILE] [--define-var KEY=VALUE] [--format VAR] [--units VAR] [--severity-all] [--severity-error] [--severity-warning] [--severity-exclusions] [--exit-code-violations] INPUT_FILE

位置参数:

INPUT_FILE

运行 ERC 的原理图文件。

可选参数:

-h, --help

显示 ERC 命令的帮助信息。

-o <output filename>, `--output <output filename>

生成的 ERC 报告的输出文件名。如果不使用此参数,输出文件名将与输入文件相同,后缀为 .rpt.json,具体取决于所选的格式。

-D <variable name>=<value>, --define-var <variable_name>=<value>

添加或覆盖工程变量定义。可以多次使用以定义多个变量。

--format <format>

报告文件格式。选项有 report(默认)或 json

--units <unit>

报告中使用的单位。选项有 mm(默认)、inmils

--severity-all

报告所有 ERC 违规。这相当于使用所有其他 ERC 严重性选项。

--severity-error

报告所有错误级别的 ERC 违规。可以与其他 ERC 严重性选项组合使用。

--severity-warning

报告所有警告级别的 ERC 违规。可以与其他 ERC 严重性选项组合使用。

--severity-exclusions

报告所有被排除的 ERC 违规。可以与其他 ERC 严重性选项组合使用。

--exit-code-violations

根据是否存在 ERC 违规返回退出代码。如果未发现违规,则退出代码为 0;如果找到任何违规,则退出代码为 5

原理图物料清单导出

sch export bom 命令从原理图中导出 BOM。 BOM 导出具有许多用于控制格式和包含字段的选项。此导出方法等同于 导出 BOM 从符号字段表。

要使用旧版 XML 和 Python BOM 脚本工作流导出 BOM,请使用 sch export python-bom 命令。

Usage: kicad-cli sch export bom [--help] [--output OUTPUT_FILE] [--preset PRESET] [--format-preset FMT_PRESET] [--fields FIELDS] [--labels LABELS] [--group-by GROUP_BY] [--sort-field SORT_BY] [--sort-asc] [--filter FILTER] [--exclude-dnp] [--include-excluded-from-bom] [--field-delimiter FIELD_DELIM] [--string-delimiter STR_DELIM] [--ref-delimiter REF_DELIM] [--ref-range-delimiter REF_RANGE_DELIM] [--keep-tabs] [--keep-line-breaks] INPUT_FILE

位置参数:

INPUT_FILE

要导出的原理图文件。

可选参数:

-h, --help

Shows help message and exits

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with a .csv file extension.

--preset <preset>

Use a named BOM preset setting from the schematic, e.g. "Grouped By Value".

--format-preset <format preset>

Use a named BOM format preset setting from the schematic, e.g. CSV.

--fields <fields>

An ordered list of fields to export. * includes all fields. Special symbol fields such as DNP or Exclude from board can be accessed with ${DNP} or ${EXCLUDE_FROM_BOARD}, respectively (see the text variable documentation for a list of fields). Default: "Reference,Value,Footprint,${QUANTITY},${DNP}".

--labels <labels>

An ordered list of labels to apply the exported fields (default: "Refs,Value,Footprint,Qty,DNP").

--group-by <fields>

Fields to group references by when field values match.

--sort-field <fields>

Field name to sort by (default: "Reference").

--sort-asc

If given, sort in ascending order. If not given, sort in descending order.

--filter <filter>

Filter string to remove output lines.

--exclude-dnp

Exclude symbols with the "Do not populate" attribute.

--include-excluded-from-bom

Include symbols marked 'Exclude from BOM'.

--field-delimiter <delimiter>

Separator between output fields/columns (default: ",").

--string-delimiter <delimiter>

Character to surround fields with (none by default).

--ref-delimiter <delimiter>

Character to place between individual references (default: ",").

--ref-range-delimiter <delimiter>

Character to place in ranges of references (default: "-"). Leave blank for no ranges.

--keep-tabs

Keep tab characters from input fields. Stripped by default.

--keep-line-breaks

Keep line break characters from input fields. Stripped by default.

原理图 DXF 导出

sch export dxf 命令将原理图导出到 DXF 文件。设计中的每个图纸都导出到其自己的文件中。

Usage: kicad-cli sch export dxf [--help] [--output OUTPUT_DIR] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--theme THEME_NAME] [--black-and-white] [--exclude-drawing-sheet] [--default-font VAR] [--pages PAGE_LIST] INPUT_FILE

位置参数:

INPUT_FILE

要导出的原理图文件。

可选参数:

-h, --help

Show help for the DXF file export command.

-o <output dir>, --output <output dir>

The output folder for the exported files. When this argument is not used, the files are exported to the current directory.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the schematic file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-t <theme name>, --theme <theme name>

The name of the theme to use for export. If no theme is given, the schematic editor’s currently selected theme is used.

-b, --black-and-white

Export schematic in black and white.

-e, --exclude-drawing-sheet

Plot DXF without a drawing sheet.

--default-font <font name>

Default font name. Default: "KiCad Font".

-p <page list>, --pages <page list>

Comma-separated list of pages to export. Blank or unspecified means all pages. To plot specific pages, give the root sheet as INPUT_FILE and specify the desired output pages with the --pages argument.

原理图 HPGL 导出

sch export hpgl 命令将原理图导出到笔式绘图仪的 HPGL 文件中。设计中的每个图纸都导出到其自己的文件中。

Usage: kicad-cli sch export hpgl [--help] [--output OUTPUT_DIR] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--exclude-drawing-sheet] [--default-font VAR] [--pages PAGE_LIST] [--pen-size PEN_SIZE] [--origin ORIGIN] INPUT_FILE

位置参数:

INPUT_FILE

要导出的原理图文件。

可选参数:

-h, --help

Show help for the HPGL file export command.

-o <output dir>, --output <output dir>

The output folder for the exported files. When this argument is not used, the files are exported to the current directory.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the schematic file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-e, --exclude-drawing-sheet

Plot HPGL without a drawing sheet.

--default-font <font name>

Default font name. Default: "KiCad Font".

--pages <page list>

Comma-separated list of pages to export. Blank or unspecified means all pages. To plot specific pages, give the root sheet as INPUT_FILE and specify the desired output pages with the --pages argument.

-p <pen size>, --pen-size <pen size>

Set the pen width. The default pen size is 0.5 mm.

-r <origin>, --origin <origin>

Set plotter origin and scale. Options are 0, 1 (default), 2, or 3. 0 sets the origin to the bottom left and uses plotter units. 1 sets the origin to the center and uses plotter units. 2 scales to the page, and 3 scales to the content within the page.

原理图网表导出

sch export netlist 命令以 各种格式 格式导出网表。

用法: kicad-cli sch export netlist [--help] [--output OUTPUT_FILE] [--format FORMAT] INPUT_FILE

位置参数:

INPUT_FILE

要导出的原理图文件。

可选参数:

-h, --help

Show help for the netlist export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with a .net file extension.

-f <format>, --format <format>

The netlist output format. Options are kicadsexpr (default), kicadxml, cadstar, orcadpcb2, spice, spicemodel, pads, or allegro.

原理图 PDF 导出

sch export pdf 命令将原理图导出为 PDF 文件。设计中的每张图纸都会导出到 PDF 文件中的单独页面。

Usage: kicad-cli sch export pdf [--help] [--output OUTPUT_FILE] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--theme THEME_NAME] [--black-and-white] [--exclude-drawing-sheet] [--default-font VAR] [--exclude-pdf-property-popups] [--exclude-pdf-hierarchical-links] [--exclude-pdf-metadata] [--no-background-color] [--pages PAGE_LIST] INPUT_FILE

位置参数:

INPUT_FILE

要导出的原理图文件。

可选参数:

-h, --help

Show help for the PDF file export command.

-o <output filename>, --output <output filename>

The output filename. When this argument is not used, the output filename will be the same as the input file, with a .pdf file extension.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the schematic file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-t <theme name>, --theme <theme name>

The name of the theme to use for export. If no theme is given, the schematic editor’s currently selected theme is used.

-b, --black-and-white

Export schematic in black and white.

-e, --exclude-drawing-sheet

Plot PDF without a drawing sheet.

--default-font <font name>

Default font name. Default: "KiCad Font".

--exclude-pdf-property-popups

Do not generate property popups in PDF.

--exclude-pdf-hierarchical-links

Do not generate clickable links for hierarchical elements in PDF.

--exclude-pdf-metadata

Do not generate PDF metadata from AUTHOR and SUBJECT variables.

-n, --no-background-color

Export schematic without a background color, regardless of theme.

-p <page list>, --pages <page list>

Comma-separated list of pages to export. Blank or unspecified means all pages. To plot specific pages, give the root sheet as INPUT_FILE and specify the desired output pages with the --pages argument.

原理图 PostScript 导出

sch export ps 命令将原理图导出到 PostScript 文件。设计中的每个图纸都导出到其自己的文件中。

Usage: kicad-cli sch export ps [--help] [--output OUTPUT_DIR] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--theme THEME_NAME] [--black-and-white] [--exclude-drawing-sheet] [--default-font VAR] [--no-background-color] [--pages PAGE_LIST] INPUT_FILE

位置参数:

INPUT_DIR

要导出的原理图文件。

可选参数:

-h, --help

Show help for the PS file export command.

-o <output dir>, --output <output dir>

The output folder for the exported files. When this argument is not used, the files are exported to the current directory.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the schematic file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-t <theme name>, --theme <theme name>

The name of the theme to use for export. If no theme is given, the schematic editor’s currently selected theme is used.

-b, --black-and-white

Export schematic in black and white.

-e, --exclude-drawing-sheet

Plot PS without a drawing sheet.

--default-font <font name>

Default font name. Default: "KiCad Font".

-n, --no-background-color

Export schematic without a background color, regardless of theme.

-p <page list>, --pages <page list>

Comma-separated list of pages to export. Blank or unspecified means all pages. To plot specific pages, give the root sheet as INPUT_FILE and specify the desired output pages with the --pages argument.

原理图物料清单导出(旧版 BOM 脚本)

sch export python-bom 命令从原理图中导出XML BOM文件。 然后,可以使用自定义脚本或外部参照中描述的脚本之一将 XML BOM 文件处理为所需的 BOM 格式: 原理图 BOM 导出文档

用法: kicad-cli sch export python-bom [--help] [--output OUTPUT_FILE] INPUT_FILE

位置参数:

INPUT_FILE

要导出的原理图文件。

可选参数:

-h, --help

显示 BOM 导出命令的帮助信息。

-o <output filename>, --output <output filename>

指定输出文件的文件名。如果不使用此参数,输出文件名将默认与输入文件相同,仅在原文件名后添加 -bom.xml 后缀及文件扩展名。

原理图 SVG 导出

sch export svg 命令将原理图导出为 SVG 文件。设计中的每个图纸都导出到其自己的文件中。

Usage: kicad-cli sch export svg [--help] [--output OUTPUT_DIR] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--theme THEME_NAME] [--black-and-white] [--exclude-drawing-sheet] [--default-font VAR] [--no-background-color] [--pages PAGE_LIST] INPUT_FILE

位置参数:

INPUT_FILE

要导出的原理图文件。

可选参数:

-h, --help

Show help for the SVG file export command.

-o <output dir>, --output <output dir>

The output folder for the exported files. When this argument is not used, the files are exported to the current directory.

--drawing-sheet <sheet path>

Path to drawing sheet to use in plot, overriding the drawing sheet specified in the schematic file.

-D <variable name>=<value>, --define-var <variable_name>=<value>

Add or override project variable definitions. Can be used multiple times to define multiple variables.

-t <theme name>, --theme <theme name>

The name of the theme to use for export. If no theme is given, the schematic editor’s currently selected theme is used.

-b, --black-and-white

Export schematic in black and white.

-e, --exclude-drawing-sheet

Plot SVG without a drawing sheet.

--default-font <font name>

Default font name. Default: "KiCad Font".

-n, --no-background-color

Export schematic without a background color, regardless of theme.

-p <page list>, --pages <page list>

Comma-separated list of pages to export. Blank or unspecified means all pages. To plot specific pages, give the root sheet as INPUT_FILE and specify the desired output pages with the --pages argument.

符号命令

sym 子命令将符号导出为另一种格式,或将符号库升级到 KiCad 符号文件格式的当前版本。

符号导出

sym export svg 命令将指定库中的一个或多个符号导出到 SVG 文件中。

用法: kicad-cli sym export svg [--help] [--output OUTPUT_DIR] [--theme THEME_NAME] [--symbol SYMBOL] [--black-and-white] [--include-hidden-pins] [--include-hidden-fields] INPUT_FILE

位置参数:

INPUT_FILE

用于导出的符号库文件。

可选参数:

-h, --help

显示符号 SVG 导出命令的帮助信息。

-o <output dir>, --output <output dir>

设置导出文件的输出文件夹。如果未使用此参数,文件将被导出到当前目录。

-t <theme name>, --theme <theme name>

指定用于导出的主题名称。如果没有给出主题,则使用符号编辑器中当前选择的主题。

-s <symbol name>, --symbol <symbol name>

指定从库中导出的特定符号。如果未使用此参数,则会导出库中的所有符号。

--black-and-white

以黑白模式导出符号。

--include-hidden-pins

在导出的 SVG 中包含隐藏引脚。

--include-hidden-fields

在导出的 SVG 中包含隐藏的符号字段。

符号升级

The sym upgrade command converts the the specified symbol library from a legacy KiCad symbol format or a non-KiCad symbol format to the native format for the current version of KiCad. If the input library is already in the current file format, no action is taken.

Supported input symbol formats are:

  • KiCad symbol library (.kicad_sym)

  • KiCad (pre-6.0) symbol library (.lib)

  • Altium schematic library (.SchLib)

  • Altium integrated library (.IntLib)

  • CADSTAR parts library (.lib)

  • EAGLE XML library (.lbr)

  • EasyEDA (JLCEDA) Std file (.json)

  • EasyEDA (JLCEDA) Pro file (.elibz, .epro, .zip)

用法: kicad-cli sym upgrade [--help] [--output OUTPUT_FILE] [--force] INPUT_FILE

位置参数:

INPUT_FILE

要升级的符号库。

可选参数:

-h, --help

显示符号升级命令的帮助信息。.

-o <output filename>, --output <output filename>

指定升级后符号库的输出文件名。如果不使用此参数,升级后的符号库将覆盖原来的库文件。

--force

即使输入的库已经是当前文件格式,也强制重新保存库文件。

版本命令

The version command prints the KiCad version. Without any arguments, it simply prints the version number, for example 7.0.7. You can print the version in several other formats using the --format argument.

在 Gitlab 上提交错误报告或功能请求时,请使用 kicad-cli version --format about 获取要包含的版本信息。

用法: kicad-cli version [--help] [--format VAR]

可选参数:

--format <format>

版本号的格式。选项为 plain(默认)、commitaboutplain 打印版本号(例如 7.0.7),如果不使用 --format 参数,则为默认值。commit 打印您正在使用的 KiCad 构建的 git commit 的哈希值。about 打印完整版本信息,包括库版本和基本系统信息。您可以在 Bug 报告中使用 关于 版本信息。