More options to customize the excellon output.

zeros_format, left_digits and right_digits options.
This commit is contained in:
Salvador E. Tropea 2021-01-13 15:32:08 -03:00
parent 0e2d7f7ba4
commit 3a78160638
2 changed files with 12 additions and 1 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for KICAD_CONFIG_HOME defined from inside KiCad.
- Now layers can be selected using the default KiCad names.
- More control over the name of the drill files.
- More options to customize the excellon output.
### Changed
- Now the default output name applies to the DRC and ERC report names.

View File

@ -7,6 +7,10 @@ from pcbnew import EXCELLON_WRITER
from .out_any_drill import AnyDrill
from .macros import macros, document, output_class # noqa: F401
ZF = { 'DECIMAL_FORMAT': EXCELLON_WRITER.DECIMAL_FORMAT,
'SUPPRESS_LEADING': EXCELLON_WRITER.SUPPRESS_LEADING,
'SUPPRESS_TRAILING': EXCELLON_WRITER.SUPPRESS_TRAILING,
'KEEP_ZEROS': EXCELLON_WRITER.KEEP_ZEROS }
class ExcellonOptions(AnyDrill):
def __init__(self):
@ -20,11 +24,17 @@ class ExcellonOptions(AnyDrill):
""" Use a minimal header in the file """
self.mirror_y_axis = False
""" Invert the Y axis """
self.zeros_format = 'DECIMAL_FORMAT'
""" [DECIMAL_FORMAT,SUPPRESS_LEADING,SUPPRESS_TRAILING,KEEP_ZEROS] How to handle the zeros """
self.left_digits = 0
""" number of digits for integer part of coordinates (0 is auto) """
self.right_digits = 0
""" number of digits for mantissa part of coordinates (0 is auto) """
def _configure_writer(self, board, offset):
drill_writer = EXCELLON_WRITER(board)
drill_writer.SetOptions(self.mirror_y_axis, self.minimal_header, offset, self.pth_and_npth_single_file)
drill_writer.SetFormat(self.metric_units, EXCELLON_WRITER.DECIMAL_FORMAT)
drill_writer.SetFormat(self.metric_units, ZF[self.zeros_format], self.left_digits, self.right_digits)
self._unified_output = self.pth_and_npth_single_file
return drill_writer, 'drl'