[PCB Print] Added option to configure the forced edge color.

Closes #281
This commit is contained in:
Salvador E. Tropea 2022-09-06 11:06:44 -03:00
parent 43aae8b0fe
commit 22d618a425
4 changed files with 15 additions and 4 deletions

View File

@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
KiCad bug [11562](https://gitlab.com/kicad/code/kicad/-/issues/11562)
- Internal BoM: KiCad 6 text variables expansion in the fields (#247)
- Compress: Option to store symlinks. (See #265)
- PCB Print: Option to configure the forced edge color. (#281)
### Fixed
- OAR computation (Report) (#225)

View File

@ -2227,6 +2227,7 @@ Notes:
- `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.
- `drill_marks`: [string='full'] [none,small,full] What to use to indicate the drill places, can be none, small or full (for real scale).
- `forced_edge_cuts_color`: [string=''] Color used for the `force_edge_cuts` option.
- `frame_plot_mechanism`: [string='internal'] [gui,internal,plot] Plotting the frame from Python is problematic.
This option selects a workaround strategy.
gui: uses KiCad GUI to do it. Is slow but you get the correct frame.

View File

@ -1090,6 +1090,8 @@ outputs:
drill_marks: 'full'
# [boolean=false] Add the `Edge.Cuts` to all the pages
force_edge_cuts: false
# [string=''] Color used for the `force_edge_cuts` option
forced_edge_cuts_color: ''
# [string='PDF'] [PDF,SVG,PNG,EPS,PS] Format for the output file/s.
# Note that for PS you need `ghostscript` which isn't part of the default docker images
format: 'PDF'

View File

@ -264,6 +264,8 @@ class PCB_PrintOptions(VariantOptions):
""" Store the temporal page and layer files in the output dir and don't delete them """
self.force_edge_cuts = False
""" *Add the `Edge.Cuts` to all the pages """
self.forced_edge_cuts_color = ''
""" Color used for the `force_edge_cuts` option """
self.scaling = 1.0
""" *Default scale factor (0 means autoscaling)"""
self.realistic_solder_mask = True
@ -303,6 +305,8 @@ class PCB_PrintOptions(VariantOptions):
self.validate_color(member)
else:
setattr(self, member, getattr(self._color_theme, color))
if self.forced_edge_cuts_color:
self.validate_color('forced_edge_cuts_color')
if self.frame_plot_mechanism == 'plot' and GS.ki5:
raise KiPlotConfigurationError("You can't use `plot` for `frame_plot_mechanism` with KiCad 5. It will crash.")
KiConf.init(GS.pcb_file)
@ -921,11 +925,14 @@ class PCB_PrintOptions(VariantOptions):
if self.force_edge_cuts:
edge_layer = LayerOptions.create_layer('Edge.Cuts')
edge_id = edge_layer._id
layer_id2color = self._color_theme.layer_id2color
if edge_id in layer_id2color:
edge_layer.color = layer_id2color[edge_id]
if self.forced_edge_cuts_color:
edge_layer.color = self.forced_edge_cuts_color
else:
edge_layer.color = "#000000"
layer_id2color = self._color_theme.layer_id2color
if edge_id in layer_id2color:
edge_layer.color = layer_id2color[edge_id]
else:
edge_layer.color = "#000000"
# Generate the output, page by page
pages = []
for n, p in enumerate(self.pages):