Added global options to define the PCB details.

This commit is contained in:
Salvador E. Tropea 2022-01-14 13:42:04 -03:00
parent 8676f28f3a
commit 4bba7e9a9a
7 changed files with 86 additions and 30 deletions

View File

@ -58,6 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `--cli-order` option to generate outputs in arbitrary order. (#106)
- QR codes generation and update: symbols and footprints. (#93)
- Support for `--subst-models` option for KiCad 6's kicad2step. (#137)
- Added global options to define the PCB details (`pcb_material`,
`solder_mask_color`, `silk_screen_color` and `pcb_finish`)
### Changed
- Internal BoM: now components with different Tolerance, Voltage, Current

View File

@ -28,6 +28,7 @@
* [Default *variant* option](#default-variant-option)
* [Output directory option](#output-directory-option)
* [Date format option](#date-format-option)
* [PCB details options](#pcb-details-options)
* [Filtering KiBot warnings](#filtering-kibot-warnings)
* [Filters and variants](#filters-and-variants)
* [Supported filters](#supported-filters)
@ -325,6 +326,19 @@ The behavior of these patterns isn't fully defined in this case and the results
In all cases the format is the one used by the `strftime` POSIX function, for more information visit this [site](https://strftime.org/).
#### PCB details options
The following variables control the default colors and they are used for documentation purposes:
- `pcb_material` [FR4] PCB core material.
Currently known are FR1 to FR5
- `solder_mask_color` [green] Color for the solder mask.
Currently known are green, black, white, yellow, purple, blue and red.
- `silk_screen_color` [white] Color for the markings.
Currently known are black and white.
- `pcb_finish` [HAL] Finishing used to protect pads.
Currently known are None, HAL, HASL, ENIG and ImAg.
#### Filtering KiBot warnings
KiBot warnings are marked with `(Wn)` where *n* is the warning id.
@ -1434,15 +1448,15 @@ Next time you need this list just use an alias, like this:
The default is none.
- `style`: [string|dict] PCB style (colors). An internal name, the name of a JSON file or the style options.
* Valid keys:
- `board`: [string='#4ca06c'] color for the board without copper (covered by solder mask).
- `clad`: [string='#9c6b28'] color for the PCB core (not covered by solder mask).
- `copper`: [string='#417e5a'] color for the copper zones (covered by solder mask).
- `board`: [string='#208b47'] color for the board without copper (covered by solder mask).
- `clad`: [string='#cabb3e'] color for the PCB core (not covered by solder mask).
- `copper`: [string='#285e3a'] color for the copper zones (covered by solder mask).
- `highlight_on_top`: [boolean=false] highlight over the component (not under).
- `highlight_padding`: [number=1.5] [0,1000] how much the highlight extends around the component [mm].
- `highlight_style`: [string='stroke:none;fill:#ff0000;opacity:0.5;'] SVG code for the highlight style.
- `outline`: [string='#000000'] color for the outline.
- `pads`: [string='#b5ae30'] color for the exposed pads (metal finish).
- `silk`: [string='#f0f0f0'] color for the silk screen.
- `pads`: [string='#8b898c'] color for the exposed pads (metal finish).
- `silk`: [string='#d5dce4'] color for the silk screen.
- `vcut`: [string='#bf2600'] color for the V-CUTS.
- `variant`: [string=''] Board variant to apply.
- `vcuts`: [boolean=false] Render V-CUTS on the Cmts.User layer.
@ -1726,7 +1740,7 @@ Next time you need this list just use an alias, like this:
- `background1`: [string='#66667F'] First color for the background gradient.
- `background2`: [string='#CCCCE5'] Second color for the background gradient.
- `board`: [string='#332B16'] Color for the board without copper or solder mask.
- `copper`: [string='#B29C00'] Color for the copper.
- `copper`: [string='#8b898c'] Color for the copper.
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- `download`: [boolean=true] Downloads missing 3D models from KiCad git. Only applies to models in KISYS3DMOD.
@ -1742,8 +1756,8 @@ Next time you need this list just use an alias, like this:
- `orthographic`: [boolean=false] Enable the orthographic projection mode (top view looks flat).
- `output`: [string='%f-%i%v.%x'] Name for the generated image file (%i='3D_$VIEW' %x='png'). Affected by global options.
- `ray_tracing`: [boolean=false] Enable the ray tracing. Much better result, but slow, and you'll need to adjust `wait_rt`.
- `silk`: [string='#E5E5E5'] Color for the silk screen.
- `solder_mask`: [string='#143324'] Color for the solder mask.
- `silk`: [string='#d5dce4'] Color for the silk screen.
- `solder_mask`: [string='#208b47'] Color for the solder mask.
- `solder_paste`: [string='#808080'] Color for the solder paste.
- `variant`: [string=''] Board variant to apply.
- `view`: [string='top'] [top,bottom,front,rear,right,left,z,Z,y,Y,x,X] Point of view.

View File

@ -28,6 +28,7 @@
* [Default *variant* option](#default-variant-option)
* [Output directory option](#output-directory-option)
* [Date format option](#date-format-option)
* [PCB details options](#pcb-details-options)
* [Filtering KiBot warnings](#filtering-kibot-warnings)
* [Filters and variants](#filters-and-variants)
* [Supported filters](#supported-filters)
@ -260,6 +261,19 @@ The behavior of these patterns isn't fully defined in this case and the results
In all cases the format is the one used by the `strftime` POSIX function, for more information visit this [site](https://strftime.org/).
#### PCB details options
The following variables control the default colors and they are used for documentation purposes:
- `pcb_material` [FR4] PCB core material.
Currently known are FR1 to FR5
- `solder_mask_color` [green] Color for the solder mask.
Currently known are green, black, white, yellow, purple, blue and red.
- `silk_screen_color` [white] Color for the markings.
Currently known are black and white.
- `pcb_finish` [HAL] Finishing used to protect pads.
Currently known are None, HAL, HASL, ENIG and ImAg.
#### Filtering KiBot warnings
KiBot warnings are marked with `(Wn)` where *n* is the warning id.

View File

@ -889,12 +889,12 @@ outputs:
show_components: none
# [string|dict] PCB style (colors). An internal name, the name of a JSON file or the style options
style:
# [string='#4ca06c'] color for the board without copper (covered by solder mask)
board: '#4ca06c'
# [string='#9c6b28'] color for the PCB core (not covered by solder mask)
clad: '#9c6b28'
# [string='#417e5a'] color for the copper zones (covered by solder mask)
copper: '#417e5a'
# [string='#208b47'] color for the board without copper (covered by solder mask)
board: '#208b47'
# [string='#cabb3e'] color for the PCB core (not covered by solder mask)
clad: '#cabb3e'
# [string='#285e3a'] color for the copper zones (covered by solder mask)
copper: '#285e3a'
# [boolean=false] highlight over the component (not under)
highlight_on_top: false
# [number=1.5] [0,1000] how much the highlight extends around the component [mm]
@ -903,10 +903,10 @@ outputs:
highlight_style: 'stroke:none;fill:#ff0000;opacity:0.5;'
# [string='#000000'] color for the outline
outline: '#000000'
# [string='#b5ae30'] color for the exposed pads (metal finish)
pads: '#b5ae30'
# [string='#f0f0f0'] color for the silk screen
silk: '#f0f0f0'
# [string='#8b898c'] color for the exposed pads (metal finish)
pads: '#8b898c'
# [string='#d5dce4'] color for the silk screen
silk: '#d5dce4'
# [string='#bf2600'] color for the V-CUTS
vcut: '#bf2600'
# [string=''] Board variant to apply
@ -1182,8 +1182,8 @@ outputs:
background2: '#CCCCE5'
# [string='#332B16'] Color for the board without copper or solder mask
board: '#332B16'
# [string='#B29C00'] Color for the copper
copper: '#B29C00'
# [string='#8b898c'] Color for the copper
copper: '#8b898c'
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
# A short-cut to use for simple cases where a variant is an overkill
dnf_filter: '_none'
@ -1211,10 +1211,10 @@ outputs:
output: '%f-%i%v.%x'
# [boolean=false] Enable the ray tracing. Much better result, but slow, and you'll need to adjust `wait_rt`
ray_tracing: false
# [string='#E5E5E5'] Color for the silk screen
silk: '#E5E5E5'
# [string='#143324'] Color for the solder mask
solder_mask: '#143324'
# [string='#d5dce4'] Color for the silk screen
silk: '#d5dce4'
# [string='#208b47'] Color for the solder mask
solder_mask: '#208b47'
# [string='#808080'] Color for the solder paste
solder_paste: '#808080'
# [string=''] Board variant to apply

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 Salvador E. Tropea
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020-2022 Salvador E. Tropea
# Copyright (c) 2020-2022 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2018 John Beard
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
@ -384,6 +384,10 @@ class CfgYamlReader(object):
GS.global_time_format = GS.global_from_cli.get('time_format', None)
GS.global_kiauto_wait_start = GS.global_from_cli.get('kiauto_wait_start', None)
GS.global_kiauto_time_out_scale = GS.global_from_cli.get('kiauto_time_out_scale', None)
GS.global_pcb_material = GS.global_from_cli.get('pcb_material', None)
GS.global_solder_mask_color = GS.global_from_cli.get('solder_mask_color', None)
GS.global_silk_screen_color = GS.global_from_cli.get('silk_screen_color', None)
GS.global_pcb_finish = GS.global_from_cli.get('pcb_finish', None)
# List of outputs
version = None
globals_found = False

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 Salvador E. Tropea
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020-2022 Salvador E. Tropea
# Copyright (c) 2020-2022 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
import os
@ -39,6 +39,18 @@ class Globals(FiltersOptions):
self.time_reformat = True
""" Tries to reformat the PCB/SCH date using the `date_format`.
This assumes you let KiCad fill this value and hence the time is in ISO format (YY-MM-DD) """
self.pcb_material = 'FR4'
""" PCB core material. Currently used for documentation and to choose default colors.
Currently known are FR1 to FR5 """
self.solder_mask_color = 'green'
""" Color for the solder mask. Currently used for documentation and to choose default colors.
Currently known are green, black, white, yellow, purple, blue and red """
self.silk_screen_color = 'white'
""" Color for the markings. Currently used for documentation and to choose default colors.
Currently known are black and white """
self.pcb_finish = 'HAL'
""" Finishing used to protect pads. Currently used for documentation and to choose default colors.
Currently known are None, HAL, HASL, ENIG and ImAg """
self.set_doc('filters', " [list(dict)] KiBot warnings to be ignored ")
self._filter_what = 'KiBot warnings'
self._unkown_is_error = True
@ -68,6 +80,12 @@ class Globals(FiltersOptions):
logger.warning(W_MUSTBEINT+'kiauto_wait_start must be integer, truncating to '+str(GS.global_kiauto_wait_start))
GS.global_kiauto_time_out_scale = self.set_global(GS.global_kiauto_time_out_scale, self.kiauto_time_out_scale,
'kiauto_time_out_scale')
GS.global_pcb_material = self.set_global(GS.global_pcb_material, self.pcb_material, 'pcb_material')
GS.global_solder_mask_color = self.set_global(GS.global_solder_mask_color, self.solder_mask_color,
'solder_mask_color')
GS.global_silk_screen_color = self.set_global(GS.global_silk_screen_color, self.silk_screen_color,
'silk_screen_color')
GS.global_pcb_finish = self.set_global(GS.global_pcb_finish, self.pcb_finish, 'pcb_finish')
if not GS.out_dir_in_cmd_line and self.out_dir:
GS.out_dir = os.path.join(os.getcwd(), self.out_dir)
set_filters(self.unparsed)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 Salvador E. Tropea
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020-2022 Salvador E. Tropea
# Copyright (c) 2020-2022 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
import os
@ -86,6 +86,10 @@ class GS(object):
global_date_format = None
global_time_format = None
global_time_reformat = None
global_pcb_material = None
global_solder_mask_color = None
global_silk_screen_color = None
global_pcb_finish = None
test_boolean = True
@staticmethod