This commit is contained in:
Salvador E. Tropea 2023-04-04 13:50:58 -03:00
commit 58417e428d
23 changed files with 386 additions and 55 deletions

View File

@ -27,9 +27,11 @@ on:
jobs:
test:
continue-on-error: true
strategy:
fail-fast: false
matrix:
ki_release: [latest, ki6, ki7]
ki_release: [ki5, ki6, ki7]
w_tests: [g1, g2, g3]
runs-on: ubuntu-latest
@ -136,17 +138,17 @@ jobs:
- name: Download coverage k5 g1
uses: actions/download-artifact@v3
with:
name: Test_Coverage_latest_g1
name: Test_Coverage_ki5_g1
- name: Download coverage k5 g2
uses: actions/download-artifact@v3
with:
name: Test_Coverage_latest_g2
name: Test_Coverage_ki5_g2
- name: Download coverage k5 g3
uses: actions/download-artifact@v3
with:
name: Test_Coverage_latest_g3
name: Test_Coverage_ki5_g3
- name: Download coverage k6 g1
uses: actions/download-artifact@v3

View File

@ -33,7 +33,7 @@ repos:
- id: mixed-line-ending
- id: check-builtin-literals
- id: check-merge-conflict
- id: check-docstring-first
# - id: check-docstring-first
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs

View File

@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.6.2] - UNRELEASED
### Added
- General:
- Support for time stamp in the date (i.e. 2023-04-02T09:22-03:00)
- Command line:
- `--banner N` Option to display a banner
- `--log FILE` Option to log to a file, in addition to the stderr
- Global options:
- `colored_tht_resistors` to disable the 3D colored resistors.
- `field_tolerance` field/s to look for resistor tolerance.
@ -24,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Currently just parsed, not rejected.
- PCB/SCH parity test:
- Check for value and fields/properties.
- SCH print:
- Support for title change
### Fixed
- Makefile: don't skip all preflights on each run, just the ones we generate
@ -36,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- PCB Print:
- Interference between the visible layers in the PRL file and the results
when scaling. (#407)
- Problems with images in the WKS (KiCad 5/6)
- Diff:
- Problems when using an output and no variant specified.
- PCB/SCH parity test:

View File

@ -1,6 +1,6 @@
FROM ghcr.io/inti-cmnb/kicad6_auto:1.6.0-1_k6.0.10_d11.6
FROM ghcr.io/inti-cmnb/kicad7_auto_full:latest
LABEL AUTHOR Salvador E. Tropea <stropea@inti.gob.ar>
LABEL Description="Export various files from KiCad projects (KiCad 6)"
LABEL Description="Export various files from KiCad projects (KiCad 7)"
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

View File

@ -80,7 +80,7 @@ test_docker_local_1:
# Run in the same directory to make the __pycache__ valid
# Also change the owner of the files to the current user (we run as root like in GitHub)
#docker run --rm -it -v $(CWD):$(CWD) --workdir="$(CWD)" setsoft/kicad_auto_test:latest '/bin/bash'
docker run --rm -v $(CWD):$(CWD) --workdir="$(CWD)" setsoft/kicad_auto_test:latest \
docker run --rm -v $(CWD):$(CWD) --workdir="$(CWD)" ghcr.io/inti-cmnb/kicad_auto_test:ki5 \
/bin/bash -c "flake8 . --count --statistics ; python3-coverage run -a src/kibot --help-outputs > /dev/null; pytest-3 --log-cli-level debug -k '$(SINGLE_TEST)' --test_dir=output ; $(PY_COV) html; chown -R $(USER_ID):$(GROUP_ID) output/ tests/board_samples/ tests/.config/kiplot/plugins/__pycache__/ tests/test_plot/fake_pcbnew/__pycache__/ tests/.config/kibot/plugins/__pycache__/ .coverage.* htmlcov/"
#$(PY_COV) report
#x-www-browser htmlcov/index.html

View File

@ -12,6 +12,7 @@
**Important for CI/CD**:
- The GitHub actions now use the full/test docker images. So now they include PanDoc and also Blender.
- If you are looking for the GitHub Actions documentation, and you already know how to use KiBot, or want a quick start, read: [GitHub Actions](#usage-of-github-actions)
**New on v1.6.1**
- KiCad 7.0.1 support
@ -2282,6 +2283,8 @@ Notes:
- `output`: [string='%f-%i%I%v.%x'] Filename for the output DXF (%i=schematic, %x=dxf). Affected by global options.
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.
- `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
If it starts with `+` the text is concatenated.
- `variant`: [string=''] Board variant to apply.
Not fitted components are crossed.
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
@ -2601,6 +2604,8 @@ Notes:
- `pen_size`: [number=0.4826] Pen size (diameter) [mm].
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.
- `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
If it starts with `+` the text is concatenated.
- `variant`: [string=''] Board variant to apply.
Not fitted components are crossed.
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
@ -3899,6 +3904,8 @@ Notes:
- `output`: [string='%f-%i%I%v.%x'] Filename for the output PDF (%i=schematic, %x=pdf). Affected by global options.
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.
- `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
If it starts with `+` the text is concatenated.
- `variant`: [string=''] Board variant to apply.
Not fitted components are crossed.
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
@ -4138,6 +4145,8 @@ Notes:
- `output`: [string='%f-%i%I%v.%x'] Filename for the output postscript (%i=schematic, %x=ps). Affected by global options.
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.
- `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
If it starts with `+` the text is concatenated.
- `variant`: [string=''] Board variant to apply.
Not fitted components are crossed.
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
@ -4686,6 +4695,8 @@ Notes:
- `output`: [string='%f-%i%I%v.%x'] Filename for the output SVG (%i=schematic, %x=svg). Affected by global options.
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.
- `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
If it starts with `+` the text is concatenated.
- `variant`: [string=''] Board variant to apply.
Not fitted components are crossed.
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
@ -5406,12 +5417,13 @@ KiBot: KiCad automation tool for documents generation
Usage:
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE] [-D]
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
[-E DEF] ... [-w LIST] [TARGET...]
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [-E DEF] ... --list
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [-t, --type TYPE]...
--quick-start
[-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
[-E DEF] ... [-w LIST] [--banner N] [TARGET...]
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
[-E DEF] ... --list
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N]
[-t, --type TYPE]... --quick-start
kibot [-v...] --help-filters
kibot [-v...] [--markdown|--json] --help-dependencies
kibot [-v...] --help-global-options
@ -5420,6 +5432,7 @@ Usage:
kibot [-v...] --help-outputs
kibot [-v...] --help-preflights
kibot [-v...] --help-variants
kibot [-v...] --help-banners
kibot -h | --help
kibot --version
@ -5429,6 +5442,7 @@ Arguments:
Options:
-A, --no-auto-download Disable dependencies auto-download
-b BOARD, --board-file BOARD The PCB .kicad-pcb board file
--banner N Display banner number N (-1 == random)
-c CONFIG, --plot-config CONFIG The plotting config file to use
-C, --cli-order Generate outputs using the indicated order
-d OUT_DIR, --out-dir OUT_DIR The output directory [default: .]
@ -5438,6 +5452,8 @@ Options:
-g DEF, --global-redef DEF Overwrite a global value (VAR=VAL)
-i, --invert-sel Generate the outputs not listed as targets
-l, --list List available outputs (in the config file)
-L, --log LOGFILE Log to LOGFILE using maximum debug level.
Is independent of what is logged to stderr
-m MKFILE, --makefile MKFILE Generate a Makefile (no targets created)
-n, --no-priority Don't sort targets by priority
-p, --copy-options Copy plot options from the PCB file
@ -5457,6 +5473,7 @@ Quick start options:
Help options:
-h, --help Show this help message and exit
--help-banners Show all available banners
--help-dependencies List dependencies in human readable format
--help-filters List supported filters and details
--help-global-options List supported global variables
@ -5534,7 +5551,9 @@ For more information about the docker images visit [kicad_debian](https://github
### Usage of GitHub Actions
Note: You can also use --quick-start functionality with GitHub actions, and example is this [workflow](https://github.com/INTI-CMNB/kibot_variants_arduprog/blob/master/.github/workflows/kibot_action_quick_start.yml)
Note: You can also use --quick-start functionality with GitHub actions, an example is this
[workflow](https://github.com/INTI-CMNB/kibot_variants_arduprog/blob/master/.github/workflows/kibot_action_quick_start.yml).
This is the fastest way to test KiBot functionality.
You need to put a [config.kibot.yaml](#configuration) file into the KiCad project folder.
@ -6117,3 +6136,4 @@ This case is [discussed here](docs/1_SCH_2_part_PCBs)
- **Battery charger example**: [RB0002-BatteryPack](https://cadlab.io/project/22740/master/files)
- **IT-1187A 3D Model**: Anton Pavlov ([GrabCad](https://grabcad.com/anton.pavlov-2))
- **105017-0001 3D Model**: M.B.I. ([GrabCad](https://grabcad.com/m.b.i-1))
- **ASCII Art generated**: [patorjk](https://patorjk.com/)

View File

@ -1,5 +1,5 @@
name: 'KiBot GitHub action'
description: 'auto generate documentatio, fabrication, etc. files for any KiCad project.'
description: 'automatically generates documentation, fabrication, etc. files for any KiCad project.'
author: 'Salvador E. Tropea'
inputs:
config:

View File

@ -11,6 +11,7 @@
**Important for CI/CD**:
- The GitHub actions now use the full/test docker images. So now they include PanDoc and also Blender.
- If you are looking for the GitHub Actions documentation, and you already know how to use KiBot, or want a quick start, read: [GitHub Actions](#usage-of-github-actions)
**New on v1.6.1**
- KiCad 7.0.1 support
@ -1613,7 +1614,9 @@ For more information about the docker images visit [kicad_debian](https://github
### Usage of GitHub Actions
Note: You can also use --quick-start functionality with GitHub actions, and example is this [workflow](https://github.com/INTI-CMNB/kibot_variants_arduprog/blob/master/.github/workflows/kibot_action_quick_start.yml)
Note: You can also use --quick-start functionality with GitHub actions, an example is this
[workflow](https://github.com/INTI-CMNB/kibot_variants_arduprog/blob/master/.github/workflows/kibot_action_quick_start.yml).
This is the fastest way to test KiBot functionality.
You need to put a [config.kibot.yaml](#configuration) file into the KiCad project folder.
@ -2196,3 +2199,4 @@ This case is [discussed here](docs/1_SCH_2_part_PCBs)
- **Battery charger example**: [RB0002-BatteryPack](https://cadlab.io/project/22740/master/files)
- **IT-1187A 3D Model**: Anton Pavlov ([GrabCad](https://grabcad.com/anton.pavlov-2))
- **105017-0001 3D Model**: M.B.I. ([GrabCad](https://grabcad.com/m.b.i-1))
- **ASCII Art generated**: [patorjk](https://patorjk.com/)

99
docs/images/ascii_art.txt Normal file
View File

@ -0,0 +1,99 @@
KKKKKKKKK KKKKKKK iiii BBBBBBBBBBBBBBBBB tttt
K:::::::K K:::::K i::::i B::::::::::::::::B ttt:::t
K:::::::K K:::::K iiii B::::::BBBBBB:::::B t:::::t
K:::::::K K::::::K BB:::::B B:::::B t:::::t
KK::::::K K:::::KKKiiiiiii B::::B B:::::B ooooooooooo ttttttt:::::ttttttt
K:::::K K:::::K i:::::i B::::B B:::::B oo:::::::::::oo t:::::::::::::::::t
K::::::K:::::K i::::i B::::BBBBBB:::::B o:::::::::::::::ot:::::::::::::::::t
K:::::::::::K i::::i B:::::::::::::BB o:::::ooooo:::::otttttt:::::::tttttt
K:::::::::::K i::::i B::::BBBBBB:::::B o::::o o::::o t:::::t
K::::::K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t
K:::::K K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t
KK::::::K K:::::KKK i::::i B::::B B:::::Bo::::o o::::o t:::::t tttttt
K:::::::K K::::::Ki::::::iBB:::::BBBBBB::::::Bo:::::ooooo:::::o t::::::tttt:::::t
K:::::::K K:::::Ki::::::iB:::::::::::::::::B o:::::::::::::::o tt::::::::::::::t
K:::::::K K:::::Ki::::::iB::::::::::::::::B oo:::::::::::oo tt:::::::::::tt
KKKKKKKKK KKKKKKKiiiiiiiiBBBBBBBBBBBBBBBBB ooooooooooo ttttttttttt
'##:::'##:'####:'########:::'#######::'########:
##::'##::. ##:: ##.... ##:'##.... ##:... ##..::
##:'##:::: ##:: ##:::: ##: ##:::: ##:::: ##::::
#####::::: ##:: ########:: ##:::: ##:::: ##::::
##. ##:::: ##:: ##.... ##: ##:::: ##:::: ##::::
##:. ##::: ##:: ##:::: ##: ##:::: ##:::: ##::::
##::. ##:'####: ########::. #######::::: ##::::
..::::..::....::........::::.......::::::..:::::
8 8888 ,88' 8 8888 8 888888888o ,o888888o. 8888888 8888888888
8 8888 ,88' 8 8888 8 8888 `88. . 8888 `88. 8 8888
8 8888 ,88' 8 8888 8 8888 `88 ,8 8888 `8b 8 8888
8 8888 ,88' 8 8888 8 8888 ,88 88 8888 `8b 8 8888
8 8888 ,88' 8 8888 8 8888. ,88' 88 8888 88 8 8888
8 8888 88' 8 8888 8 8888888888 88 8888 88 8 8888
8 888888< 8 8888 8 8888 `88. 88 8888 ,8P 8 8888
8 8888 `Y8. 8 8888 8 8888 88 `8 8888 ,8P 8 8888
8 8888 `Y8. 8 8888 8 8888 ,88' ` 8888 ,88' 8 8888
8 8888 `Y8. 8 8888 8 888888888P `8888888P' 8 8888
888 d8P d8b 888888b. 888
888 d8P Y8P 888 "88b 888
888 d8P 888 .88P 888
888d88K 888 8888888K. .d88b. 888888
8888888b 888 888 "Y88b d88""88b 888
888 Y88b 888 888 888 888 888 888
888 Y88b 888 888 d88P Y88..88P Y88b.
888 Y88b 888 8888888P" "Y88P" "Y888
,,
`7MMF' `YMM' db `7MM"""Yp, mm
MM .M' MM Yb MM
MM .d" `7MM MM dP ,pW"Wq.mmMMmm
MMMMM. MM MM"""bg. 6W' `Wb MM
MM VMA MM MM `Y 8M M8 MM
MM `MM. MM MM ,9 YA. ,A9 MM
.JMML. MMb..JMML..JMMmmmd9 `Ybmd9' `Mbmo
oooo oooo o8o oooooooooo. .
`888 .8P' `"' `888' `Y8b .o8
888 d8' oooo 888 888 .ooooo. .o888oo
88888[ `888 888oooo888' d88' `88b 888
888`88b. 888 888 `88b 888 888 888
888 `88b. 888 888 .88P 888 888 888 .
o888o o888o o888o o888bood8P' `Y8bod8P' "888"
,ggg, gg ,ggggggggggg,
dP""Y8b dP dP"""88""""""Y8, I8
Yb, `88 d8' Yb, 88 `8b I8
`" 88 ,dP' gg `" 88 ,8P 88888888
88aaad8" "" 88aaaad8P" I8
88""""Yb, gg 88""""Y8ba ,ggggg, I8
88 "8b 88 88 `8b dP" "Y8ggg I8
88 `8i 88 88 ,8P i8' ,8I ,I8,
88 Yb,_,88,_ 88_____,d8',d8, ,d8' ,d88b,
88 Y88P""Y8 88888888P" P"Y8888P" 88P""Y88
.----------------. .----------------. .----------------. .----------------. .----------------.
| .--------------. | .--------------. | .--------------. | .--------------. | .--------------. |
| | ___ ____ | | | _____ | | | ______ | | | ____ | | | _________ | |
| | |_ ||_ _| | | | |_ _| | | | |_ _ \ | | | .' `. | | | | _ _ | | |
| | | |_/ / | | | | | | | | | |_) | | | | / .--. \ | | | |_/ | | \_| | |
| | | __'. | | | | | | | | | __'. | | | | | | | | | | | | | |
| | _| | \ \_ | | | _| |_ | | | _| |__) | | | | \ `--' / | | | _| |_ | |
| | |____||____| | | | |_____| | | | |_______/ | | | `.____.' | | | |_____| | |
| | | | | | | | | | | | | | | |
| '--------------' | '--------------' | '--------------' | '--------------' | '--------------' |
'----------------' '----------------' '----------------' '----------------' '----------------'

View File

@ -869,6 +869,9 @@ outputs:
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
# A short-cut to use for simple cases where a variant is an overkill
pre_transform: '_none'
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
# If it starts with `+` the text is concatenated
title: ''
# [string=''] Board variant to apply.
# Not fitted components are crossed
variant: ''
@ -1172,6 +1175,9 @@ outputs:
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
# A short-cut to use for simple cases where a variant is an overkill
pre_transform: '_none'
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
# If it starts with `+` the text is concatenated
title: ''
# [string=''] Board variant to apply.
# Not fitted components are crossed
variant: ''
@ -2602,6 +2608,9 @@ outputs:
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
# A short-cut to use for simple cases where a variant is an overkill
pre_transform: '_none'
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
# If it starts with `+` the text is concatenated
title: ''
# [string=''] Board variant to apply.
# Not fitted components are crossed
variant: ''
@ -2813,6 +2822,9 @@ outputs:
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
# A short-cut to use for simple cases where a variant is an overkill
pre_transform: '_none'
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
# If it starts with `+` the text is concatenated
title: ''
# [string=''] Board variant to apply.
# Not fitted components are crossed
variant: ''
@ -3333,6 +3345,9 @@ outputs:
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
# A short-cut to use for simple cases where a variant is an overkill
pre_transform: '_none'
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
# If it starts with `+` the text is concatenated
title: ''
# [string=''] Board variant to apply.
# Not fitted components are crossed
variant: ''

View File

@ -196,18 +196,31 @@ function main {
echo "*****************************************************************************************"
echo "*****************************************************************************************"
echo
echo "KKKKKKKKK KKKKKKK iiii BBBBBBBBBBBBBBBBB tttt"
echo "K:::::::K K:::::K i::::i B::::::::::::::::B ttt:::t"
echo "K:::::::K K:::::K iiii B::::::BBBBBB:::::B t:::::t"
echo "K:::::::K K::::::K BB:::::B B:::::B t:::::t"
echo "KK::::::K K:::::KKKiiiiiii B::::B B:::::B ooooooooooo ttttttt:::::ttttttt"
echo " K:::::K K:::::K i:::::i B::::B B:::::B oo:::::::::::oo t:::::::::::::::::t"
echo " K::::::K:::::K i::::i B::::BBBBBB:::::B o:::::::::::::::ot:::::::::::::::::t"
echo " K:::::::::::K i::::i B:::::::::::::BB o:::::ooooo:::::otttttt:::::::tttttt"
echo " K:::::::::::K i::::i B::::BBBBBB:::::B o::::o o::::o t:::::t"
echo " K::::::K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t"
echo " K:::::K K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t"
echo "KK::::::K K:::::KKK i::::i B::::B B:::::Bo::::o o::::o t:::::t tttttt"
echo "K:::::::K K::::::Ki::::::iBB:::::BBBBBB::::::Bo:::::ooooo:::::o t::::::tttt:::::t"
echo "K:::::::K K:::::Ki::::::iB:::::::::::::::::B o:::::::::::::::o tt::::::::::::::t"
echo "K:::::::K K:::::Ki::::::iB::::::::::::::::B oo:::::::::::oo tt:::::::::::tt"
echo "KKKKKKKKK KKKKKKKiiiiiiiiBBBBBBBBBBBBBBBBB ooooooooooo ttttttttttt"
echo
echo KiBot GitHub Action v2
echo 🤖 KiBot GitHub Action v2 🚀
echo
echo
kibot --version
dpkg -l kicad | grep kicad
kibot --version | awk '{ print $1 ": " $2 }'
echo KiCad: `dpkg --robot -l kicad | grep kicad | awk '{print $3}'`
echo Debian: `cat /etc/debian_version`
pcbnew_do --version
kicost --version
pcbdraw --version
echo "iBoM:" `INTERACTIVE_HTML_BOM_NO_DISPLAY=True generate_interactive_bom.py --version 2> /dev/null | grep "^v"`
echo
pcbnew_do --version | awk 'BEGIN{ done=0 } { if (done == 0) { print "KiAuto: " $2; done=1 } }'
kicost --version | tr -d 'v'
echo "iBoM:" `INTERACTIVE_HTML_BOM_NO_DISPLAY=True generate_interactive_bom.py --version 2> /dev/null | grep "^v" | tr -d 'v'`
echo
echo "*****************************************************************************************"
echo "*****************************************************************************************"

View File

@ -9,12 +9,13 @@
Usage:
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE] [-D]
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
[-E DEF] ... [-w LIST] [TARGET...]
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [-E DEF] ... --list
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [-t, --type TYPE]...
--quick-start
[-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
[-E DEF] ... [-w LIST] [--banner N] [TARGET...]
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
[-E DEF] ... --list
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N]
[-t, --type TYPE]... --quick-start
kibot [-v...] --help-filters
kibot [-v...] [--markdown|--json] --help-dependencies
kibot [-v...] --help-global-options
@ -23,6 +24,7 @@ Usage:
kibot [-v...] --help-outputs
kibot [-v...] --help-preflights
kibot [-v...] --help-variants
kibot [-v...] --help-banners
kibot -h | --help
kibot --version
@ -32,6 +34,7 @@ Arguments:
Options:
-A, --no-auto-download Disable dependencies auto-download
-b BOARD, --board-file BOARD The PCB .kicad-pcb board file
--banner N Display banner number N (-1 == random)
-c CONFIG, --plot-config CONFIG The plotting config file to use
-C, --cli-order Generate outputs using the indicated order
-d OUT_DIR, --out-dir OUT_DIR The output directory [default: .]
@ -41,6 +44,8 @@ Options:
-g DEF, --global-redef DEF Overwrite a global value (VAR=VAL)
-i, --invert-sel Generate the outputs not listed as targets
-l, --list List available outputs (in the config file)
-L, --log LOGFILE Log to LOGFILE using maximum debug level.
Is independent of what is logged to stderr
-m MKFILE, --makefile MKFILE Generate a Makefile (no targets created)
-n, --no-priority Don't sort targets by priority
-p, --copy-options Copy plot options from the PCB file
@ -60,6 +65,7 @@ Quick start options:
Help options:
-h, --help Show this help message and exit
--help-banners Show all available banners
--help-dependencies List dependencies in human readable format
--help-filters List supported filters and details
--help-global-options List supported global variables
@ -70,6 +76,7 @@ Help options:
--help-variants List supported variants and details
"""
from datetime import datetime
from glob import glob
import gzip
import locale
@ -97,6 +104,7 @@ if os.environ.get('KIAUS_USE_NIGHTLY'): # pragma: no cover (nightly)
else:
os.environ['PYTHONPATH'] = pcbnew_path
nightly = True
from .banner import get_banner, BANNERS
from .gs import GS
from . import dep_downloader
from .misc import EXIT_BAD_ARGS, W_VARCFG, NO_PCBNEW_MODULE, W_NOKIVER, hide_stderr, TRY_INSTALL_CHECK, W_ONWIN
@ -307,7 +315,16 @@ def main():
# Set the specified verbosity
GS.debug_enabled = log.set_verbosity(logger, args.verbose, args.quiet)
log.debug_level = GS.debug_level = args.verbose
logger.debug('KiBot {} verbose level: {}'.format(__version__, args.verbose))
# We can log all the debug info to a separated file
if args.log:
if os.path.isfile(args.log):
os.remove(args.log)
else:
os.makedirs(os.path.dirname(os.path.abspath(args.log)), exist_ok=True)
log.set_file_log(args.log)
GS.debug_level = 10
# The log setup finished, this is our first log message
logger.debug('KiBot {} verbose level: {} started on {}'.format(__version__, args.verbose, datetime.now()))
apply_warning_filter(args)
# Now we have the debug level set we can check (and optionally inform) KiCad info
detect_kicad()
@ -330,6 +347,14 @@ def main():
# Load output and preflight plugins
load_actions()
if args.banner is not None:
try:
id = int(args.banner)
except ValueError:
logger.error('The banner option needs an integer ({})'.format(id))
sys.exit(EXIT_BAD_ARGS)
logger.info(get_banner(id))
if args.help_outputs or args.help_list_outputs:
print_outputs_help(details=args.help_outputs)
sys.exit(0)
@ -351,6 +376,11 @@ def main():
if args.help_dependencies:
print_dependencies(args.markdown, args.json)
sys.exit(0)
if args.help_banners:
for c, b in enumerate(BANNERS):
logger.info('Banner '+str(c))
logger.info(b)
sys.exit(0)
if args.example:
check_board_file(args.board_file)
if args.copy_options and not args.board_file:

112
kibot/banner.py Normal file
View File

@ -0,0 +1,112 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Salvador E. Tropea
# Copyright (c) 2023 Instituto Nacional de Tecnología Industrial
# License: AGPL-3.0
# Project: KiBot (formerly KiPlot)
# ASCII Art generated by https://patorjk.com/
""" Banners module """
import random
BANNERS = ("""
KKKKKKKKK KKKKKKK iiii BBBBBBBBBBBBBBBBB tttt
K:::::::K K:::::K i::::i B::::::::::::::::B ttt:::t
K:::::::K K:::::K iiii B::::::BBBBBB:::::B t:::::t
K:::::::K K::::::K BB:::::B B:::::B t:::::t
KK::::::K K:::::KKKiiiiiii B::::B B:::::B ooooooooooo ttttttt:::::ttttttt
K:::::K K:::::K i:::::i B::::B B:::::B oo:::::::::::oo t:::::::::::::::::t
K::::::K:::::K i::::i B::::BBBBBB:::::B o:::::::::::::::ot:::::::::::::::::t
K:::::::::::K i::::i B:::::::::::::BB o:::::ooooo:::::otttttt:::::::tttttt
K:::::::::::K i::::i B::::BBBBBB:::::B o::::o o::::o t:::::t
K::::::K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t
K:::::K K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t
KK::::::K K:::::KKK i::::i B::::B B:::::Bo::::o o::::o t:::::t tttttt
K:::::::K K::::::Ki::::::iBB:::::BBBBBB::::::Bo:::::ooooo:::::o t::::::tttt:::::t
K:::::::K K:::::Ki::::::iB:::::::::::::::::B o:::::::::::::::o tt::::::::::::::t
K:::::::K K:::::Ki::::::iB::::::::::::::::B oo:::::::::::oo tt:::::::::::tt
KKKKKKKKK KKKKKKKiiiiiiiiBBBBBBBBBBBBBBBBB ooooooooooo ttttttttttt
""",
"""
'##:::'##:'####:'########:::'#######::'########:
##::'##::. ##:: ##.... ##:'##.... ##:... ##..::
##:'##:::: ##:: ##:::: ##: ##:::: ##:::: ##::::
#####::::: ##:: ########:: ##:::: ##:::: ##::::
##. ##:::: ##:: ##.... ##: ##:::: ##:::: ##::::
##:. ##::: ##:: ##:::: ##: ##:::: ##:::: ##::::
##::. ##:'####: ########::. #######::::: ##::::
..::::..::....::........::::.......::::::..:::::
""", # noqa: E128
"""
8 8888 ,88' 8 8888 8 888888888o ,o888888o. 8888888 8888888888
8 8888 ,88' 8 8888 8 8888 `88. . 8888 `88. 8 8888
8 8888 ,88' 8 8888 8 8888 `88 ,8 8888 `8b 8 8888
8 8888 ,88' 8 8888 8 8888 ,88 88 8888 `8b 8 8888
8 8888 ,88' 8 8888 8 8888. ,88' 88 8888 88 8 8888
8 8888 88' 8 8888 8 8888888888 88 8888 88 8 8888
8 888888< 8 8888 8 8888 `88. 88 8888 ,8P 8 8888
8 8888 `Y8. 8 8888 8 8888 88 `8 8888 ,8P 8 8888
8 8888 `Y8. 8 8888 8 8888 ,88' ` 8888 ,88' 8 8888
8 8888 `Y8. 8 8888 8 888888888P `8888888P' 8 8888
""", # noqa: E128
'''
888 d8P d8b 888888b. 888
888 d8P Y8P 888 "88b 888
888 d8P 888 .88P 888
888d88K 888 8888888K. .d88b. 888888
8888888b 888 888 "Y88b d88""88b 888
888 Y88b 888 888 888 888 888 888
888 Y88b 888 888 d88P Y88..88P Y88b.
888 Y88b 888 8888888P" "Y88P" "Y888
''', # noqa: E128
"""
`7MMF' `YMM' db `7MM\"""Yp, mm
MM .M' MM Yb MM
MM .d" `7MM MM dP ,pW"Wq.mmMMmm
MMMMM. MM MM\"""bg. 6W' `Wb MM
MM VMA MM MM `Y 8M M8 MM
MM `MM. MM MM ,9 YA. ,A9 MM
.JMML. MMb..JMML..JMMmmmd9 `Ybmd9' `Mbmo
""", # noqa: E128
"""
oooo oooo o8o oooooooooo. .
`888 .8P' `"' `888' `Y8b .o8
888 d8' oooo 888 888 .ooooo. .o888oo
88888[ `888 888oooo888' d88' `88b 888
888`88b. 888 888 `88b 888 888 888
888 `88b. 888 888 .88P 888 888 888 .
o888o o888o o888o o888bood8P' `Y8bod8P' "888"
""", # noqa: E128
"""
,ggg, gg ,ggggggggggg,
dP""Y8b dP dP"\""88\"""\"""Y8, I8
Yb, `88 d8' Yb, 88 `8b I8
`" 88 ,dP' gg `" 88 ,8P 88888888
88aaad8" "" 88aaaad8P" I8
88"\"""Yb, gg 88"\"""Y8ba ,ggggg, I8
88 "8b 88 88 `8b dP" "Y8ggg I8
88 `8i 88 88 ,8P i8' ,8I ,I8,
88 Yb,_,88,_ 88_____,d8',d8, ,d8' ,d88b,
88 Y88P""Y8 88888888P" P"Y8888P" 88P""Y88
""", # noqa: E128
r"""
.----------------. .----------------. .----------------. .----------------. .----------------.
| .--------------. | .--------------. | .--------------. | .--------------. | .--------------. |
| | ___ ____ | | | _____ | | | ______ | | | ____ | | | _________ | |
| | |_ ||_ _| | | | |_ _| | | | |_ _ \ | | | .' `. | | | | _ _ | | |
| | | |_/ / | | | | | | | | | |_) | | | | / .--. \ | | | |_/ | | \_| | |
| | | __'. | | | | | | | | | __'. | | | | | | | | | | | | | |
| | _| | \ \_ | | | _| |_ | | | _| |__) | | | | \ `--' / | | | _| |_ | |
| | |____||____| | | | |_____| | | | |_______/ | | | `.____.' | | | |_____| | |
| | | | | | | | | | | | | | | |
| '--------------' | '--------------' | '--------------' | '--------------' | '--------------' |
'----------------' '----------------' '----------------' '----------------' '----------------'
""") # noqa: E128
def get_banner(id):
n = len(BANNERS)
if id < 0:
id = random.randint(0, n-1)
else:
id = id % n
return BANNERS[id]

View File

View File

@ -13,7 +13,7 @@ except ImportError:
class pcbnew(object):
IU_PER_MM = 1
IU_PER_MILS = 1
from datetime import datetime, date
from datetime import datetime
from sys import exit
from shutil import copy2
from .misc import EXIT_BAD_ARGS, W_DATEFORMAT, W_UNKVAR, WRONG_INSTALL
@ -248,7 +248,7 @@ class GS(object):
return datetime.fromtimestamp(os.path.getmtime(fname)).strftime(GS.global_date_time_format)
elif GS.global_time_reformat:
try:
dt = date.fromisoformat(d)
dt = datetime.fromisoformat(d)
except ValueError as e:
logger.warning(W_DATEFORMAT+"Trying to reformat {} time, but not in ISO format ({})".format(what, d))
logger.warning(W_DATEFORMAT+"Problem: {}".format(e))
@ -528,16 +528,21 @@ class GS(object):
@staticmethod
def iu_to_svg(values, svg_precision):
""" Converts 1 or more values from KiCad internal IUs to the units used for SVGs """
if not isinstance(values, tuple):
values = [values]
""" Converts 1 or more values from KiCad internal IUs to the units used for SVGs.
For tuples we assume the result is SVG coordinates, for 1 value a scale """
if GS.ki5:
return tuple(map(lambda x: int(round(x*KICAD5_SVG_SCALE)), values))
if isinstance(values, tuple):
return tuple(map(lambda x: int(round(x*KICAD5_SVG_SCALE)), values))
return values*KICAD5_SVG_SCALE
if GS.ki7:
return tuple(map(GS.to_mm, values))
if isinstance(values, tuple):
return tuple(map(GS.to_mm, values))
return GS.to_mm(values)
# KiCad 6
mult = 10.0 ** (svg_precision - 6)
return tuple(map(lambda x: int(round(x*mult)), values))
if isinstance(values, tuple):
return tuple(map(lambda x: int(round(x*mult)), values))
return values*mult
@staticmethod
def svg_round(val):

View File

@ -417,6 +417,7 @@ class WksBitmap(WksDrawing):
p.images.append(e)
def add_to_svg(e, svg, p, svg_precision):
# Note: we compute all in KiCad IUs, and then apply a scale for the SVG
s = e.data
w, h = unpack('>LL', s[16:24])
# For KiCad 300 dpi is 1:1 scale
@ -429,7 +430,7 @@ class WksBitmap(WksDrawing):
# KiCad 6 can adjust the precision
# The default is 6 and makes 1 KiCad unit == 1 SVG unit
# But this isn't supported by browsers (Chrome and Firefox)
scale = GS.iu_to_svg(1.0, svg_precision)[0]
scale = GS.iu_to_svg(1.0, svg_precision)
for _ in range(e.repeat):
img = ImageElement(io.BytesIO(s), w, h)
x = pos.x-round(w/2)

View File

@ -42,6 +42,9 @@ class Any_SCH_PrintOptions(VariantOptions):
""" Color theme used, this must exist in the KiCad config (KiCad 6) """
self.background_color = False
""" Use the background color from the `color_theme` (KiCad 6) """
self.title = ''
""" Text used to replace the sheet title. %VALUE expansions are allowed.
If it starts with `+` the text is concatenated """
super().__init__()
self.add_to_doc('variant', "Not fitted components are crossed")
self._expand_id = 'schematic'
@ -54,7 +57,9 @@ class Any_SCH_PrintOptions(VariantOptions):
def run(self, name):
super().run(name)
command = self.ensure_tool('KiAuto')
if self._comps:
if self.title:
self.set_title(self.title, sch=True)
if self._comps or self.title:
# Save it to a temporal dir
sch_dir = mkdtemp(prefix='tmp-kibot-'+self._expand_ext+'_sch_print-')
copy_project(sch_dir)
@ -81,3 +86,5 @@ class Any_SCH_PrintOptions(VariantOptions):
cmd.extend(['--hpgl_pen_size', str(self.pen_size)])
cmd.extend([sch_file, os.path.dirname(name)])
self.exec_with_retry(self.add_extra_options(cmd), self._exit_error)
if self.title:
self.restore_title(sch=True)

View File

@ -21,7 +21,11 @@ in-place = True
recursive = True
expand-star-imports = True
[check-docstring-first]
ignore: kibot/banner.py
[codespell]
skip=entrypoint.sh,kibot/banner.py
ignore-words-list=kibot,tht
quiet-level = 2

View File

@ -1,7 +1,8 @@
(kicad_wks (version 20210606) (generator pl_editor)
(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)
(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))
(rect (name "") (start 110 34) (end 2 2) (comment "rect around the title block") (option page1only))
(rect (name "") (start 110 34) (end 2 2) (option page1only) (comment "rect around the title block")
)
(rect (name "") (start 0 0 ltcorner) (end 0 0) (repeat 2) (incrx 2) (incry 2))
(line (name "") (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50))
(tbtext "1" (name "") (pos 25 1 ltcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50))
@ -13,25 +14,34 @@
(tbtext "A" (name "") (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50))
(tbtext "Date: ${ISSUE_DATE}" (name "") (pos 87 6.9))
(line (name "") (start 110 5.5) (end 2 5.5))
(tbtext "${KICAD_VERSION}" (name "") (pos 109 4.1) (comment "Kicad version"))
(tbtext "No KiCad version to make it reproducible\n" (name "") (pos 109 4.1) (comment "Kicad version")
)
(line (name "") (start 110 8.5) (end 2 8.5))
(tbtext "Rev: ${REVISION}" (name "") (pos 24 6.9) (font bold))
(tbtext "Size: ${PAPER}" (name "") (pos 109 6.9) (comment "Paper format name"))
(tbtext "Id: ${#}/${##}" (name "") (pos 24 4.1) (comment "Sheet id"))
(tbtext "Size: ${PAPER}" (name "") (pos 109 6.9) (comment "Paper format name")
)
(tbtext "Id: ${#}/${##}" (name "") (pos 24 4.1) (comment "Sheet id")
)
(line (name "") (start 110 12.5) (end 2 12.5))
(tbtext "Title: ${TITLE}" (name "") (pos 109 10.7) (font (size 2 2) bold))
(tbtext "File: ${FILENAME}" (name "") (pos 109 14.3))
(line (name "") (start 110 18.5) (end 2 18.5))
(tbtext "Sheet: ${SHEETNAME}" (name "") (pos 109 17))
(tbtext "${COMPANY}" (name "") (pos 109 20) (font bold) (comment "Company name") (option page1only))
(tbtext "${COMMENT1}" (name "") (pos 109 23) (comment "Comment 0") (option page1only))
(tbtext "${COMMENT2}" (name "") (pos 109 26) (comment "Comment 1") (option page1only))
(tbtext "${COMMENT3}" (name "") (pos 109 29) (comment "Comment 2") (option page1only))
(tbtext "${COMMENT4}" (name "") (pos 109 32) (comment "Comment 3") (option page1only))
(tbtext "${COMPANY}" (name "") (pos 109 20) (option page1only) (font bold) (comment "Company name")
)
(tbtext "${COMMENT1}" (name "") (pos 109 23) (option page1only) (comment "Comment 0")
)
(tbtext "${COMMENT2}" (name "") (pos 109 26) (option page1only) (comment "Comment 1")
)
(tbtext "${COMMENT3}" (name "") (pos 109 29) (option page1only) (comment "Comment 2")
)
(tbtext "${COMMENT4}" (name "") (pos 109 32) (option page1only) (comment "Comment 3")
)
(line (name "") (start 90 8.5) (end 90 5.5))
(line (name "") (start 26 8.5) (end 26 2))
(rect (name "") (start 157 34) (end 110 2) (comment "rect around the logo") (option page1only))
(polygon (name "") (pos 133.5002 11.5002) (linewidth 0.00254) (option page1only)
(rect (name "") (start 157 34) (end 110 2) (option page1only) (comment "rect around the logo")
)
(polygon (name "") (pos 133.5002 11.5002) (option page1only) (linewidth 0.00254)
(pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932) (xy 19.71802 5.92328)
(xy 19.69262 5.83946) (xy 19.66976 5.72262) (xy 19.65198 5.56006) (xy 19.63674 5.33908) (xy 19.6215 5.04952) (xy 19.61134 4.67614)
(xy 19.60372 4.20624) (xy 19.5961 3.62712) (xy 19.58848 2.92862) (xy 19.5834 2.09296) (xy 19.57832 1.11252) (xy 19.57578 0.27432)
@ -138,7 +148,7 @@
(xy 15.66418 0.127) (xy 16.06042 0.08382) (xy 16.48714 0.17018) (xy 16.68018 0.254) (xy 17.018 0.42672) (xy 17.018 2.23774)
(xy 17.018 4.04876) (xy 17.018 4.04876))
)
(bitmap (name "") (pos 131.5022 27.0072) (scale 0.75) (option page1only)
(bitmap (name "") (pos 131.5022 27.0072) (option page1only) (scale 0.75)
(pngdata
(data "89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 00 00 01 72 00 00 00 C8 08 06 00 00 00 F5 02 6A ")
(data "AE 00 00 00 04 73 42 49 54 08 08 08 08 7C 08 64 88 00 00 00 09 70 48 59 73 00 00 2B 5C 00 00 2B ")

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -128,6 +128,7 @@ def test_pcb_print_simple_1(test_dir):
ctx.run()
ctx.expect_out_file(prj+'-F_Cu_mono.png')
ctx.expect_out_file(prj+'-F_Cu_color.png')
ctx.compare_image(prj+'-F_Cu_color.png', height='100%')
ctx.expect_out_file(prj+'-assembly_page_01.eps')
ctx.expect_out_file(prj+'-assembly_page_01.svg')
ctx.expect_out_file(prj+'-assembly.ps')