From 8a2599f5f4c64a59a801d96e0048e42e10835e8b Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 8 Mar 2026 13:17:16 +0100 Subject: [PATCH] Add missing degree/radian conversion for polygon aperture rotation --- src/gerbonara/apertures.py | 2 ++ src/gerbonara/rs274x.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gerbonara/apertures.py b/src/gerbonara/apertures.py index 747da37..0896873 100644 --- a/src/gerbonara/apertures.py +++ b/src/gerbonara/apertures.py @@ -396,6 +396,8 @@ class PolygonAperture(Aperture): rotation = self.rotation % (2*math.pi / self.n_vertices) if math.isclose(rotation, 0, abs_tol=1e-6): rotation = None + else: + rotation = math.degrees(rotation) if self.hole_dia is not None: return self.unit.convert_to(unit, self.diameter), self.n_vertices, rotation, self.unit.convert_to(unit, self.hole_dia) diff --git a/src/gerbonara/rs274x.py b/src/gerbonara/rs274x.py index 144cba5..08eb8c2 100644 --- a/src/gerbonara/rs274x.py +++ b/src/gerbonara/rs274x.py @@ -880,7 +880,8 @@ class GerberParser: # Polygon aperture rotation is specified in degrees, but radians are easier to work with if match['shape'] == 'P': - modifiers[2] = math.radians(modifiers[2]) + if len(modifiers) > 2: + modifiers[2] = math.radians(modifiers[2]) new_aperture = kls(*modifiers, unit=self.file_settings.unit, attrs=tuple(self.aperture_attrs.items()), original_number=number)