Added support for v6 GetAuxOrigin change to out_position.py

This commit is contained in:
Diego Capusotto 2021-12-17 16:31:08 -03:00
parent bed617f72f
commit 69189e661e
3 changed files with 9 additions and 9 deletions

View File

@ -161,6 +161,13 @@ class GS(object):
return board.GetFootprints()
return board.GetModules()
@staticmethod
def get_aux_origin():
if GS.ki6(): # pragma: no cover (Ki6)
settings = GS.board.GetDesignSettings()
return settings.GetAuxOrigin()
return GS.board.GetAuxOrigin()
@staticmethod
def ki6():
return GS.kicad_version_n >= KICAD_VERSION_5_99

View File

@ -35,13 +35,6 @@ class DrillReport(Optionable):
self._unkown_is_error = True
def get_aux_origin(board):
if GS.ki6(): # pragma: no cover (Ki6)
settings = board.GetDesignSettings()
return settings.GetAuxOrigin()
return board.GetAuxOrigin()
class AnyDrill(BaseOptions):
def __init__(self):
# Options
@ -132,7 +125,7 @@ class AnyDrill(BaseOptions):
output_dir = os.path.dirname(output_dir)
# dialog_gendrill.cpp:357
if self.use_aux_axis_as_origin:
offset = get_aux_origin(GS.board)
offset = GS.get_aux_origin()
else:
offset = wxPoint(0, 0)
drill_writer = self._configure_writer(GS.board, offset)

View File

@ -230,7 +230,7 @@ class PositionOptions(VariantOptions):
x_origin = 0.0
y_origin = 0.0
if self.use_aux_axis_as_origin:
(x_origin, y_origin) = GS.board.GetAuxOrigin()
(x_origin, y_origin) = GS.get_aux_origin()
logger.debug('Using auxiliar origin: x={} y={}'.format(x_origin, y_origin))
for m in sorted(GS.get_modules(), key=lambda c: _ref_key(c.GetReference())):
ref = m.GetReference()