4.3.2. Command open-project

This command opens a LibrePCB project and lets you execute some tasks with it.

Command

  1. $ ./librepcb-cli open-project --help

Output

  1. Usage: ./librepcb-cli [options] open-project [command_options] project
  2. LibrePCB Command Line Interface
  3. Options:
  4. -h, --help Displays this help.
  5. -v, --version Displays version information.
  6. --verbose Verbose output.
  7. --erc Run the electrical rule check, print all
  8. non-approved warnings/errors and report
  9. failure (exit code = 1) if there are
  10. non-approved messages.
  11. --export-schematics <file> Export schematics to given file(s).
  12. Existing files will be overwritten.
  13. Supported file extensions: pdf
  14. --export-bom <file> Export generic BOM to given file(s).
  15. Existing files will be overwritten.
  16. Supported file extensions: csv
  17. --export-board-bom <file> Export board-specific BOM to given
  18. file(s). Existing files will be
  19. overwritten. Supported file extensions: csv
  20. --bom-attributes <attributes> Comma-separated list of additional
  21. attributes to be exported to the BOM.
  22. Example: "MANUFACTURER, MPN"
  23. --export-pcb-fabrication-data Export PCB fabrication data
  24. (Gerber/Excellon) according the fabrication
  25. output settings of boards. Existing files
  26. will be overwritten.
  27. --pcb-fabrication-settings <file> Override PCB fabrication output settings
  28. by providing a *.lp file containing custom
  29. settings. If not set, the settings from the
  30. boards will be used instead.
  31. --board <name> The name of the board(s) to export. Can be
  32. given multiple times. If not set, all
  33. boards are exported.
  34. --save Save project before closing it (useful to
  35. upgrade file format).
  36. --strict Fail if the project files are not strictly
  37. canonical, i.e. there would be changes when
  38. saving the project. Note that this option
  39. is not available for *.lppz files.
  40. Arguments:
  41. open-project Open a project to execute project-related
  42. tasks.
  43. project Path to project file (*.lpp[z]).
Example: Check ERC Messages and Export Schematics & Boards

This command is useful for Continuous Integration of LibrePCB projects because it reports failure if you check in projects with non-approved ERC messages. In addition, it generates all production data so you don’t have to do it manually.

Command

  1. $ ./librepcb-cli open-project \
  2. --erc \
  3. --export-schematics="output/{{VERSION}}/{{PROJECT}}_Schematics.pdf" \
  4. --export-pcb-fabrication-data \
  5. MyProject.lpp

Output

  1. Open project 'MyProject.lpp'...
  2. Run ERC...
  3. Approved messages: 7
  4. Non-approved messages: 2
  5. - [WARNING] Net signal connected to less than two pins: "CAN_RX"
  6. - [WARNING] Net signal connected to less than two pins: "JTCK"
  7. Export schematics to 'output/{{VERSION}}/{{PROJECT}}_Schematics.pdf'...
  8. => 'output/v1/MyProject_Schematics.pdf'
  9. Export PCB fabrication data...
  10. Board 'default':
  11. => 'output/v1/gerber/MyProject_DRILLS-PTH.drl'
  12. => 'output/v1/gerber/MyProject_OUTLINES.gbr'
  13. => 'output/v1/gerber/MyProject_COPPER-TOP.gbr'
  14. => 'output/v1/gerber/MyProject_COPPER-BOTTOM.gbr'
  15. => 'output/v1/gerber/MyProject_SOLDERMASK-TOP.gbr'
  16. => 'output/v1/gerber/MyProject_SOLDERMASK-BOTTOM.gbr'
  17. => 'output/v1/gerber/MyProject_SILKSCREEN-TOP.gbr'
  18. => 'output/v1/gerber/MyProject_SILKSCREEN-BOTTOM.gbr'
  19. Finished with errors!

In this example, the application reported errors and exited with code 1 because there are non-approved ERC messages.