[PcbDraw] Added support to set the V-CUTS layer

This commit is contained in:
Salvador E. Tropea 2022-10-18 12:49:28 -03:00
parent ad2b4e48d1
commit 5887b29bf2
4 changed files with 13 additions and 5 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Image margin - Image margin
- Outline width - Outline width
- Solder paste removal - Solder paste removal
- V-CUTS layer
### Changed ### Changed
- Diff: - Diff:

View File

@ -2591,7 +2591,8 @@ Notes:
- `remap`: [dict|None] Replacements for PCB references using components (lib:component). - `remap`: [dict|None] Replacements for PCB references using components (lib:component).
- `show_solderpaste`: [boolean=true] Show the solder paste layers. - `show_solderpaste`: [boolean=true] Show the solder paste layers.
- `variant`: [string=''] Board variant to apply. - `variant`: [string=''] Board variant to apply.
- `vcuts`: [boolean=false] Render V-CUTS on the Cmts.User layer. - `vcuts`: [boolean=false] Render V-CUTS on the `vcuts_layer` layer.
- `vcuts_layer`: [string='Cmts.User'] Layer to render the V-CUTS, only used when `vcuts` is enabled.
- `warnings`: [string='visible'] [visible,all,none] Using visible only the warnings about components in the visible side are generated. - `warnings`: [string='visible'] [visible,all,none] Using visible only the warnings about components in the visible side are generated.
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
Categories looks like file system paths, i.e. PCB/fabrication/gerber. Categories looks like file system paths, i.e. PCB/fabrication/gerber.

View File

@ -1409,8 +1409,10 @@ outputs:
vcut: '#bf2600' vcut: '#bf2600'
# [string=''] Board variant to apply # [string=''] Board variant to apply
variant: '' variant: ''
# [boolean=false] Render V-CUTS on the Cmts.User layer # [boolean=false] Render V-CUTS on the `vcuts_layer` layer
vcuts: false vcuts: false
# [string='Cmts.User'] Layer to render the V-CUTS, only used when `vcuts` is enabled
vcuts_layer: 'Cmts.User'
# [string='visible'] [visible,all,none] Using visible only the warnings about components in the visible side are generated # [string='visible'] [visible,all,none] Using visible only the warnings about components in the visible side are generated
warnings: 'visible' warnings: 'visible'
# PDF (Portable Document Format): # PDF (Portable Document Format):

View File

@ -20,6 +20,7 @@ from .error import KiPlotConfigurationError
from .misc import (PCBDRAW_ERR, W_AMBLIST, PCB_MAT_COLORS, PCB_FINISH_COLORS, SOLDER_COLORS, SILK_COLORS, from .misc import (PCBDRAW_ERR, W_AMBLIST, PCB_MAT_COLORS, PCB_FINISH_COLORS, SOLDER_COLORS, SILK_COLORS,
W_PCBDRAW) W_PCBDRAW)
from .gs import GS from .gs import GS
from .layer import Layer
from .optionable import Optionable from .optionable import Optionable
from .out_base import VariantOptions from .out_base import VariantOptions
from .macros import macros, document, output_class # noqa: F401 from .macros import macros, document, output_class # noqa: F401
@ -152,7 +153,9 @@ class PcbDrawOptions(VariantOptions):
""" *[list(string)|string=none] [none,all] List of components to draw, can be also a string for none or all. """ *[list(string)|string=none] [none,all] List of components to draw, can be also a string for none or all.
The default is none. IMPORTANT! This option is relevant only when no filters or variants are applied """ The default is none. IMPORTANT! This option is relevant only when no filters or variants are applied """
self.vcuts = False self.vcuts = False
""" Render V-CUTS on the Cmts.User layer """ """ Render V-CUTS on the `vcuts_layer` layer """
self.vcuts_layer = 'Cmts.User'
""" Layer to render the V-CUTS, only used when `vcuts` is enabled """
self.warnings = 'visible' self.warnings = 'visible'
""" [visible,all,none] Using visible only the warnings about components in the visible side are generated """ """ [visible,all,none] Using visible only the warnings about components in the visible side are generated """
self.dpi = 300 self.dpi = 300
@ -182,6 +185,8 @@ class PcbDrawOptions(VariantOptions):
self.libs = ['KiCAD-base'] self.libs = ['KiCAD-base']
else: else:
self.libs = ','.join(self.libs) self.libs = ','.join(self.libs)
# V-CUTS layer
self._vcuts_layer = Layer.solve(self.vcuts_layer)[0]._id
# Highlight # Highlight
if isinstance(self.highlight, type): if isinstance(self.highlight, type):
self.highlight = None self.highlight = None
@ -327,8 +332,7 @@ class PcbDrawOptions(VariantOptions):
if self.show_solderpaste: if self.show_solderpaste:
plotter.plot_plan.append(PlotPaste()) plotter.plot_plan.append(PlotPaste())
if self.vcuts: if self.vcuts:
# TODO: Make layer configurable plotter.plot_plan.append(PlotVCuts(layer=self._vcuts_layer))
plotter.plot_plan.append(PlotVCuts(layer=41))
# Two filtering mechanism: 1) Specified list and 2) KiBot filters and variants # Two filtering mechanism: 1) Specified list and 2) KiBot filters and variants
if self.show_components is not None or self._comps: if self.show_components is not None or self._comps:
plotter.plot_plan.append(self.build_plot_components()) plotter.plot_plan.append(self.build_plot_components())