[Drill] Support for KiCad v7

- Point -> Vector
- Rect -> Box
This commit is contained in:
Salvador E. Tropea 2023-02-10 10:11:44 -03:00
parent 1c8042dd1e
commit 8ff1cba906
3 changed files with 16 additions and 6 deletions

View File

@ -256,6 +256,12 @@ class GS(object):
return title_block.GetComment4()
return ''
@staticmethod
def p2v_k7(point):
""" KiCad v7 changed various wxPoint args to VECTOR2I.
This helper changes the types accordingly """
return pcbnew.VECTOR2I(point) if GS.ki7 else point
@staticmethod
def get_modules():
if GS.ki6:
@ -485,6 +491,8 @@ class GS(object):
@staticmethod
def create_eda_rect(tlx, tly, brx, bry):
if GS.ki7:
return pcbnew.BOX2I(pcbnew.VECTOR2I(tlx, tly), pcbnew.VECTOR2I(brx-tlx, bry-tly))
return pcbnew.EDA_RECT(pcbnew.wxPoint(tlx, tly), pcbnew.wxSize(brx-tlx, bry-tly))
# @staticmethod

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 Salvador E. Tropea
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020-2023 Salvador E. Tropea
# Copyright (c) 2020-2023 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
from pcbnew import EXCELLON_WRITER
from .out_any_drill import AnyDrill
from .gs import GS
from .macros import macros, document, output_class # noqa: F401
ZF = {'DECIMAL_FORMAT': EXCELLON_WRITER.DECIMAL_FORMAT,
@ -37,7 +38,7 @@ class ExcellonOptions(AnyDrill):
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.SetOptions(self.mirror_y_axis, self.minimal_header, GS.p2v_k7(offset), self.pth_and_npth_single_file)
drill_writer.SetRouteModeForOvalHoles(self.route_mode_for_oval_holes)
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

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 Salvador E. Tropea
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020-2023 Salvador E. Tropea
# Copyright (c) 2020-2023 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
from pcbnew import GERBER_WRITER
from .gs import GS
from .out_any_drill import AnyDrill
from .macros import macros, document, output_class # noqa: F401
@ -17,7 +18,7 @@ class Gerb_DrillOptions(AnyDrill):
drill_writer = GERBER_WRITER(board)
# hard coded in UI?
drill_writer.SetFormat(5)
drill_writer.SetOptions(offset)
drill_writer.SetOptions(GS.p2v_k7(offset))
return drill_writer