Command "open-project"
This command opens a LibrePCB project and lets you execute some tasks with it.
Command
./librepcb-cli open-project --help
Output
Usage: ./librepcb-cli [options] open-project [command_options] project LibrePCB Command Line Interface Options: -h, --help Print this message. -V, --version Displays version information. -v, --verbose Verbose output. --erc Run the electrical rule check, print all non-approved warnings/errors and report failure (exit code = 1) if there are non-approved messages. --drc Run the design rule check, print all non-approved warnings/errors and report failure (exit code = 1) if there are non-approved messages. --drc-settings <file> Override DRC settings by providing a *.lp file containing custom settings. If not set, the settings from the boards will be used instead. --run-job <name> Run a particular output job. Can be given multiple times to run multiple jobs. --run-jobs Run all existing output jobs. --jobs <file> Override output jobs with a *.lp file containing custom jobs. If not set, the jobs from the project will be used instead. --outdir <path> Override the output base directory of jobs. If not set, the standard output directory from the project is used. --export-schematics <file> Export schematics to given file(s). Existing files will be overwritten. Supported file extensions: pdf, svg, bmp, cur, ico, jpeg, jpg, pbm, pgm, png, ppm, xbm, xpm --export-bom <file> Export generic BOM to given file(s). Existing files will be overwritten. Supported file extensions: csv --export-board-bom <file> Export board-specific BOM to given file(s). Existing files will be overwritten. Supported file extensions: csv --bom-attributes <attributes> Comma-separated list of additional attributes to be exported to the BOM. Example: "SUPPLIER, SKU" --export-pcb-fabrication-data Export PCB fabrication data (Gerber/Excellon) according the fabrication output settings of boards. Existing files will be overwritten. --pcb-fabrication-settings <file> Override PCB fabrication output settings by providing a *.lp file containing custom settings. If not set, the settings from the boards will be used instead. --export-pnp-top <file> Export pick&place file for automated assembly of the top board side. Existing files will be overwritten. Supported file extensions: csv, gbr --export-pnp-bottom <file> Export pick&place file for automated assembly of the bottom board side. Existing files will be overwritten. Supported file extensions: csv, gbr --export-netlist <file> Export netlist file for automated PCB testing. Existing files will be overwritten. Supported file extensions: d356 --board <name> The name of the board(s) to export. Can be given multiple times. If not set, all boards are exported. --board-index <index> Same as '--board', but allows to specify boards by index instead of by name. --remove-other-boards Remove all boards not specified with '--board[-index]' from the project before executing all the other actions. If '--board[-index]' is not passed, all boards will be removed. Pass '--save' to save the modified project to disk. --variant <name> The name of the assembly variant(s) to export. Can be given multiple times. If not set, all assembly variants are exported. --variant-index <index> Same as '--variant', but allows to specify assembly variants by index instead of by name. --set-default-variant <name> Move the specified assembly variant to the top before executing all the other actions. Pass '--save' to save the modified project to disk. --save Save project before closing it (useful to upgrade file format). --strict Fail if the project files are not strictly canonical, i.e. there would be changes when saving the project. Note that this option is not available for *.lppz files. Arguments: open-project Open a project to execute project-related tasks. project Path to project file (*.lpp[z]).
Examples
Run ERC, DRC and Output Jobs
This command is useful for Continuous Integration of LibrePCB projects because it reports failure if you check in projects with non-approved ERC or DRC messages. In addition, it generates all production data files of the configured output jobs so you don’t have to do it manually.
Command
./librepcb-cli open-project --erc --drc --run-jobs MyProject.lpp
Output
Open project 'MyProject.lpp'... Run ERC... Approved messages: 7 Non-approved messages: 2 - [WARNING] Net signal connected to less than two pins: "CAN_RX" - [WARNING] Net signal connected to less than two pins: "JTCK" Run DRC... Board 'default': Approved messages: 0 Non-approved messages: 5 - [ERROR] Clearance copper ↔ hole < 0.25 mm - [ERROR] Clearance copper ↔ hole < 0.25 mm - [ERROR] Clearance drill ↔ drill < 0.35 mm - [ERROR] Clearance plane ↔ board outline < 0.3 mm - [ERROR] Clearance plane ↔ board outline < 0.3 mm Run output job 'Schematic PDF'... => 'output/v1/MyProject_v1_Schematic.pdf' Run output job 'Gerber/Excellon'... => 'output/v1/gerber/MyProject_v1_DRILLS-NPTH.drl' => 'output/v1/gerber/MyProject_v1_DRILLS-PTH.drl' => 'output/v1/gerber/MyProject_v1_OUTLINES.gbr' => 'output/v1/gerber/MyProject_v1_COPPER-TOP.gbr' => 'output/v1/gerber/MyProject_v1_COPPER-BOTTOM.gbr' => 'output/v1/gerber/MyProject_v1_SOLDERMASK-TOP.gbr' => 'output/v1/gerber/MyProject_v1_SOLDERMASK-BOTTOM.gbr' => 'output/v1/gerber/MyProject_v1_SILKSCREEN-TOP.gbr' => 'output/v1/gerber/MyProject_v1_SILKSCREEN-BOTTOM.gbr' => 'output/v1/gerber/MyProject_v1_SOLDERPASTE-TOP.gbr' => 'output/v1/gerber/MyProject_v1_SOLDERPASTE-BOTTOM.gbr' Finished with errors!
In this example, the application reported errors and exited with code 1
because there are non-approved ERC/DRC messages.