summaryrefslogtreecommitdiff
path: root/gerbonara/aperture_macros/parse.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-29 11:28:38 +0200
committerjaseg <git@jaseg.de>2023-04-29 11:28:38 +0200
commit8d5403260b72115cfd9f401289dfd0f894e272ea (patch)
tree0f7ac51c4072477018fec6f8d153d00365735f34 /gerbonara/aperture_macros/parse.py
parent778e81974580d910eac5e3f977acf79744d3e085 (diff)
downloadgerbonara-8d5403260b72115cfd9f401289dfd0f894e272ea.tar.gz
gerbonara-8d5403260b72115cfd9f401289dfd0f894e272ea.tar.bz2
gerbonara-8d5403260b72115cfd9f401289dfd0f894e272ea.zip
Fix aperture macro rotation issue and add missing data files
Diffstat (limited to 'gerbonara/aperture_macros/parse.py')
-rw-r--r--gerbonara/aperture_macros/parse.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gerbonara/aperture_macros/parse.py b/gerbonara/aperture_macros/parse.py
index 72703ae..b8970ff 100644
--- a/gerbonara/aperture_macros/parse.py
+++ b/gerbonara/aperture_macros/parse.py
@@ -55,9 +55,9 @@ class ApertureMacro:
comments: tuple = ()
def __post_init__(self):
- if self.name is None:
+ if self.name is None or re.match(r'GNX[0-9A-F]{16}', self.name):
# We can't use field(default_factory=...) here because that factory doesn't get a reference to the instance.
- object.__setattr__(self, 'name', f'gn_{hash(self):x}')
+ object.__setattr__(self, 'name', f'GNX{hash(self)&0xffffffffffffffff:016X}')
@classmethod
def parse_macro(cls, name, body, unit):