From 74fb384c4c0899f4d6f153da8db748a7a49e78ee Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 9 Nov 2023 19:16:37 +0100 Subject: aperture macros: work around gerbv/jlc wonkiness --- gerbonara/apertures.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gerbonara/apertures.py') diff --git a/gerbonara/apertures.py b/gerbonara/apertures.py index 094001d..09b15d2 100644 --- a/gerbonara/apertures.py +++ b/gerbonara/apertures.py @@ -16,6 +16,7 @@ # limitations under the License. # +import warnings import math from dataclasses import dataclass, replace, field, fields, InitVar, KW_ONLY from functools import lru_cache @@ -448,6 +449,10 @@ class ApertureMacroInstance(Aperture): def _params(self, unit=None): # We ignore "unit" here as we convert the actual macro, not this instantiation. # We do this because here we do not have information about which parameter has which physical units. - return tuple(self.parameters) + parameters = self.parameters + if len(parameters) > self.macro.num_parameters: + warnings.warn('Aperture definition using macro {self.macro.name} has more parameters than the macro uses.') + parameters = parameters[:self.macro.num_parameters] + return tuple(parameters) -- cgit