summaryrefslogtreecommitdiff
path: root/gerbonara/apertures.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-11-09 19:16:37 +0100
committerjaseg <git@jaseg.de>2023-11-14 21:52:12 +0100
commit74fb384c4c0899f4d6f153da8db748a7a49e78ee (patch)
tree6e956d0fb498f1e47b995ec6093827f2a5395fc8 /gerbonara/apertures.py
parent9af071344523accb5ae094ec76d5ace8102f1b0e (diff)
downloadgerbonara-74fb384c4c0899f4d6f153da8db748a7a49e78ee.tar.gz
gerbonara-74fb384c4c0899f4d6f153da8db748a7a49e78ee.tar.bz2
gerbonara-74fb384c4c0899f4d6f153da8db748a7a49e78ee.zip
aperture macros: work around gerbv/jlc wonkiness
Diffstat (limited to 'gerbonara/apertures.py')
-rw-r--r--gerbonara/apertures.py7
1 files changed, 6 insertions, 1 deletions
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)