Convert polygonal aperture rotations to radians

Polygonal aperture rotations are specified in degrees, however
gerbonara wants radians. This is a fix for issue #12 :

https://gitlab.com/gerbolyze/gerbonara/-/issues/12
This commit is contained in:
Matthew Mets 2024-08-17 21:10:41 +02:00 committed by jaseg
parent dd8ad98f13
commit a47a694ba0

View file

@ -878,6 +878,10 @@ class GerberParser:
if match['shape'] in 'RO' and (math.isclose(modifiers[0], 0) or math.isclose(modifiers[1], 0)):
self.warn('Definition of zero-width and/or zero-height rectangle or obround aperture. This is invalid according to spec.' )
# Polygon aperture rotation is specified in degrees, but radians are easier to work with
if match['shape'] == 'P':
modifiers[2] = math.radians(modifiers[2])
new_aperture = kls(*modifiers, unit=self.file_settings.unit, attrs=tuple(self.aperture_attrs.items()),
original_number=number)